Python: Corner to Center

I want to try to shorten a grasshopper route with python. But, how?
I cannot get the 3D-coordinates of the corner-point somehow, what am I doing wrong?

python corner to center (7.3 KB)

Hey @Edward,
I think you misspelled the method you are trying to call. It should be PointCoordinates, and I also think you should revise your input.
See here for further info:

1 Like

Thank you for your response.
Do you also know how to add values (sum)?

Sum or math.fsum does not work.

python corner to center (8.7 KB)

Check out the error you are getting. The fsum() only takes one argument, and you are feeding it two :-).

You could put them in a list to get around this:

>>> x = 10
>>> y = 43.5929
>>> sum([x,y])
>>> import math
>>> math.fsum([x,y])

Sorry for the snippet. I don’t have access to R3D/GH atm.

1 Like

Another way to make it smaller without using Python, just makes it as an expression. (5.7 KB)


Somehow, I cannot stich the values together as a coordinate.
Do you know what I am doing wrong?

python corner to center (8.6 KB)

You should try :

center = rs.AddPoint(Xcenter, Ycenter, Zcorner)

1 Like

You can also create a text string that the point component will “understand”.

center = "{"+str(Xcenter)+","+str(Ycenter)+","+str(Zcorner)+"}"

But this doesn’t create a point, only a comprehensive string.

1 Like

Thank you! :smile: :