Python Migration issues

today i failed again and actually i have no clue!

  1. i tried that:mig1

i imported dynamo lines into the node and wanted to access startpoint endpoint resulting in :

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “<string>”, line 46, in <module>
AttributeError: ‘Line’ object has no attribute ‘GetEndPoint’


  1. then i tried that


and failed again

whatever i try, my resulting XYZ will not convert into a valid Dynamo point


any suggestions?



Revit’s XYZ is not a valid geometry object per comments in the migration post. They have some special methods to handle that conversion. Now, your input into the Python is a DS Point. Right? I wrote two definitions to make my life easier when dealing with revit to Dynamo and Dynamo to Revit points while always remembering that those two operate in different units too (Revit in Feet and Dynamo in Meters). Here they are:

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)

Konrad, I haven’t dealt with this since migrating all my stuff from 0.6.3 to 0.7 , but at the time the methods suggested in the migration guide (as shown on your screenshot) worked fine for me. Could you elaborate a bit on why you wrote your own conversion functions?

Konrad, thanks!

everything works now!!!

Andreas, Dynamo out of the box conversion functions should be working fine. I just lose track sometimes of when did my units get converted over. I was working on re-mapping surfaces from Grasshopper to Revit and wanted to absolutely makes sure that my units were in order. I use both interchangeably.

Peter, by the way. The original code that you posted didnt work because you tried to feed a DS Point into a Revit XYZ transform method. You have to convert it over to Revit XYZ using either my methods or ones provided by Dynamo team before you can use it in a transform method. Then you have to convert your output to DS before sending them out. That’s just FYI. I haven’t looked exactly at your code when I first answered your question…but your mistake is pretty obvious.

Also, UnwrapElement() method is for revit elements getting passed in from DS environemnt, and not geometry. It doesn’t do anything to points.

Thanks for clearing that up, Konrad - I was worried I would have to go through some of my stuff again hunting for point conversions… :slight_smile:


i am using unwrapelement for (almost) all of my inputs because regarding to the migration guide unwrap is only unwrapping if there is something to unwrap else it will just do nothing.

so at least it prevents me from failing :wink:

regarding the codebug: that was exactly my problem. i tried to convert my DS coordinates to revit XYZ and failed.

i tried something like XYZ(0,0,0).ToRevitType() receiving: ‘XYZ’ object has no attribute ‘ToRevit()’

after that i tried to convert during output like outlist.append(point.ToDSType()) and failed again

honestly i was already confused at this point and tried every combination of ToRevitType(), ToDSType, To…

always ending up in some errors!

from now on i will use your conversions to become failsave!