Can any one explain me how FamilyInstance.GetReferences works please

Can any one explain me how FamilyInstance.GetReferences works please

Trying to get reference from family revit 2018

import clr

clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *

clr.AddReference(“RevitNodes”)
import Revit

from Revit.Elements import *

clr.AddReference(‘RevitAPI’)
from Autodesk.Revit.DB import *

clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

dataEnteringNode = IN

doc = DocumentManager.Instance.CurrentDBDocument

elements=UnwrapElement(IN[0])

ref = FamilyInstance.GetReferences(elements,FamilyInstanceReferenceType)

OUT = ref,elements
error

Hello,
As I tried your code I got the error that the attribute is not defined for this class.

If you try OUT = dir(FamilyInstance) you can see all valid methods and attributes to an object or class.
3

What are you trying to achieve exactly? Do you maybe need the Familysymbol?

1 Like

Hi Thanks for your reply !!!

I do trying to get dimensions to list of family instances if that make sense ???
Regards

If I understand your question correctly, you don’t really need any python script.

Either your family has the Parameters like “Length”, “height” etc, or you can measure the boundingbox, which gives you the maximum height length and width (So it is not accurate depending on what your purpose is)

If there is already a parameter for that in the Family then use only getparametervaluebyname and in case the parameter is not an instance parameter you might need to use it twice to reach the parameter.

see below:

4

3 Likes

Hi thanks for your response again.

Stuff I need to do is Dynamo don’t have.
I need to be 100% precice on placing dimensions.

All I trying to do is get specific reference from family instance to be able to place dimension on it

By goggling a lot I found that easiest method is to use revit 2018 and FamilyInstance.GetReferences()

So if I use this

•FamilyInstance.GetReferenceByName(elements,“Centre”)

I get results but can figure out yet how to make it to accept multiple elements .
Now if I do multiple it give me error “Expected Family instance got List”

Regards

Hi again,

if it works for individual families then my guess is that you need to define a “for loop” that operates on each member of the list and then define the FamilyInstance.GetReferenceByName(elements,“Centre”)
The input won’t accept a list, so you simply need to access each element in the list and define it.
like:
for i in yourlist:
FamilyInstance.GetReferenceByName(i,“Centre”)

I hope it helps

kind regards

1 Like

Thanks ill try this when I get home

Regards

Sorted thanks !!!

1 Like

Can someone show me how to get a reference from a Door family in Dynamo. I would like to get the Weak Reference (see image) to create dimensions.
Thanx in advance.

This is a new question. Can you make a new post for it instead of continuing a solved thread? You can make a link or reference to this one. It helps to keep things organized.

1 Like