-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added CreateAnalyticalCurvedPanel.cs
- Loading branch information
1 parent
034567c
commit 2ca39e3
Showing
2 changed files
with
59 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
SDK/Samples/ContextualAnalyticalModel/CS/CreateAnalyticalCurvedPanel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} | ||
} | ||
} |