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 / Point Select Mode.d3m < prev    next >
Encoding:
Text File  |  2003-09-29  |  1.8 KB  |  89 lines

  1. ' This macro prompts users to select an item, then get's the item's
  2. ' bounding box, It then goes into Point Select Mode and selects all the 
  3. ' points within that boundary.
  4. '
  5. ' Default Program Values for Drawing Mode
  6.   SGrid = 0
  7.   PSMode = 0
  8. ' Check to see if we're in Point Select Mode,
  9. ' if we are, take us out of it for now.
  10.     If sys(345) = 1 Then
  11.         PSMode = 1
  12.         >PointSelectMode
  13.         {
  14.         }
  15.     endif
  16. ' Check to see if the Snap Grid is on,
  17. ' if it is, turn it off for easy item selection
  18.     if Sys(17) = 1 then
  19.         SGrid = 1
  20.         Sys(17) = 0
  21.     endif
  22. ' Spot to return to after user failed to select an item
  23.     Start:
  24. ' Prompt user to select an item
  25.     SetPoint "Set a Point on an item to select it . . ." 1
  26. ' Select item where they clicked
  27.     POINTVAL xval yval zval 1
  28.     >PointSelect
  29.     {
  30.     <Type 0
  31.     <pointxyz [xval, yval, zval]
  32.     }
  33. ' If they failed to click on an item send them back to start
  34.     if Sys(34) = 0 then
  35.         Message "Please click on an object to select it"
  36.         goto Start
  37.     endif
  38. ' Get Boundary of Selected object
  39.     MinX = Sys(196)
  40.     MinY = Sys(197)
  41.     MaxX = Sys(198)
  42.     MaxY = Sys(199)
  43.     MinX = MinX - .05
  44.     MinY = MinY - .05
  45.     MaxX = MaxX + .05
  46.     MaxY = MaxY + .05
  47. ' Select Points of Item
  48.     >DragSelect
  49.     {
  50.     <Type 2
  51.     <pointxyz [MinX, MinY, 0]
  52.     <pointxyz [MaxX, MaxY, 0]
  53.     }
  54. ' Check to see if we're in Point Select Mode,
  55. ' if not, put us there.
  56.     If NOT(sys(345)) Then
  57.         >PointSelectMode
  58.         {
  59.         }
  60.     End If
  61. ' Select points of Item for moving or dragging
  62.     >DragSelect
  63.     {
  64.     <Type 3
  65.     <pointxyz [MinX], [MinY], 0
  66.     <pointxyz [MaxX], [MaxY], 0
  67.     }
  68. ' Move the Box
  69.     >Pointmove
  70.     {
  71.     <pointxyz 10, 10, 0
  72.     '[xval, yval, zval]
  73. '    <incomplete
  74. '    <pointxyz 5, 5, 0
  75.     }
  76. ' Turn Point Select Mode back on
  77.     if PSMode = 0 then
  78.         >PointSelectMode
  79.         {
  80.         }
  81.     endif
  82. ' Turn Snap Grid Back on
  83.     if SGrid = 1 then
  84.         Sys(17) = 1
  85.     endif
  86. ' End of Program
  87.     end
  88.  
  89.