FamilyInstance.Location Node

FamilyInstance.Location doesn’t read the survey point, only the project point of 0. As an example if my survey point is set at 5m and therefore level 0 is at 5m high yet there is an object placed at Level 0 it will read as its location for the point.z as 0. I know theres a way round this (ie. adding in the survey point further down the dynamo graph) but it would be good to have the ability to toogle between both project location and survey location in the FamilyInstance.Location node.


Couple of things to keep in mind with FamilyInstance.Location node:

  • It reports coordinates relative to Project Base Point.
  • Pay attention to where the origin point for each family is. This is usually a intersection of two Reference Planes, but if someone building the family placed a Room Location Point in the family that will take precedent.



With that being placed somewhere off center like in this situation in the bottom left corner, Dynamo might read a coordinate looking like this(even though i placed it in 0,0,0):



  • Once you are sure that you know that you are reading the right point then you can start looking at Project Base vs. Survey Point
  • Now in situation that Survey Point and Base Point are not the same (like you are describing above) what you would do is obtain the current project location (if your project has coordinates acquired from another file Revit will return information pertaining to the difference between that and a base point in your file). You can then use that information to create a transform and pass any point through it and it will return a point that is now relative to survey point. Example:






So you can see that FamilyInstance.Location node returns Z as equal to 0 which is correct in Base Point coordinate system. Now if you pass that point through my node will will transform it to be relative to Survey Point. You can see the Z reported at 5 for the second watch component.

Here’s the code:

#Copyright© 2015, Konrad Sobon


import clr
from Autodesk.DesignScript.Geometry import *

Import DocumentManager and TransactionManager

import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

Import RevitAPI

import Autodesk
from Autodesk.Revit.DB import *

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

from System.Collections.Generic import *

#The inputs to this node will be stored as a list in the IN variable.
dataEnteringNode = IN
inPoints = IN[0]

def toRvtPoint(point):
x = Autodesk.Revit.DB.UnitUtils.Convert(point.X, DisplayUnitType.DUT_METERS, DisplayUnitType.DUT_DECIMAL_FEET)
y = Autodesk.Revit.DB.UnitUtils.Convert(point.Y, DisplayUnitType.DUT_METERS, DisplayUnitType.DUT_DECIMAL_FEET)
z = Autodesk.Revit.DB.UnitUtils.Convert(point.Z, DisplayUnitType.DUT_METERS, DisplayUnitType.DUT_DECIMAL_FEET)
return Autodesk.Revit.DB.XYZ(x,y,z)

def toDynPoint(point):
x = Autodesk.Revit.DB.UnitUtils.Convert(point.X, DisplayUnitType.DUT_DECIMAL_FEET, DisplayUnitType.DUT_METERS)
y = Autodesk.Revit.DB.UnitUtils.Convert(point.Y, DisplayUnitType.DUT_DECIMAL_FEET, DisplayUnitType.DUT_METERS)
z = Autodesk.Revit.DB.UnitUtils.Convert(point.Z, DisplayUnitType.DUT_DECIMAL_FEET, DisplayUnitType.DUT_METERS)
return Autodesk.DesignScript.Geometry.Point.ByCoordinates(x,y,z)

def processListArg(_func, _list, _arg):
return map( lambda x: processListArg(_func, x, _arg) if type(x)==list else _func(x, _arg), _list )

def transformPoint(point, transform):
rvtPt = transform.OfPoint(toRvtPoint(point))
return toDynPoint(rvtPt)

currentLocation = doc.ActiveProjectLocation
projectPosition = currentLocation.get_ProjectPosition(XYZ.Zero)
z = projectPosition.Elevation
x = projectPosition.EastWest
y = projectPosition.NorthSouth
transform = Transform.CreateTranslation(XYZ(x,y,z))

#Assign your output to the OUT variable
if type(inPoints) == list:
OUT = processListArg(transformPoint, inPoints, transform)
OUT = transformPoint(inPoints, transform)

I will post this node to archi-lab as soon as I have time. For now, this should get you going.

1 Like

Konrad, Thanks for your thoughts. My issue isn’t with the origin point within the families but more just an overall thought to how Dynamo reads locations. I like the python script you have, Id done something similar to convert within my definition. I was merely suggesting a practical conversion within the dynamo window, that flips between reading survey or base point within the built in functions.

Hello Konard,

Great work saved a lot of my work .

Is this node posted in the Archi-lab. Thank you,

1 Like