Creates a floor within the project with the given horizontal profile and floor style on the specified level with the specified normal vector.
Namespace: Autodesk.Revit.CreationAssembly: RevitAPI (in RevitAPI.dll) Version: 21.0.0.0 (21.1.1.109)
Syntax
Visual Basic |
---|
Public Function NewFloor ( _
profile As CurveArray, _
floorType As FloorType, _
level As Level, _
structural As Boolean, _
normal As XYZ _
) As Floor |
Parameters
- profile
- Type: Autodesk.Revit.DB..::..CurveArray
An array of planar lines and arcs that represent the horizontal profile of the floor.
- floorType
- Type: Autodesk.Revit.DB..::..FloorType
A floor type to be used by the new floor instead of the default type.
- level
- Type: Autodesk.Revit.DB..::..Level
The level on which the floor is to be placed.
- structural
- Type: System..::..Boolean
If set, specifies that the floor 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 floor is considered
to be upper and down.
Return Value
if successful, a new floor object within the project, otherwise
nullNothingnullptra null reference (Nothing in Visual Basic).
Remarks
Examples
CopyC#
Floor CreateFloor(UIApplication application, Level level)
{
Autodesk.Revit.DB.Document document = application.ActiveUIDocument.Document;
Autodesk.Revit.Creation.Application appCreation = application.Application.Create;
FilteredElementCollector collector = new FilteredElementCollector(document);
collector.OfClass(typeof(FloorType));
FloorType floorType = collector.FirstElement() as FloorType;
XYZ first = new XYZ(0, 0, 0);
XYZ second = new XYZ(20, 0, 0);
XYZ third = new XYZ(20, 15, 0);
XYZ fourth = new XYZ(0, 15, 0);
CurveArray profile = new CurveArray();
profile.Append(Line.CreateBound(first, second));
profile.Append(Line.CreateBound(second, third));
profile.Append(Line.CreateBound(third, fourth));
profile.Append(Line.CreateBound(fourth, first));
XYZ normal = XYZ.BasisZ;
return document.Create.NewFloor(profile, floorType, level, true, normal);
}
CopyVB.NET
Private Function CreateFloor(application As UIApplication, level As Level) As Floor
Dim document As Autodesk.Revit.DB.Document = application.ActiveUIDocument.Document
Dim appCreation As Autodesk.Revit.Creation.Application = application.Application.Create
Dim collector As New FilteredElementCollector(document)
collector.OfClass(GetType(FloorType))
Dim floorType As FloorType = TryCast(collector.FirstElement(), FloorType)
Dim first As New XYZ(0, 0, 0)
Dim second As New XYZ(20, 0, 0)
Dim third As New XYZ(20, 15, 0)
Dim fourth As New XYZ(0, 15, 0)
Dim profile As New CurveArray()
profile.Append(Line.CreateBound(first, second))
profile.Append(Line.CreateBound(second, third))
profile.Append(Line.CreateBound(third, fourth))
profile.Append(Line.CreateBound(fourth, first))
Dim normal As XYZ = XYZ.BasisZ
Return document.Create.NewFloor(profile, floorType, level, True, normal)
End Function
Exceptions
See Also