Hi Everyone!
I have a main family “Family A”. In Family A i want to place many instances of Family B (family B is a line based family which is a shared nested in the family A).
I am using the familyinstance.bycurve node and its not working. can someone please help me why its not working in the family environment. how can i achieve that in family environment?
The node and script works perfectly when run in the project environment. Dynamo is also opened in the family environment.
I want family B to be placed in family A as a nested shared and not directly in the project.
thanks
The means of creating elements in a family environment are different than a project environment, not just in the UI but in the API as well. And as that node is built for a project environment (where 99% of Revit use occurs) you’ll need to find an alternative or build your own.
The method in question which you’ll need is this: NewFamilyInstance Method (Reference, Line, FamilySymbol)
The line and family symbol input should be fairly straightforward. For the reference I would recommend defining a reference plan and creating a Reference to that.
Thankyou so much for your reply. Sorry i dont know much about the API and PYthon. I am a dynamo user. I tried and searched online a bit and changed the Create.Familyinstance method as you suggested so that it takes three inputs (reference, line and family type).
I am not sure how can i input the reference to my script. Reference means a reference plane or it is something else?
Can you please check the code. Thank you for your time.
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
curves = UnwrapElement(IN[0])
famtype = UnwrapElement(IN[1])
lvl = UnwrapElement(IN[2])
elementlist = list()
counter = 0
TransactionManager.Instance.EnsureInTransaction(doc)
# make sure familysymbol is active
if famtype.IsActive == False:
famtype.Activate()
doc.Regenerate()
for curve in curves:
newobj = doc.Create.NewFamilyInstance(lvl,curve.ToRevitType(),famtype)
elementlist.append(newobj.ToDSType(False))
TransactionManager.Instance.TransactionTaskDone()
OUT = elementlist
Do you want the family instance on the ‘level’?
Yes on the default ref. level of the family.
can someone please help me on this i cant figure it out.
I tried it a bit today and came up empty. It’s a bigger lift and likely worth creating an issue on the Dynamo for Revit GitHub so we can get some formal development in this area.