Hi Pascal.
Thanks.
Last night, all I did was to add 476 (the actual elevation of my 0,0,0) to the code: str(round(z+476, 1))
Today, I tried to make more generic, so that the code can be used elsewhere. All I did was to add a key to all the height texts - a very self-explanatory key “Actual Elevation of Document’s 0,0,0”.
I gave all of them the 476 value and added the code:
elev = int(rs.GetUserText(id,"Actual Elevation of Document's 0,0,0",False))
obj.TextGeometry.Text =str(round(z+elev, 1))
It worked but it still not satisfying as a generic command. It requires that the text has that key (and I didn’t even troubleshoot what happens if the value is null or the key is absent).
In writing that one line of code
(it was the first time I opened a python code, and it has been decades since I wrote a bit of RhinoScript), I came across that you can have document Key. So the script would store the elevation on the Document Key, and you did not need to add the same key in all the texts (and to know exactly what key to be added if you start on a new drawing.
And I thought it would be great to have it running as a command line because I am that old that I hardly use buttons/icons or whatever name the kids are calling them these days.
It could go something like this:
FAKECODE Get objects and prompt: "Select texts (Current Reference Elevation = 0)"
FAKECODE When user types E, then ask for document elevation input, then SetDocumentUserText ("Document elevation,userinput)
FAKECODE Then just added to the z-coord of the text
It’s all very clear in my mind
, but I lack the knowledge to tackle (first) the basics and (second) the error handling.