Skip to content

Commit e369cb3

Browse files
committed
Ported to Revit 2016
also, added backward compatibility for the "script" attribute in the "PushButton" tag for AddIn manifest files. But seriously, use "src" instead!
1 parent a6f84fe commit e369cb3

14 files changed

+154
-8
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6.02 MB
Binary file not shown.

PythonConsoleControl/PythonConsoleControl.csproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@
4545
<ErrorReport>prompt</ErrorReport>
4646
<WarningLevel>4</WarningLevel>
4747
</PropertyGroup>
48+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug 2016|AnyCPU'">
49+
<DebugSymbols>true</DebugSymbols>
50+
<OutputPath>bin\Debug 2016\</OutputPath>
51+
<DefineConstants>DEBUG;TRACE</DefineConstants>
52+
<DebugType>full</DebugType>
53+
<PlatformTarget>AnyCPU</PlatformTarget>
54+
<ErrorReport>prompt</ErrorReport>
55+
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
56+
</PropertyGroup>
4857
<ItemGroup>
4958
<Reference Include="ICSharpCode.AvalonEdit">
5059
<HintPath>RequiredLibraries\AvalonEdit\ICSharpCode.AvalonEdit.dll</HintPath>
25.3 MB
Binary file not shown.
2.41 MB
Binary file not shown.

RevitPythonShell.sln

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,27 @@ Global
2222
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2323
Debug 2014|Any CPU = Debug 2014|Any CPU
2424
Debug 2015|Any CPU = Debug 2015|Any CPU
25+
Debug 2016|Any CPU = Debug 2016|Any CPU
2526
EndGlobalSection
2627
GlobalSection(ProjectConfigurationPlatforms) = postSolution
2728
{7E37F14E-D840-42F8-8CA6-90FFC5497972}.Debug 2014|Any CPU.ActiveCfg = Debug 2014|Any CPU
2829
{7E37F14E-D840-42F8-8CA6-90FFC5497972}.Debug 2014|Any CPU.Build.0 = Debug 2014|Any CPU
2930
{7E37F14E-D840-42F8-8CA6-90FFC5497972}.Debug 2015|Any CPU.ActiveCfg = Debug 2015|Any CPU
3031
{7E37F14E-D840-42F8-8CA6-90FFC5497972}.Debug 2015|Any CPU.Build.0 = Debug 2015|Any CPU
32+
{7E37F14E-D840-42F8-8CA6-90FFC5497972}.Debug 2016|Any CPU.ActiveCfg = Debug 2016|Any CPU
33+
{7E37F14E-D840-42F8-8CA6-90FFC5497972}.Debug 2016|Any CPU.Build.0 = Debug 2016|Any CPU
3134
{F1152D68-346B-4F48-8DB7-BE67B5CB1F49}.Debug 2014|Any CPU.ActiveCfg = Debug|Any CPU
35+
{F1152D68-346B-4F48-8DB7-BE67B5CB1F49}.Debug 2014|Any CPU.Build.0 = Debug|Any CPU
3236
{F1152D68-346B-4F48-8DB7-BE67B5CB1F49}.Debug 2015|Any CPU.ActiveCfg = Debug|Any CPU
3337
{F1152D68-346B-4F48-8DB7-BE67B5CB1F49}.Debug 2015|Any CPU.Build.0 = Debug|Any CPU
38+
{F1152D68-346B-4F48-8DB7-BE67B5CB1F49}.Debug 2016|Any CPU.ActiveCfg = Debug|Any CPU
39+
{F1152D68-346B-4F48-8DB7-BE67B5CB1F49}.Debug 2016|Any CPU.Build.0 = Debug|Any CPU
3440
{C8446636-C663-409F-82D0-72C0D55BBA1C}.Debug 2014|Any CPU.ActiveCfg = Debug 2014|Any CPU
3541
{C8446636-C663-409F-82D0-72C0D55BBA1C}.Debug 2014|Any CPU.Build.0 = Debug 2014|Any CPU
3642
{C8446636-C663-409F-82D0-72C0D55BBA1C}.Debug 2015|Any CPU.ActiveCfg = Debug 2015|Any CPU
3743
{C8446636-C663-409F-82D0-72C0D55BBA1C}.Debug 2015|Any CPU.Build.0 = Debug 2015|Any CPU
44+
{C8446636-C663-409F-82D0-72C0D55BBA1C}.Debug 2016|Any CPU.ActiveCfg = Debug 2016|Any CPU
45+
{C8446636-C663-409F-82D0-72C0D55BBA1C}.Debug 2016|Any CPU.Build.0 = Debug 2016|Any CPU
3846
EndGlobalSection
3947
GlobalSection(SolutionProperties) = preSolution
4048
HideSolutionNode = FALSE

RevitPythonShell/DeployRpsAddinCommand.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,21 @@ private void CreateAssembly()
188188

189189
foreach (var xmlPushButton in _doc.Descendants("PushButton"))
190190
{
191-
var scriptFile = GetRootedPath(
192-
_rootFolder, xmlPushButton.Attribute("src").Value); // e.g. "C:\projects\helloworld\helloworld.py" or "..\helloworld.py"
191+
string scriptFileName;
192+
if (xmlPushButton.Attribute("src") != null)
193+
{
194+
scriptFileName = xmlPushButton.Attribute("src").Value;
195+
}
196+
else if (xmlPushButton.Attribute("script") != null) // Backwards compatibility
197+
{
198+
scriptFileName = xmlPushButton.Attribute("script").Value;
199+
}
200+
else
201+
{
202+
throw new ApplicationException("<PushButton/> tag missing a src attribute in addin manifest");
203+
}
204+
205+
var scriptFile = GetRootedPath(_rootFolder, scriptFileName); // e.g. "C:\projects\helloworld\helloworld.py" or "..\helloworld.py"
193206
var newScriptFile = Path.GetFileName(scriptFile); // e.g. "helloworld.py" - strip path for embedded resource
194207
var className = "ec_" + Path.GetFileNameWithoutExtension(newScriptFile); // e.g. "ec_helloworld", "ec" stands for ExternalCommand
195208

0 commit comments

Comments
 (0)