Skip to content

Commit 2ca39e3

Browse files
author
Jeremy Tammik
committed
added CreateAnalyticalCurvedPanel.cs
1 parent 034567c commit 2ca39e3

File tree

2 files changed

+59
-10
lines changed

2 files changed

+59
-10
lines changed

SDK/Samples/ContextualAnalyticalModel/CS/ContextualAnalyticalModel.csproj

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<PropertyGroup>
4-
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
5-
None
6-
</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
7-
</PropertyGroup>
8-
93
<PropertyGroup>
104
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
115
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -68,12 +62,16 @@
6862
<RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
6963
</PropertyGroup>
7064
<ItemGroup>
65+
<Reference Include="RevitAddInUtility">
66+
<HintPath>..\..\..\..\..\..\Debugx64\RevitAddInUtility.dll</HintPath>
67+
<Private>False</Private>
68+
</Reference>
7169
<Reference Include="RevitAPI">
72-
<HintPath>C:\Program Files\Autodesk\Revit 2023\RevitAPI.dll</HintPath>
70+
<HintPath>..\..\..\..\..\..\Debugx64\RevitAPI.dll</HintPath>
7371
<Private>False</Private>
7472
</Reference>
7573
<Reference Include="RevitAPIUI">
76-
<HintPath>C:\Program Files\Autodesk\Revit 2023\RevitAPIUI.dll</HintPath>
74+
<HintPath>..\..\..\..\..\..\Debugx64\RevitAPIUI.dll</HintPath>
7775
<Private>False</Private>
7876
</Reference>
7977
<Reference Include="System" />
@@ -89,6 +87,7 @@
8987
<ItemGroup>
9088
<Compile Include="AddAssociation.cs" />
9189
<Compile Include="AnalyticalNodeConnStatus.cs" />
90+
<Compile Include="CreateAnalyticalCurvedPanel.cs" />
9291
<Compile Include="RemoveAssociation.cs" />
9392
<Compile Include="CreateAnalytcalPanel.cs" />
9493
<Compile Include="CreateAnalyticalMember.cs" />
@@ -117,4 +116,4 @@
117116
<PostBuildEvent>set FILEFORSAMPLEREG="$(SolutionDir)..\..\..\..\Regression\API\SDKSamples\UpdateSampleDllForRegression.pl"
118117
if exist %25FILEFORSAMPLEREG%25 perl %25FILEFORSAMPLEREG%25 $(ProjectExt) "$(ProjectPath)" "$(TargetPath)" "$(SolutionDir)"</PostBuildEvent>
119118
</PropertyGroup>
120-
</Project>
119+
</Project>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using Autodesk.Revit;
7+
using Autodesk.Revit.DB;
8+
using Autodesk.Revit.UI;
9+
using Autodesk.Revit.DB.Structure;
10+
11+
namespace ContextualAnalyticalModel
12+
{
13+
/// <summary>
14+
/// Implements the Revit add-in interface IExternalCommand
15+
/// </summary>
16+
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
17+
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
18+
class CreateAnalyticalCurvedPanel : IExternalCommand
19+
{
20+
public virtual Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
21+
{
22+
try
23+
{
24+
Document revitDoc = commandData.Application.ActiveUIDocument.Document;
25+
26+
using (Transaction transaction = new Transaction(revitDoc, "Create Analytical Curved Panel"))
27+
{
28+
transaction.Start();
29+
30+
Arc arc = Arc.Create(new XYZ(10, 10, 0), new XYZ(0, 0, 0), new XYZ(15, 10, 0));
31+
32+
//create a curved AnalyticalPanel
33+
AnalyticalPanel analyticalCrvPanel = AnalyticalPanel.Create(revitDoc, arc, new XYZ(0, 0, 1));
34+
35+
analyticalCrvPanel.StructuralRole = AnalyticalStructuralRole.StructuralRoleFloor;
36+
analyticalCrvPanel.AnalyzeAs = AnalyzeAs.SlabOneWay;
37+
38+
transaction.Commit();
39+
}
40+
41+
return Result.Succeeded;
42+
}
43+
catch (Exception ex)
44+
{
45+
message = ex.Message;
46+
return Result.Failed;
47+
}
48+
}
49+
}
50+
}

0 commit comments

Comments
 (0)