News:

Please note new Forum URL: forum.designcad.com

Main Menu
DesignCAD 3D Max 2027 box
Now available

DesignCAD 2027

Hatches that follow their boundaries, an on-screen dial to turn your model, and a way to find any command by name, in a clean Windows 11 look.

display X, Y, and Z data for a point

Started by edgar, July 07, 2007, 08:46:13 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

edgar

Often I want to see the XYZ location of a point on an entity (i.e. the corner of a box). Unfortuantely, the Coordinate Bar does not display the data in a visible way (the numbers will not fit in the text boxes). Here is a simple bit of code which asks the user to pick a point (I use gravity snap) then simply displays the point's x, y and z location. I assign this to the hotkey <ALT+p>:


'PointXYZ.d3m

'use to display the X Y and Z data for a point

'7 July 2007 by Ed Musgrove

'use the status bar for prompting the user
'which seems to be the DesignCAD style philosophy
originalStatusBarVisibility = sys(223)  'do this before Top so we can re-enter
if ( originalStatusBarVisibility = 0 ) then  'off
sys(223) = 1  'turn it on
endif

' get  user default precision
'precision 15
userPrecision = Sys(7)
precision userPrecision

Top:

setpoint "Pick a point to see its XYZ data." 1
if NOT(sys(1) = 1) then
sys(1027) = 4  'msg box style Yes/No
message "This macro requires 1 point.", chr$(13), "Do you wish to pick a single point and continue?"
sys(1027) = 0   'default "OK" style
if ( sys(1028) = 7 ) then
goto Terminate  'user said NO
else
goto Top
endif
endif
pointval x1, y1, z1, 1

X$ = x1
Y$ = y1
Z$ = z1

firstLine$ = "X = " + X$ + ", Y = " + Y$ + ", Z = " + Z$
message firstLine$

Terminate:
'set stuff back the way the user had it:
sys(223) = originalStatusBarVisibility
'sys(7) = userPrecision  'un-comment if you force max precision
end

-Ed