I have seen a couple of posts on the forum about cutting a beam by a reference plane. None of the replies answer the question. You are redirected to one of the following:
1) InstanceVoidCutUtils - so cut with a void (not what I am looking for)
2) Extrude a cube at the reference plane and then use SolidSolidCutUtils (again not cutting with a reference plane)
3) Creating a cut within the family (again not what I am looking for)
The Cut Geometry tool on the toolbar does the very thing I would like to do via the API. Is this method not available in the API? What am I missing?
Ok, so your requirement is not answered by the existing discussions. Plus, your requirement is satisfied by the user interface Cut Geometry tool. All very interesting to know. However, you do not reveal (clearly enough for me, at least) what your requirement actually is.
If I had to guess, I would guess that you wish to retrieve the intersection curves of the beam-plane cut. If so, you might try so set up a section view cutting the beam in the required location and retrieving only those curves that lie in the intersection plane. Maybe this will help?
Here are more articles on setting up a section view:
To be clear....
I want to be able to cut a structural framing element with a reference plane via the API. The Cut Geometry tool from the Revit UI does exactly that. Select the framing element, select the reference plane and the framing element is cut to the intersecting plane. The structural framing element can be moved or the framing element type can be changed and the cut is updated at the intersecting plane. Conversely the reference plane can be moved and the cut is also updated.
We are currently using voids to cut the structural framing element, but the void size needs to be adjusted based on the intersection angle, size and geometry of the framing member section. Basically cutting with a void gets more complicated and a reference plane would make this much simpler.
I want to achieve the same CutGeometry functionality via the API without using voids.
Also, the BooleanOperationsUtils appears to only apply to solids and cannot be applied to model elements.
So do you understand what I am looking for with my additional post? Is this possible without using the PostCommand - CutGeometry?
Yes, BooleanOperationsUtils applies to geometry solids. You can query a BIM element for its geometry, extract the solids from that, and apply the cut operation to those.
This does work for getting a cut geometry using BooleanOperationsUtils.CutWithHalfSpace(solid, plane), however i could not make this work on the geometry of the element itself.
As far as i know i cant just replace the element geometry by the resulting geometry of the cut operation.
Also the method BooleanOperationsUtils.CutWithHalfSpaceModifyingOriginalSolid(solid, plane) throws a null exception:
ArgumentNullException:ArgumentException
Null argument
Parameter name: solid
(left: original (FamilyInstance), right: cut geomerty (as DirectShape)
Code snippet:
(i hope the few extensionmethods used are self explanatory)
FamilyInstance element = app.ActiveUIDocument.SelectElement<FamilyInstance>();
ReferencePlane operand = app.ActiveUIDocument.SelectElement<ReferencePlane>();
Document.Transaction(() =>
{
GeometryElement geometry = element.get_Geometry(new Options());
var solids = geometry.QuGeometry()
.OfType<Solid>();
IEnumerable<Solid> cuts = solids.Select(s
//BooleanOperationsUtils.CutWithHalfSpace(solid, plane)
=> s.Cut(operand.GetPlane()));
Document.CreateDirectShapeElement(cuts.ToList<GeometryObject>())
.Move(new XYZ(1000, 0, 0).FromMillimeters());
//throws null exception
//foreach (var solid in solids)
//{
// if (!solid.IsElementGeometry && solid.Volume > 0)
// {
//BooleanOperationsUtils.CutWithHalfSpaceModifyingOriginalSolid(solid, plane)
// solid.CutModifyingOriginal(operand.GetPlane());
// }
//}
});
If you need to cut the element at a straight angle, the following algorithm will work for you
1. Calculate through LocationCurve the parameter at the location where the cut will be made
2. Use the FamilyInstance.Split(double param) method.
3. Delete the resulting unnecessary element after the split
The method is correct but something additional needs to be done; in my case, I still haven't managed to find the result. At the moment, I'm trying to obtain the geometries of solids resulting from dividing and applying Boolean operations.
whit only split
final result
Hello,
I have managed to address the issue using an approach that, while functional, doesn't fully satisfy me. I utilize the Split method of the FamilyInstance class at the intersection point of two beams. Then, I obtain the solids of both beams and use boolean operations (BooleanOperationsUtils.ExecuteBooleanOperation) to obtain the desired solids. Subsequently, I employ the DirectShape class to display the solids in the model. In summary, the procedure is divided into the following steps:
Selection and retrieval of beam solids: I select the relevant beams and extract their associated solids.
Determination of the intersection point: I find the intersection point between the beams and use it to split one or both beams at that point.
Obtaining solids after splitting: I obtain the solids resulting from the splitting of the beams.
Application of boolean operations: I use boolean operations as necessary to combine, intersect, or subtract the obtained solids.
Storage of geometric shapes in the DirectShape class: Finally, I store the resulting geometric shapes in instances of the DirectShape class for visualization in the model.
I just had a chat with @sseQTP9N of Hoermann and am in the process of raising an issue for this with the development team. To do so, I asked the brand new Meta 3 AI to summarise the discussion above (it was introduced yesterday) I simply copy-pasted the text from this thread and asked for a summary. This is the verbatim result:
Dear Scott, Sebastian, Aleksandr, Gustavo and others,
Thank you for your query and your extreme patience with this. Sorry it has not been escalated earlier. I asked the development team for their advice.
In addition, I also logged the issue REVIT-221256 [API to cut Structural Framing by Reference Plane like Cut Geometry tool] with our development team for this on your behalf as it requires further exploration and possibly a modification to our software. Please make a note of this number for future reference.
You are welcome to request an update on the status of this issue or to provide additional information on it at any time quoting this change request number.
This issue is important to me. What can I do to help?
This issue needs to be assessed by our engineering team and prioritised against all other outstanding change requests. Any information that you can provide to influence this assessment will help. Please provide the following where possible:
This information is crucial. Our engineering team has limited resources and must focus their efforts on the highest impact items. We do understand that this will cause you delays and affect your development planning, and we appreciate
Best regards,
Jeremy
The development team took a first look at the issue REVIT-221256 [API to cut Structural Framing by Reference Plane like Cut Geometry tool] and are discussing how to handle this. Meanwhile, they also point out:
There is another option to create a cut on Structural Families by using the Steel-Shortening feature. This shortening feature can be placed only on some supported families. I don't know if this a possible workaround or solution to what you are trying to achieve:
Best regards,
Jeremy
Further response from the development team:
This sounds similar to the long-standing request for a ‘split’ API for things like pipes, ducts, and more.
I don't believe there is a method to cut beams with a plane, but the next best thing is the Document.NewOpening method that creates a new opening in a beam, brace or column:
You need to need to find a host face and draw a cut profile.
A bit more involved but you can get the desired result.
Dear Jeremy,
I wanted to express my gratitude for your assistance and guidance during our interaction on the forum. I am pleased to inform you that, thanks to your guidance, I was able to solve the problem that led me to seek information on how to generate cuts in beams that intersect with other beams. Below, I detail the process I followed to achieve this:
In summary, the developed code allows the user to efficiently and accurately generate cuts in beams that intersect with other beams in the Revit model. This process involves beam selection, intersection calculation, beam division, opening creation, and finally, removal of the divided beam. Thanks to this solution, the design and modeling work in construction projects is facilitated.
It is important to consider the limitations of this method, such as:
Thank you again for your support and guidance throughout this process.
Best regards,
Can't find what you're looking for? Ask the community or share your knowledge.