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 / Sections.d3m < prev    next >
Encoding:
Text File  |  2003-09-29  |  1.6 KB  |  76 lines

  1. ' This macro lets users set 2 points for a rubber-band box shaped area
  2. ' then prompts them to choose one of the 3 following options:
  3. '
  4. ' Section Cut Off
  5. ' Section Copy
  6. ' Section Delete
  7. '
  8. ' This macro also lets users set 2 points directly horizontal or
  9. ' vertical to each other with the Line Snap command and offsets 
  10. ' the numbers slightly so either of the 3 commands still work.
  11. '
  12. ' Set Rubber band type to 2D Box for user
  13.     Sys(41) = 2
  14. '
  15. ' Prompt User for 2 points for boundary of the area
  16.     setpoint "Set two points for the section . . . " 2
  17.     ' If user set only 1 points, there can be no area
  18.       if sys(1) < 2 then
  19.         Message "Please run the program again and set more than 1 point for the section."
  20.         End
  21.       endif
  22. '
  23. ' Create an Array for the points the user sets
  24.     Dim X(2), Y(2), Z(2)
  25. '
  26. ' Store points the user just set into the Array
  27.     for a = 1 to Sys(1)
  28.         PointVal X(a), Y(a), Z(a) a
  29.     next a
  30. '
  31. ' Test for lined up data points
  32.     if Y(2) = Y(1) then
  33.         Y(2) = Y(2) + 1
  34.     endif
  35.     if X(2) = X(1) then
  36.         X(2) = X(2) + 1
  37.     endif
  38. ' Ask User what they would like to do with the points.
  39.     Window 5,15
  40.     Print "1) Section Cut Off"
  41.     Print "2) Section Copy"
  42.     Print "3) Section Delete"
  43.     AnyKey a$
  44.     WClose
  45. if a$ = "1" then goto One
  46. if a$ = "2" then goto Two
  47. if a$ = "3" then goto Three
  48. End
  49. ' Section Cuttoff
  50. One:
  51.     >SectionCut
  52.     {
  53.     for a = 1 to Sys(1)
  54.         <Pointxyz [X(a), Y(a), Z(a)]
  55.     next a
  56.     }
  57. End
  58. ' Section Copy
  59. Two:
  60.     >SectionCopy
  61.     {
  62.     for a = 1 to Sys(1)
  63.         <Pointxyz [X(a), Y(a), Z(a)]
  64.     next a
  65.     }
  66. End
  67. ' Section Delete
  68. Three:
  69.     >SectionDeleteCut    
  70.     {
  71.     for a = 1 to Sys(1)
  72.         <Pointxyz [X(a), Y(a), Z(a)]
  73.     next a
  74.     }
  75. End
  76.