Hi,
I am new to Dynamo and Python script. I am trying to get X coordinate alone from a point using Python script but it giving error as “getset_descriptor is not callable”.
My code
import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *
The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN
Place your code below this line
Assign your output to the OUT variable.
x=1
y=2
z=3
point=[]
point.append(Point.ByCoordinates(x,y,z))
coord=Point.X(point)
OUT = coord
Please help me to solve this error.
Thanks in advance
This:
coord=Point.X(point)
Should be:
coord=point.X
And next time please use the ‘’</>’’ option when adding code for formatting reasons
1 Like
Thanks Jonathan,
I am writing the code in dynamo Python script.
I tried changing the caps of syntax after I am getting error of “AttributeError: ‘list’ object has no attribute ‘X’”
I am new to this forum so I cant able to upload my dynamo file.
Any other option is there to send the dynamo file?
Actually I got the syntax as you said.
Same syntax I used in Python script, even though I am getting error for that syntax.
Thanks
You have to be able to distinguish between lists and what is inside lists, you’ve created a list called “point”, you append information to this list using “append”.
“point” is now a list containing exactly 1 point.
if you wish to go inside the list you can loop through it like so:
for pt in point:
coord = pt.X
but if you are to output more than one point I’d recommend doing everything inside a loop, including appending your output to a list e.g. containing the X coordinates.
Though python is by no means necessary to export x-coordinates of points.
1 Like
Thanks Jonathan.
I am new to Dynamo and Python and in the learning stage.
This advice will solve my issue.
Once again thanks
I can really encourage going through the Dynamo Primer:
http://dynamoprimer.com/en/
And the DesignScript guide:
Attempt to get a grasp of Dynamo before you venture into Python
And if a comment solved your issue please mark it as the solution, and maybe leave a like here and there
2 Likes
I’m not sure exactly what you’re after, but this might be helpful
Also if you wish learning material for the python node have a look at this:
4 Likes
Really this materials will help me to learn the basics.
Thanks for your guidance Jonathan.
If any more quires I will seek help from you people.