Create Method (Document, IList(Curve), Level, Int32, Boolean)


Creates a new BeamSystem with specified profile curves.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 22.0.0.0 (22.1.0.0)
Since: 2014

Syntax

C#
public static BeamSystem Create(
	Document document,
	IList<Curve> profile,
	Level level,
	int curveIndexForDirection,
	bool is3d
)
Visual Basic
Public Shared Function Create ( _
	document As Document, _
	profile As IList(Of Curve), _
	level As Level, _
	curveIndexForDirection As Integer, _
	is3d As Boolean _
) As BeamSystem
Visual C++
public:
static BeamSystem^ Create(
	Document^ document, 
	IList<Curve^>^ profile, 
	Level^ level, 
	int curveIndexForDirection, 
	bool is3d
)

Parameters

document
Type: Autodesk.Revit.DB Document
The document in which the new BeamSystem is created.
profile
Type: System.Collections.Generic IList Curve
The profile of the BeamSystem.
level
Type: Autodesk.Revit.DB Level
The level on which the BeamSystem is to be created. The work-plane of the BeamSystem will be the sketch plane associated with the Level. If there is no current sketch plane associated with the level yet, we will create a default one.
curveIndexForDirection
Type: System Int32
Index of the curve in the profile to be used as direction. '0' means the direction to use the first curve in profile. The curve from the profile to be used as direction must be a Line.
is3d
Type: System Boolean
Whether the BeamSystem is 3D. If the BeamSystem is 3D, the sketchPlane must be a level, otherwise an exception will be thrown.

Return Value

If successful, a new BeamSystem object will be returned.

Examples

Copy C#
// Build a profile for the beam system creation
XYZ first = new XYZ(0, 0, 0);
XYZ second = new XYZ(40, 0, 0);
XYZ third = new XYZ(40, 25, 0);
XYZ fourth = new XYZ(0, 25, 0);
List<Curve> profile = new List<Curve>();
profile.Add(Line.CreateBound(first, second));
profile.Add(Line.CreateBound(second, third));
profile.Add(Line.CreateBound(third, fourth));
profile.Add(Line.CreateBound(fourth, first));

// Create a beam system
BeamSystem beamSystem = BeamSystem.Create(document, profile, level, 0, false);
if (null != beamSystem)
{
    // Change some properties, such as elevation
    Parameter elevationPara = beamSystem.get_Parameter(BuiltInParameter.INSTANCE_ELEVATION_PARAM);
    if (null != elevationPara)
    {
        elevationPara.Set(10.0);
    }
}
Copy VB.NET
' Build a profile for the beam system creation
Dim first As New XYZ(0, 0, 0)
Dim second As New XYZ(40, 0, 0)
Dim third As New XYZ(40, 25, 0)
Dim fourth As New XYZ(0, 25, 0)
Dim profile As New List(Of Curve)()
profile.Add(Line.CreateBound(first, second))
profile.Add(Line.CreateBound(second, third))
profile.Add(Line.CreateBound(third, fourth))
profile.Add(Line.CreateBound(fourth, first))

' Create a beam system
Dim beamSystem__1 As BeamSystem = BeamSystem.Create(document, profile, level, 0, False)
If beamSystem__1 IsNot Nothing Then
    ' Change some properties, such as elevation
    Dim elevationPara As Parameter = beamSystem__1.Parameter(BuiltInParameter.INSTANCE_ELEVATION_PARAM)
    If elevationPara IsNot Nothing Then
        elevationPara.[Set](10.0)
    End If
End If

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentException The input profile contains at least one helical curve and is not supported for this operation. -or- The curve index must be valid and the curve to be used as direction must be a Line. -or- The input level does not have associated plan view. -or- The plan view associated with the input level is not valid. -or- Can not get valid sketch plane from the input level.
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was null
Autodesk.Revit.Exceptions ModificationForbiddenException The document is in failure mode: an operation has failed, and Revit requires the user to either cancel the operation or fix the problem (usually by deleting certain elements). -or- The document is being loaded, or is in the midst of another sensitive process.
Autodesk.Revit.Exceptions ModificationOutsideTransactionException The document has no open transaction.

See Also