PointCoordinate Text Field

Hi,

Can anyone please help me with trying to get point coordinates using TextField in python 3.0
I know there are other ways to get this information but I need it to be a TextField . I have done curve length using similar syntax but cannot get PointCordinate to work.
Also not sure how to define the “Axes” to be output.
The font info comes from an eto form and that is ok.

Maybe its a bug not sure.

All the best

Roger

    if objs:
        for obj in objs:

            crvstart = rs.CurveStartPoint(obj)
            stpt = rs.AddPoint(crvstart)
            
            #print(stpt)#ignore these lines 
            #print(crvstart)
            #csx = crvstart[0]
            #csy = crvstart[1]
            #csz = crvstart[2]

            crvend = rs.CurveEndPoint(obj)

            #%<PointCoordinate("ObjectID","Axes")>%  #### this is the format given in rhino help file
            stco = "%<PointCoordinate ('" + str(stpt) + "')>%"
            
            print(stco)

            text3D = rs.AddText(str(stco), crvstart, height=Font, font="Arial", font_style=1, justification=2)
  

    print ("End of Print Curve XYZ")




Have you tried using something like “XY” or “XYZ” for the axis parameter?

Hi yes I have , not sure why it doesn’t work, used it in rvb scripts before but never in Python 3 so maybe I am not going about it correctly.

Roger

Something like this?

guid = str(stpt)
axes = "XYZ"
stco = '%<PointCoordinate("{}","{}")>%'.format(guid, axes)

It looks like you have a space here PointCoordinate ( that could be causing a problem?

Hi,

I have tried so many combinations that I have lost count , I am aware of the space but I will try your format in the morning.

Many thanks and Merry Christmas

Hi Measure,

I can confirm that your code does work and I am now able to continue with the rest of my script.

I hope the folks at McNeels can update the info for Text Fields especially when being used in Python as the example in the help files didn’t work.
Merry Christmas and a Happy New Year

If you think something there might be a bug or a mistake somewhere, please provide a link so the developers know where to start.