Insert line based family

Insert line based family

Anonymous
Not applicable
1,743 Views
3 Replies
Message 1 of 4

Insert line based family

Anonymous
Not applicable

Hello. I want to insert line based family into project. But there is exeption "This method is only applicable for detail families". I used "Generic Model line based.rft" for created family. What is the problem?

 

MyFamilySymbols = FilteredElementCollector(doc).OfClass(FamilySymbol).ToElements()
FamSymbol = 0
for famS in MyFamilySymbols:
    if famS.FamilyName == CableFamilyName:
     FamSymbol = famS
     break

TransactionManager.Instance.EnsureInTransaction(doc)
XYZforFam=XYZ(0,0,0)
XYZforFam2=XYZ(1000,1000,0)
newLine = Line.CreateBound(XYZforFam,XYZforFam2)
newobj = doc.Create.NewFamilyInstance(newLine, FamSymbol, doc.ActiveView)
TransactionManager.Instance.TransactionTaskDone()

 

  •  
0 Likes
Accepted solutions (1)
1,744 Views
3 Replies
Replies (3)
Message 2 of 4

Yien_Chao
Advisor
Advisor

try to use curve instead

NewFamilyInstance Method (Line, FamilySymbol, View)

0 Likes
Message 3 of 4

franciscopossetto
Advocate
Advocate
Accepted solution

Hey,

 

Based on the error you have and according to the documentation, the method you are using (the one that takes a Line, FamilySymbol and View as argument) is used to add a detail family instance on the document.  You must use a different Template to create your Family, the one called Detail item line based.rft.

 

Alternatively, you could maintain your family and use other arguments with the same method. There is an option that takes Face, Line and FamilySymbol.

https://www.revitapidocs.com/2020/993bb1aa-d039-d50b-7485-5f404add7cfa.htm

 

I think both alternatives should work.

Good Luck!

Github:
https://github.com/franpossetto
Message 4 of 4

Anonymous
Not applicable

Thank you for response. I think I have to try another overload NewFamilyInstance(Curve, FamilySymbol, Level, StructuralType)

I want to place my family on level.