home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2003 November / PCWK1103B.iso / DesignCAD 3D Max PLUS trial 30 / DATA1.CAB / Example_Files / Sample_Macros / Get Size.d3m < prev    next >
Encoding:
Text File  |  2003-09-29  |  954 b   |  31 lines

  1. ' This simple macro displays the X, Y, and Z size of the 
  2. ' selected object.
  3. '
  4. ' This macro works fine in 3D mode, since all lines in 3D
  5. ' Mode are of zero width.  If you use this macro in 2D Mode, 
  6. ' you can get results which you may not expect, since SYS 
  7. ' functions 196-201 use the boundary of the items, NOT their
  8. ' point locations, and points for wide lines are set in their
  9. ' middles, not on either side of the wide line, until exploded.
  10. '
  11. ' Make sure something is selected before going on 
  12.     if Sys(80) = 0 then
  13.         Message "Please select an object before using this macro."
  14.         goto Ender
  15.     endif
  16. ' Get Values about selected item
  17.     MinX = Sys(196)
  18.     MinY = Sys(197)
  19.     MaxX = Sys(198)
  20.     MaxY = Sys(199)
  21.     MinZ = Sys(200)
  22.     MaxZ = Sys(201)
  23. ' Calculate Sizes
  24.     SizeX = MaxX - MinX
  25.     SizeY = MaxY - MinY
  26.     SizeZ = MaxZ - MinZ
  27. ' Display Results
  28.     Message "Object Size is . . .  X: ",SizeX, "    Y: ", SizeY, "    Z: ", SizeZ
  29. Ender:
  30. End
  31.