How to get all the Reference planes existing in a revit family from project environment? which defines origin?

How to get all the Reference planes existing in a revit family from project environment? which defines origin?

I suppose needs to use Getreferences method in Revit API and set a type of reference on it but in this case I do not know what references types used in the family defines origin, so basically I am wondering how to get just the reference planes that defines origin, as you see in the reference planes elements parameter “Defines Origin” which I believe corresponds to the builtin parameter DATUM_PLANE_DEFINES_ORIGIN, but I cannot get access to the element of reference plane of a family document from the project document and its family instance and get the reference plane element parameters.

Also I saw GeniusLoci package @Alban_de_Chasteigner has a node called Element Origin Reference that invents a reference passing through origin point of the family with method ParseFromStableRepresentation Method, but I do not want to create anything new, just get what is in the family.

I tried to find the answer by using the snoop plugin and I do not find a clear way to get access to this property of reference planes, here a screenshot of what I found:

Although if I open the revit family and select the reference plane I can see its parameters

I do not want to think that I need to do a geometrical operation to see what planes are intersecting the element location point of the family instance. :exploding_head:

Genius Loci also has a node called FamilyInstance Reference ByName. The origin reference names would be “Center (Left/Right)” and “Center (Front/Back)”. The node also provides reference planes that represent the origin planes, so you can use those for orientation comparison for dimensioning.

I do not know what is the name of the reference planes in a family that defines origin, it can be anything and also nothing, no name…I cannot edit the families to have a name that I could find with the method element.GetReferenceName().

for example I found a reference plae type “Not A Reference” and empty name is defining the origin of a family.

without editing the family it’s probably the best solution


Here workaround using at temporary spot coordinates in a Floor Plan View (2D view)

get origin references

import clr
import sys
import System

#import Revit API
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB

#import transactionManager and DocumentManager (RevitServices is specific to Dynamo)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

import functools

def decoTransaction(func):
    def wrapper(*args, **kwargs):
        t = Transaction(doc, func.__name__)
        ret = func(*args, **kwargs)
        return ret      
    return wrapper  

def get_origin_references(familyInstance):
    out = []
    for type_ref in System.Enum.GetValues(FamilyInstanceReferenceType):
        loc = elem.Location.Point
        bend_xyz = loc + XYZ(1,1,0)
        end_xyz = bend_xyz + XYZ(3,0,0)
        lst_ref = elem.GetReferences(type_ref)
        for ref in lst_ref:
                dim = doc.Create.NewSpotCoordinate(current_view, ref, loc, bend_xyz , end_xyz, loc, True)
                # Check if the origin dimension is close to the Location element
                if dim.Origin.DistanceTo(loc) < 0.01:
                    out.append([ref.ConvertToStableRepresentation(doc), elem.GetReferenceName(ref), ref, type_ref])
            except Exception as ex:
    return out

current_view = doc.ActiveView
#Preparing input from dynamo to revit
elem = UnwrapElement(IN[0])

OUT = get_origin_references(elem)

I am not sure if functools library is available in ironpython 2.7, but the solution looks great

You can remove the wraps functools here

1 Like