Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to create different unattached families to a .rft file without stacking it

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
mateus.komarchesqui
283 Views, 3 Replies

How to create different unattached families to a .rft file without stacking it

I'm coding a tool to drill holes to beams (structural framing). Each beam will host 2 drills, one to each end of it.

 

To create my void extrusion that will cut the host I create an Arc at the coordinate (0, 0, 0) and extrude it in my "Metric Generic Model.rtf" located at "C:\ProgramData\Autodesk\RVT 2020\Family Templates\English" directory. Then I load the family into the document with the beams to be drilled and get the FamilySymbol like this:

 

Family family = familyTemplateDoc.LoadFamily(doc);

FamilySymbol familySymbol = family.GetFamilySymbolIds()
      .Select(x => doc.GetElement(x) as FamilySymbol)
      .FirstOrDefault();

 

 

In my document I insert the family instance using "doc.Create.NewFamilyInstance" ate the desired coordinate and finally AddInstanceVoidCut the beams.

 

I'm facing the following issue (I moved the voids up so we can see it easily):

 

mateuskomarchesqui_0-1644265722791.png

 

Apparently each time I extrude a new Arc I am stacking it (the thicker cylinder is above for visualisation, it would overwrite the thinner one).

 

The next beam to be drilled will keep stacking the void forms. So if I select 4 beams, the 8th hole will be done by the 8 void forms stacked.

 

What could I be doing wrong? The extrusion needs to be created at the (0, 0, 0) coordinate so it can be easily modified at the .rfa file, beeing easily found throughout the .rfa file.

3 REPLIES 3
Message 2 of 4

Sounds like a case of wrong type of family template and wrong NewFamilyInstance overload, there are easier ways to create holes in beams:

 

Use "Metric Generic Model face based.rft" cut the host with the void in the family.

Load the family into the project

Host the family on the beam web:

NewFamilyInstance(Face, XYZ, XYZ, FamilySymbol) or
NewFamilyInstance(Reference, XYZ, XYZ, FamilySymbol)

 

Note also there is no need to even create a family for this, you can create an opening by face:

Document.NewOpening

 

Message 3 of 4

I wanted to use voids in order to learn it, I'm new at the API and I was overcomplicating the solution. It's kinda overkill what I was trying to do...

Switched up to Document.Create.NewOpening and it works like a charm! Thank you.
Message 4 of 4

Thank you for the confirmation and many thanks to Richard for the good suggestion! Preserved for posterity:

 

https://thebuildingcoder.typepad.com/blog/2022/03/drilling-holes-in-beams-and-other-projects.html#4

  

Jeremy Tammik, Developer Advocacy and Support, The Building Coder, Autodesk Developer Network, ADN Open

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community