Get coordinate from column error

Element Coordinate ID from paramaters.dyn (30.3 KB)
I’m using above script for get element coordinate, I’m previously using most of the file this script working fine but I’m using recent faced one error


please resolve this issue.
@christian.stan @jacob.small @sovitek @Vikram_Subbaiah

coordinate conversion python script this python node is shown warning error

# Enable Python support and load DesignScript library
import clr
clr.AddReference('RevitServices')
import RevitServices 
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)

clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import FilteredElementCollector, BuiltInCategory

# Create a list object from singleton...
def tolist(obj1):
	if hasattr(obj1,"__iter__"): return obj1
	else: return [obj1]
	
# Convert Point from  Internal to Shared Coordinates...
def ToSharedCoordinates(pt):
	pt = doc.ActiveProjectLocation.GetTotalTransform().Inverse.OfPoint(pt).ToPoint()
	return pt

# Convert Point from Relative to Project Coordinates...
def ToProjectCoordinates(pt,pbp):
	pt = pt.Subtract(pbp).ToPoint()
	return pt

# Input Variables...
pts = tolist(IN[0])
# Output Variables...
shared, project, relative = [], [], []

# Collect Project Basepoint...
basePt = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_ProjectBasePoint).FirstElement()
pbp = basePt.get_BoundingBox(None).Min

for pt in pts:
	# Convert point to Shared Coordinates...
	shared.append(ToSharedCoordinates(pt.ToXyz()))
	# Convert point to Project Coordinates...
	project.append(ToProjectCoordinates(pt.ToXyz(),pbp))
	# Point is already Relative to the Internal Origin...
	relative.append(pt)
     
OUT = shared, project, relative
1 Like

line 42

# Convert point to Shared Coordinates...
	shared.append(ToSharedCoordinates(pt.ToXyz()))

Your Element.GetGeometry node is outputting a line, however your python script is expecting a point. You will have to break the line down to points with a geometry Points node

1 Like

I didn’t understand, sorry I’m newbie please explain elaborate.

You are asking Python to give you ONE X and ONE Y value for a line.

As a line is a curve and a curve is the collection of all points between it’s start and end value, there is no ONE X or ONE Y, but an infinite series of values.

So before you can pull the X and Y value, you need to select one point on the curve.

For some of the elements such as window, door, tags you will get a point as an output if you use Element.GetLocation, for some of the elements such as Walls you will get a line as an output. Check the result of your Element.GetLocation and see if you have lines or points. You need to connect points to the python node to make it worked.

Actually, that dynamo working fine for other file, I face that issue got one file only.