Hi Revit Users,
I need help finding the correct method to obtain cut geometry using the API. The cut geometry I'm referring to is shown in the attached picture. I’ve tried the following methods:
Unfortunately, they didn’t work as expected. When I manually cut in Revit, the result is different from what I get using these methods. Specifically, I’m working with a shared family that contains a void.
Could anyone please provide guidance on the correct method to use for cutting in this scenario?
Thanks!
Solved! Go to Solution.
Solved by TripleM-Dev.net. Go to Solution.
First of all, please search this forum for existing threads on "cut geometry" and suchlike. I see quite many of them. Maybe some of them can help. Then you can summarise what we have learned so far, so that we know where we stand as a community, and can continue researching from there:
Thank you!
Hi,
InstanceVoidCutUtils.AddInstanceVoidCut Should be the one, I think.
I use this to autocut walls with a void family, although it's not a Shared Family with a void.
Maybe the wrong family is selected in the API to cut. In the UI I believe you select the top-family to cut with.
Either the UI command makes a cut-relation with the nested family and the cut-element or ....
Make the Cut with the UI and check with the API util tools what the cut relation (which element with what) and work you're way back in the API.
Use below function to find the relation:
Please note that cut geometry also requires a corresponding setting in the family definition:
Search the two articles for "cut geom"...
Hi Thanks ,
Here is my code :
public void CutSheetPilesWithFloor(Document doc, List<FamilyInstance> sheetPiles, Floor floor)
{
Transaction transaction = new Transaction(doc, "Cut Sheet Piles with Floor");
transaction.Start();
foreach (FamilyInstance sheetPile in sheetPiles)
{
// Add a solid-solid cut between the floor and the sheet pile
SolidSolidCutUtils.AddCutBetweenSolids(doc, floor, sheetPile);
}
transaction.Commit();
transaction.Start();
foreach (FamilyInstance sheetPile in sheetPiles)
{
if (InstanceVoidCutUtils.CanBeCutWithVoid(floor))
{
InstanceVoidCutUtils.AddInstanceVoidCut(doc, floor, sheetPile);
}
}
transaction.Commit();
}
I am just trying to cut the sheet pile with the floor, and I have attached my family , when I cut them manually in revit it works , and it cuts the way I want , however when I try cutting it via the code I am recieving erorrs, or not what I want
I attached the cut geometry I want in the picture , also the shared family , IHave no idea why with the code ots not working , I am going back and forth with no results.
I appricaite any help provided
Hi
Thanks for the advice, Apparetnly I had to use a for loop instead of a foreach loop and it works,
Moreover sometimes the nested family(the void inside the family) wasn't cutting properly which is why I had to adjust it and add a 1 mm height but overall your comment have helped a lot
Can't find what you're looking for? Ask the community or share your knowledge.