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

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

mateus.komarchesqui
Enthusiast Enthusiast
629 Views
3 Replies
Message 1 of 4

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

mateus.komarchesqui
Enthusiast
Enthusiast

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.

0 Likes
Accepted solutions (1)
630 Views
3 Replies
Replies (3)
Message 2 of 4

RPTHOMAS108
Mentor
Mentor
Accepted solution

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

 

0 Likes
Message 3 of 4

mateus.komarchesqui
Enthusiast
Enthusiast
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.
0 Likes
Message 4 of 4

jeremy_tammik
Autodesk
Autodesk

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
0 Likes