mirror of
https://github.com/jeremytammik/RevitSdkSamples.git
synced 2026-08-06 05:01:35 +00:00
added CreateAnalyticalCurvedPanel.cs
This commit is contained in:
@@ -1,11 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
|
||||||
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
|
|
||||||
None
|
|
||||||
</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
@@ -68,12 +62,16 @@
|
|||||||
<RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
|
<RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Reference Include="RevitAddInUtility">
|
||||||
|
<HintPath>..\..\..\..\..\..\Debugx64\RevitAddInUtility.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
<Reference Include="RevitAPI">
|
<Reference Include="RevitAPI">
|
||||||
<HintPath>C:\Program Files\Autodesk\Revit 2023\RevitAPI.dll</HintPath>
|
<HintPath>..\..\..\..\..\..\Debugx64\RevitAPI.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="RevitAPIUI">
|
<Reference Include="RevitAPIUI">
|
||||||
<HintPath>C:\Program Files\Autodesk\Revit 2023\RevitAPIUI.dll</HintPath>
|
<HintPath>..\..\..\..\..\..\Debugx64\RevitAPIUI.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
@@ -89,6 +87,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="AddAssociation.cs" />
|
<Compile Include="AddAssociation.cs" />
|
||||||
<Compile Include="AnalyticalNodeConnStatus.cs" />
|
<Compile Include="AnalyticalNodeConnStatus.cs" />
|
||||||
|
<Compile Include="CreateAnalyticalCurvedPanel.cs" />
|
||||||
<Compile Include="RemoveAssociation.cs" />
|
<Compile Include="RemoveAssociation.cs" />
|
||||||
<Compile Include="CreateAnalytcalPanel.cs" />
|
<Compile Include="CreateAnalytcalPanel.cs" />
|
||||||
<Compile Include="CreateAnalyticalMember.cs" />
|
<Compile Include="CreateAnalyticalMember.cs" />
|
||||||
@@ -117,4 +116,4 @@
|
|||||||
<PostBuildEvent>set FILEFORSAMPLEREG="$(SolutionDir)..\..\..\..\Regression\API\SDKSamples\UpdateSampleDllForRegression.pl"
|
<PostBuildEvent>set FILEFORSAMPLEREG="$(SolutionDir)..\..\..\..\Regression\API\SDKSamples\UpdateSampleDllForRegression.pl"
|
||||||
if exist %25FILEFORSAMPLEREG%25 perl %25FILEFORSAMPLEREG%25 $(ProjectExt) "$(ProjectPath)" "$(TargetPath)" "$(SolutionDir)"</PostBuildEvent>
|
if exist %25FILEFORSAMPLEREG%25 perl %25FILEFORSAMPLEREG%25 $(ProjectExt) "$(ProjectPath)" "$(TargetPath)" "$(SolutionDir)"</PostBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Autodesk.Revit;
|
||||||
|
using Autodesk.Revit.DB;
|
||||||
|
using Autodesk.Revit.UI;
|
||||||
|
using Autodesk.Revit.DB.Structure;
|
||||||
|
|
||||||
|
namespace ContextualAnalyticalModel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Implements the Revit add-in interface IExternalCommand
|
||||||
|
/// </summary>
|
||||||
|
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
|
||||||
|
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
|
||||||
|
class CreateAnalyticalCurvedPanel : IExternalCommand
|
||||||
|
{
|
||||||
|
public virtual Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Document revitDoc = commandData.Application.ActiveUIDocument.Document;
|
||||||
|
|
||||||
|
using (Transaction transaction = new Transaction(revitDoc, "Create Analytical Curved Panel"))
|
||||||
|
{
|
||||||
|
transaction.Start();
|
||||||
|
|
||||||
|
Arc arc = Arc.Create(new XYZ(10, 10, 0), new XYZ(0, 0, 0), new XYZ(15, 10, 0));
|
||||||
|
|
||||||
|
//create a curved AnalyticalPanel
|
||||||
|
AnalyticalPanel analyticalCrvPanel = AnalyticalPanel.Create(revitDoc, arc, new XYZ(0, 0, 1));
|
||||||
|
|
||||||
|
analyticalCrvPanel.StructuralRole = AnalyticalStructuralRole.StructuralRoleFloor;
|
||||||
|
analyticalCrvPanel.AnalyzeAs = AnalyzeAs.SlabOneWay;
|
||||||
|
|
||||||
|
transaction.Commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Result.Succeeded;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
message = ex.Message;
|
||||||
|
return Result.Failed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user