Python weird behavior when using ToDSType() wrapper

So i had a node that was taking a CSV file and converting it into points. In version 0.6.3 it worked pretty well, now I converted to 0.7.1 and I am experiencing some unusual behavior. For some reason when using this code:

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

# Import RevitAPI
clr.AddReference(“RevitAPI”)
import Autodesk
from Autodesk.Revit.DB import *

import clr
clr.AddReference(“RevitNodes”)
import Revit

# Import ToProtoType, ToRevitType geometry conversion extension methods
clr.ImportExtensions(Revit.GeometryConversion)

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

#Split single string at line breaks into a list of strings
xyzList = IN[0].rsplit(’\n’)
# Cull the last line, which is blank
del xyzList[len(xyzList)-1]

ptList =

for xyz in xyzList:
xyz = xyz.replace("{","")
xyz = xyz.replace("}","")
tpt = xyz.rsplit(’,’)

ptList.append(Autodesk.Revit.DB.XYZ(float(tpt[0]),float(tpt[1]),float(tpt[2])).ToPoint())

#Assign your output to the OUT variable
OUT = ptList

I am getting a different result then when using Dynamo Code Block to generate points…ideas?

Capture

 

Hint. Its the Dynamo Code block that is giving me a correct result, but why is Python output wrong?

Thanks!

It’s definitely messing up the units because the python result is exactly 3.28 times less: 1m=3.28ft.Tho I have no idea where the conversion happens.

Indeed. I am not converting units anywhere. As a matter of fact its all unit less. One thing that is happening i think is that my Dynamo file is set to Meters and Revit API internally operates in feet so there must be a conversion happening inside of ToPoint() method.

Can someone on the development team explain?

konrad i have already complained about this behavior in some of my topics.

fact is that revit’s units are decimal feet.

dynamo converts automatically if units are required for output. (for coordinates, for parameters…)

in my dynamo nodes i always have converter nodes that i add to the code on requirement.

and yes i dislike that behavior too.

peter

Decimal feet are hard coded into Revit’s source code. Dynamo’s developers have no control over Revit so I think they’ve tried to remedy the situation by adding a built-in conversion to every node(and DS definition) that does coordinate manipulation.Is the output the python and DS nodes the same when you set your units to decimal feet?