Transforming dynamo points of type: Autodesk.DesignScript.Geometry.Point into Autodesk.Revit.DB.Point leads to unexpected results

Thanks in advance for the time invested!

I would like to transform a list of points of type Autodesk.DesignScript.Geometry.Point
into a list of points of type Autodesk.Revit.DB.Point.

CUSTOM_automaticRoomTags(temp).dyn (86.9 KB)

I have set up a PythonScript to do this, which is to transform the items of the lists into Revit points in a loop and then run out an articulated list.

I wanted to accomplish that with this script:

import clr

clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript import *

clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *
    
clr.AddReference("RevitAPIUI")
from  Autodesk.Revit.UI import *

clr.AddReference("RevitServices")
from RevitServices import *

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

clr.ImportExtensions(Revit.GeometryConversion)

x = IN[0]
y = IN[1]
z = IN[2]
RESULT = []

for a in range(len(x)):
	for b in range(len(x[a])):
		p = XYZ(x[a][b], y[a][b], z[a][b]).ToPoint()
		RESULT.append(p)

OUT = RESULT
	

But the generated output items are of type:
Autodesk.DesignScript.Geometry.Point, where the coordinates are represented /3,281.

I would have expected the following output:
List items of type: Autodesk.Revit.DB.Point
Point coordinates: value * 3.281 for feet

I think I have something mixed up in the order of the commands?

The first node (GetViewsByType) is from the package “Modelical”.

Use Point.Create(XYZ) for creating Revit Points. ToPoint() will convert to a Dynamo Point like you see.

1 Like

Thanks for your answer!

I tried first to use that constructor in the script, but it returned: List of str “Autodesk.Revit.DB.Point” instead of points. Where is my error here?

import clr

clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript import *

clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *
    
clr.AddReference("RevitAPIUI")
from  Autodesk.Revit.UI import *

clr.AddReference("RevitServices")
from RevitServices import *

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

clr.ImportExtensions(Revit.GeometryConversion)

x = IN[0]
y = IN[1]
z = IN[2]
RESULT = []


for a in range(len(x)):
	for b in range(len(x[a])):
		#p = XYZ(x[a][b], y[a][b], z[a][b]).ToPoint()
		p = Point.Create(XYZ(x[a][b], y[a][b], z[a][b]))
		RESULT.append(p)

OUT = RESULT

Where are you getting that it’s a string?

Ok, I must have misinterpreted the output. I interpreted the output for a list of str with the value “Object.Type”. I didn’t see that the resulting list items were already Revit points.

I first thought that likewise a list of point coordinates is output, which looks similar to the node on the left and was a little confused by this at first :slight_smile:

1 Like