Rhino.AddPoint as World Co Ordinate value

Hi

I am re visiting some old scripts and as you can see below I used to add a point in World co ordinates in the following fashion pulling Dim 1 from an ini file

pt2 = "Point" & " "
pt2 = pt2 & "w" & Dim1 & ",0,0" & " "
pt2 = pt2 & "Enter" & " "
Rhino.Command pt2
pt2ID = Rhino.FirstObject
arr2 = Rhino.PointCoordinates(pt2ID)

However if I now use the current scripting command Rhino.AddPoint as below

pt1 = Rhino.Str2Pt("0," & Dim1 & ",0")
Rhino.AddPoint pt1

how do I force Rhino to use World Co Ordinates and not Cplane Co ordinates ? it’s probably very simple but it has been one of those days.

I think this might work:

pt1 = Rhino.Str2Pt("w0," & Dim1 & ",0")

But why are you jumping through all these hoops using strings when you can just use Rhino.AddPoint(x,y,z) where x, y and z are numbers?

–Mitch

Hi Mitch,

Back in the days of Rhino 3 I wrote some scripts and they had to use world co ordinates, the problem I found was that depending which viewport was active at the time the script was run then the local co ordinate system was being used unless I prefixed the array with “W”. i have tried the line of code as you suggest but I get an error. Nearly all the data I work with is in ini style files so need to be able to call up specific Dims when needed. As we now have V6 to play with I thought it about time I revisited and improved them.

Roger

Yeah, that’s wrong actually, I misread your line of code. But in any case Rhino.AddPoint(Array(x,y,z)) will always use world coordinates, it doesn’t care about which viewport is active.

I would still try to convert those strings first to real number point coordinates and then feed that to Rhino.AddPoint().

–Mitch

Cheers Mitch I will give it try and see how I get on.

Roger