Create Method (Document, IList(Curve), ElementId, ElementId, Boolean, XYZ)


Creates a non rectangular profile wall within the project using the specified wall type and normal vector.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 2015.0.0.0 (2015.0.0.0)

Syntax

C#
public static Wall Create(
	Document document,
	IList<Curve> profile,
	ElementId wallTypeId,
	ElementId levelId,
	bool structural,
	XYZ normal
)
Visual Basic
Public Shared Function Create ( _
	document As Document, _
	profile As IList(Of Curve), _
	wallTypeId As ElementId, _
	levelId As ElementId, _
	structural As Boolean, _
	normal As XYZ _
) As Wall
Visual C++
public:
static Wall^ Create(
	Document^ document, 
	IList<Curve^>^ profile, 
	ElementId^ wallTypeId, 
	ElementId^ levelId, 
	bool structural, 
	XYZ^ normal
)

Parameters

document
Type: Autodesk.Revit.DB Document
The document in which the new wall is created.
profile
Type: System.Collections.Generic IList Curve
An array of planar lines and arcs that represent the vertical profile of the wall.
wallTypeId
Type: Autodesk.Revit.DB ElementId
Id of the wall type to be used by the new wall instead of the default type.
levelId
Type: Autodesk.Revit.DB ElementId
Id of the level on which the wall is to be placed.
structural
Type: System Boolean
If set, specifies that the wall is structural in nature.
normal
Type: Autodesk.Revit.DB XYZ
A vector that must be perpendicular to the profile which dictates which side of the wall is considered to be inside and outside.

Return Value

If successful a new wall object within the project.

Examples

Copy C#
public Wall CreateWallUsingProfile(Autodesk.Revit.DB.Document document, Level level, WallType wallType)
{
    // Build a wall profile for the wall creation
    XYZ first = new XYZ(0, 0, 0);
    XYZ second = new XYZ(20, 0, 0);
    XYZ third = new XYZ(20, 0, 15);
    XYZ fourth = new XYZ(0, 0, 15);
    IList<Curve> profile = new List<Curve>();

    // Get application creation object
    Autodesk.Revit.Creation.Application appCreation = document.Application.Create;

    profile.Add(Line.CreateBound(first, second));
    profile.Add(Line.CreateBound(second, third));
    profile.Add(Line.CreateBound(third, fourth));
    profile.Add(Line.CreateBound(fourth, first));

    XYZ normal = new XYZ(0, 1, 0);

    // Create a wall
    return Wall.Create(document, profile, wallType.Id, level.Id, true, normal);
}
Copy VB.NET
Public Function CreateWallUsingProfile(document As Autodesk.Revit.DB.Document, level As Level, wallType As WallType) As Wall
    ' Build a wall profile for the wall creation
    Dim first As New XYZ(0, 0, 0)
    Dim second As New XYZ(20, 0, 0)
    Dim third As New XYZ(20, 0, 15)
    Dim fourth As New XYZ(0, 0, 15)
    Dim profile As IList(Of Curve) = New List(Of Curve)()

    ' Get application creation object
    Dim appCreation As Autodesk.Revit.Creation.Application = document.Application.Create

    profile.Add(Line.CreateBound(first, second))
    profile.Add(Line.CreateBound(second, third))
    profile.Add(Line.CreateBound(third, fourth))
    profile.Add(Line.CreateBound(fourth, first))

    Dim normal As New XYZ(0, 1, 0)

    ' Create a wall
    Return Wall.Create(document, profile, wallType.Id, level.Id, True, normal)
End Function

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentException The input profile contains at least one helical curve and is not supported for this operation.
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was NULL
Autodesk.Revit.Exceptions InvalidOperationException Failed to create the wall.
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