Good morning.
I have some problems revising families in revit…
Some present very complex problems in understanding their creation.
So I was wondering if I can solve it from PYTHON but I ran into another problem…!!!
I DON’T KNOW HOW TO ACCESS THE INTERIOR OF A FAMILY!
I present some cases that I want to know if the family complies or not with what is required…
Attached revit file and images…
Thanks for your support
EXAMPLE COLUMNS.rvt (4.2 MB)
EVALUATE FAMILY.dyn (9.0 KB)
The objective is to determine which of these families of structural columns is correctly modeled, considering the following.
1.- Is it a parametric family? will return TRUE / FALSE.
2.-Does the family have the reference planes (LEFT/RIGTH) (FRONT/BACK)? It Will return TRUE/FALSE
3.-Is the geometry of the family restricted to reference planes and dimensions related to parameters? It Will return TRUE/FALSE
4.-Is the geometry of the family located in the center of the workspace…? It Will return TRUE/FALSE
5.-Does the family have nested geometries? It Will return TRUE/FALSE
6.-Does the family have more than one geometry within it? It Will return TRUE/FALSE
7.- Are all the parameters of the family referenced to the modification of the geometry…? It Will return TRUE/FALSE.
Hi,
So if you open (any empty) family, and then start Dynamo, Dynamo will then understand that the Current Document is a family, you can use dedicated nodes written to be used in families and if you pull the active doc in python, it will be a ‘family document’.
If you try to run Dynamo in a project environment, your access to families is much more limited.
I recollect that Orchid has a number of nodes for families? I can’t remember which other packages have them… Orchid is installed from here if you don’t already have it… Perhaps that will avoid your need for Python 
Hope that helps,
Mark
Good morning …
Thanks for your suggestion but I still don’t understand how I could do it…
Could you give me an example of how to do it … thank you very much
Hello, everyone …
I am trying to get the name of the reference but I have this error…
Could someone please tell why it is failing if I am placing the method as mentioned in the REVIT API… and how could I solve it…???
Thank you very much…
You’re on the right track. The method you’re trying to use (GetReferenceName()) is a member of the FamilyInstance class, not the Reference class. So you have to call the method on a FamilyInstance.
Pretty sure this should work:
for i in columnas:
ref = i.GetReferences(FamilyInstanceReferenceType.CenterFrontBack)
referencias.append(ref)
ref_name = i.GetReferenceName(ref)
nombre.append(ref_name)
I keep having problems…???
I don’t understand what is happening
Hi,
Part of the difficulty of working in Python is how much more awkward it is to understand errors…
The error is telling you that you are asking for a ‘Reference’ of a ‘List’ and that isn’t working… So instead you need to iterate through the ‘List’ and get a ‘Reference’ of each of the elements inside it.
I would OUT the ‘ref’ to see what it is… If it is a list containing only 1 element you could use ref[0], otherwise you’ll want another ‘For’ to get what you want.
Hope that helps,
Mark
Thanks for your suggestions… but the error changed “NO REFERENCE…?”
So far the code works fine…
I am obtaining the references from the elements and it is showing me those that do have said references and EMPTY LIST those that do not have these references.
Do you think the problem is the EMPTY LISY…???.
Here I added a “for” to be able to review the new list with the references… but it marks an error…
I feel that the problem may be due to the “EMPTY LIST” but I don’t know how I could evaluate it
Thank you.
Hi,
So, good work, yes, as suspected the ‘ref’ is a ‘list’ containing 1 ‘reference’, so if you use ref[0] that’ll work…
Dealing with the empty lists is a different issue, you’ll need to evaluate ‘ref’ and if the value is ‘an empty list’ e.g. it’s length is 0, append some text? ‘Is empty’ perhaps? because your goal is to tell people whether the family is missing those reference planes?
if len(ref) == 0:
ref = 'is empty list'
referencias.append(ref)
else:
referencias.append(ref[0])
You get the idea… As you’ll understand, teaching python in this way is not ideal
If you search the forum you’ll find good resources for learning python, otherwise using a package such as Orchid would be better?
Hope that helps,
Mark