I am asked to split a floor or a roof in parts. I am able to do so in a 2D-way, like described in Parts, Assemblies, PartUtils and DivideParts.
This works well. You create a curveList
based on a face and DivideParts
splits the object in several parts.
foreach( Face face in faceArray )
{
// find the center of the face
BoundingBoxUV bbox = face.GetBoundingBox();
// Some other code
}
// Create the curves that will be used for the part division.
IList<Curve> curveList = new List<Curve>();
Curve curve1 = app.Create.NewLine( pointCenter, pointRight, true );
curveList.Add( curve1 );
Curve curve2 = app.Create.NewLine( pointRight, pointCorner, true );
curveList.Add( curve2 );
Curve curve3 = app.Create.NewLine( pointCorner, pointTop, true );
curveList.Add( curve3 );
Curve curve4 = app.Create.NewLine( pointTop, pointCenter, true );
curveList.Add( curve4 );
// intersectingReferenceIds will be empty for this example.
ICollection<ElementId> intersectingReferenceIds = new List<ElementId>();
// Divide the part
Transaction dividePartTransaction = new Transaction( doc, "Divide Part" );
dividePartTransaction.Start();
PartMaker maker = PartUtils.DivideParts( doc, elementIdsToDivide, intersectingReferenceIds, curveList, sketchPlane.Id );
dividePartTransaction.Commit();
I would also like to be able to split an object in a 3D-way. So not only in the X and Y direction but also in the Z-direction.
Since this method is based on a Face
and a BoundingBoxUV
(2-dimensions), I cannot see what the best way is to proceed.
To make clear what I want to accomplish, I included a picture of a roof, divided in parts bij Revit. I would also like to split the roof indicated by the red line.