home *** CD-ROM | disk | FTP | other *** search
/ Corel Draw 7 / CD7_CAD.ISO / cad / boolesub.csc < prev    next >
Encoding:
Text File  |  1996-10-28  |  7.8 KB  |  256 lines

  1. 'This script will demonstrate the BOOLEAN SUBTRACT command
  2.  
  3. '************************************************************************************************************
  4. '************************************************************************************************************
  5. '************************************************************************************************************
  6. '************************************************************************************************************
  7. REM ⌐ 1996 Corel Corporation. All rights reserved.
  8. '************************************************************************************************************
  9.  
  10. REM Declare Subroutines
  11. declare Sub Cross(xcoo#,ycoo#,zcoo#)
  12. declare Sub DoLine(x1#,y1#,z1#,x2#,y2#,z2#)
  13.  
  14.  
  15.  
  16. REM Declare Variables
  17. Global Title as string
  18.  
  19. Rem Set Variable
  20. Title$ = "CorelCAD: BOOLEAN SUBTRACT demonstration"
  21.  
  22. Withobject "CorelCad.Automation.1"
  23.     
  24.     .FileNew
  25.  
  26.     String1$ = "This script will demonstrate the BOOLEAN SUBTRACT command."
  27.     String2$ = "For more information on BOOLEAN commands consult CorelCAD's On-line Help."
  28. BEGIN DIALOG DispMessage1 25,70, 316, 70,Title$
  29.     TEXT  4, 2, 310, 17, String1$
  30.     TEXT  4, 20, 310, 19, String2$
  31.     TEXT  6, 46, 310, 13, "Click NEXT to proceed or CANCEL to exit the Script."
  32.     PUSHBUTTON  198, 44, 40, 16, "Next >>>"
  33.     CANCELBUTTON  240, 44, 40, 16
  34. END DIALOG
  35.  
  36.     Return% = DIALOG (DispMessage1)
  37.     if Return = 2 then STOP
  38.  
  39.  
  40.  
  41.     String1$ = "First, a BOX will be created."
  42.     String2$ = ""
  43. BEGIN DIALOG DispMessage2 25,70, 316, 70,Title$
  44.     TEXT  4, 2, 310, 17, String1$
  45.     TEXT  4, 20, 310, 19, String2$
  46.     TEXT  6, 46, 310, 13, "Click NEXT to proceed or CANCEL to exit the Script."
  47.     PUSHBUTTON  198, 44, 40, 16, "Next >>>"
  48.     CANCELBUTTON  240, 44, 40, 16
  49. END DIALOG
  50.  
  51.     Return% = DIALOG (DispMessage2)
  52.     if Return = 2 then STOP
  53.  
  54.     .Box -1, -70.9561, -5.34296, 60.8839, -10.3302, -58.8714, 30.4419
  55.     .zoomtoall
  56.  
  57.  
  58.     String1$ = "Two CYLINDERS will be created in such a way that they intersect with the BOX."
  59.     String2$ = ""
  60. BEGIN DIALOG DispMessage3 25,70, 316, 70,Title$
  61.     TEXT  4, 2, 310, 17, String1$
  62.     TEXT  4, 20, 310, 19, String2$
  63.     TEXT  6, 46, 310, 13, "Click NEXT to proceed or CANCEL to exit the Script."
  64.     PUSHBUTTON  198, 44, 40, 16, "Next >>>"
  65.     CANCELBUTTON  240, 44, 40, 16
  66. END DIALOG
  67.  
  68.     Return% = DIALOG (DispMessage3)
  69.     if Return = 2 then STOP
  70.  
  71.  
  72.     .Cylinder -1, -90.4353, -55.8332, 55.4512, -90.4353, -41.0619, 55.4512, 27.6016, -41.0619, 55.4512
  73.     .Cylinder -1, -45.9459, -95.2608, 56.4339, -45.9459, -95.2608, 69.2702, -38.4749, 16.6776, 69.2702    
  74.     .zoomtoall
  75.  
  76.  
  77.  
  78.     String1$ = "The BOOLEAN SUBTRACT command will SUBTRACT the CYLINDERS from the BOX."
  79.     String2$ = "This command is located in the TRANSFORM menu."
  80. BEGIN DIALOG DispMessage4 25,70, 316, 70,Title$
  81.     TEXT  4, 2, 310, 17, String1$
  82.     TEXT  4, 20, 310, 19, String2$
  83.     TEXT  6, 46, 310, 13, "Click NEXT to proceed or CANCEL to exit the Script."
  84.     PUSHBUTTON  198, 44, 40, 16, "Next >>>"
  85.     CANCELBUTTON  240, 44, 40, 16
  86. END DIALOG
  87.  
  88.     Return% = DIALOG (DispMessage4)
  89.     if Return = 2 then STOP
  90.  
  91.  
  92.     String1$ = "The BOX to be subtracted from will be selected."
  93.     String2$ = "The selection becomes highlighted in green."
  94. BEGIN DIALOG DispMessage5 25,70, 316, 70,Title$
  95.     TEXT  4, 2, 310, 17, String1$
  96.     TEXT  4, 20, 310, 19, String2$
  97.     TEXT  6, 46, 310, 13, "Click NEXT to proceed or CANCEL to exit the Script."
  98.     PUSHBUTTON  198, 44, 40, 16, "Next >>>"
  99.     CANCELBUTTON  240, 44, 40, 16
  100. END DIALOG
  101.  
  102.     Return% = DIALOG (DispMessage5)
  103.     if Return = 2 then STOP
  104.  
  105.  
  106.     REM Highlight Box in Green
  107.     .SelectPointAt -81.0329, 25.1537, 30.442, 0
  108.     .deleteselection
  109. cross -3.01358, -27.3168, 69.2702
  110.     .NewLayer " ", , -1, 0, 0, 0, 0, 255, 1, 6, ""
  111.     .setcurrentlayer " " 
  112.     .Box -1, -70.9561, -5.34296, 60.8839, -10.3302, -58.8714, 30.4419
  113.     .setcurrentlayer "Default Layer"
  114.     .SelectPointAt -88.7166, -15.7045, 69.2702, 0
  115. WAIT FOR 1
  116.     .SelectPointAt -81.0329, 25.1537, 30.442, 0
  117.     .DELETESELECTION    
  118.     .Box -1, -70.9561, -5.34296, 60.8839, -10.3302, -58.8714, 30.4419
  119.  
  120.  
  121.  
  122.     String1$ = "The CYLINDERS will now be selected one at a time."
  123.     String2$ = "The selections become highlighted in green."
  124. BEGIN DIALOG DispMessage6 25,70, 316, 70,Title$
  125.     TEXT  4, 2, 310, 17, String1$
  126.     TEXT  4, 20, 310, 19, String2$
  127.     TEXT  6, 46, 310, 13, "Click NEXT to proceed or CANCEL to exit the Script."
  128.     PUSHBUTTON  198, 44, 40, 16, "Next >>>"
  129.     CANCELBUTTON  240, 44, 40, 16
  130. END DIALOG
  131.  
  132.     Return% = DIALOG (DispMessage6)
  133.     if Return = 2 then STOP
  134.  
  135.  
  136.     REM Highlight Box in Green
  137.     .SelectPointAt -52.4574, -61.324, 30.3359, 0
  138.     .NewLayer " ", , -1, 0, 0, 0, 0, 255, 1, 6, ""
  139.     .setcurrentlayer " "
  140.     cross 27.5711, -59.6188, 69.2702
  141.     .Box -1, 31.6049, -73.2238, 72.3951, -92.3456, -40.53, 39.8026
  142.     .SelectPointAt -88.7166, -15.7045, 69.2702, 0
  143. wait for 1
  144.     cross -32.7556, 14.7567, 69.2702
  145.     .Box -1, -64.0869, 22.0546, 72.4538, -22.9779, -97.0788, 40.3813
  146.         .setcurrentlayer "Default Layer"
  147.     .SelectPointAt -88.7166, -15.7045, 69.2702, 0
  148. WAIT FOR 1    
  149.     .SelectPointAt -116.506, 31.761, 0, 1
  150.     .SelectPointAt -79.84, -49.7437, 0, 1
  151.     .DELETESELECTION
  152.     
  153.     .SelectWithinRegion -47.2874, 24.0007, 69.2702, -19.5022, 8.20174, 69.2702
  154.     .DELETESELECTION
  155.     .SelectWithinRegion -15.6262, -14.6199, 69.2702, 10.5882, -36.3417, 69.2702
  156.     .DELETESELECTION
  157.     .SelectWithinRegion 13.4115, -48.1549, 69.2702, 41.0419, -67.5232, 69.2702
  158.     .DELETESELECTION
  159.  
  160.  
  161.  
  162.     String1$ = "The CYLINDERS will now be subtracted from the BOX."
  163.     String2$ = ""
  164. BEGIN DIALOG DispMessage7 25,70, 316, 70,Title$
  165.     TEXT  4, 2, 310, 17, String1$
  166.     TEXT  4, 20, 310, 19, String2$
  167.     TEXT  6, 46, 310, 13, "Click NEXT to proceed or CANCEL to exit the Script."
  168.     PUSHBUTTON  198, 44, 40, 16, "Next >>>"
  169.     CANCELBUTTON  240, 44, 40, 16
  170. END DIALOG
  171.  
  172.     Return% = DIALOG (DispMessage7)
  173.     if Return = 2 then STOP
  174.  
  175.  
  176.     .SetPointXYZ -81.0329, 25.1537, 30.442
  177.     .SetPointXYZ -86.9019, -34.9779, 55.4512
  178.     .SetPointXYZ -45.7764, -117.119, 69.2702
  179.     .SolidSubtract 
  180.  
  181.  
  182.     String1$ = "A MATERIAL will now be applied to the object."
  183.     String2$ = "RENDERING may take a minute."
  184. BEGIN DIALOG DispMessage8 25,70, 316, 70,Title$
  185.     TEXT  4, 2, 310, 17, String1$
  186.     TEXT  4, 20, 310, 19, String2$
  187.     TEXT  6, 46, 310, 13, "Click NEXT to proceed or CANCEL to exit the Script."
  188.     PUSHBUTTON  198, 44, 40, 16, "Next >>>"
  189.     CANCELBUTTON  240, 44, 40, 16
  190. END DIALOG
  191.  
  192.     Return% = DIALOG (DispMessage8)
  193.     if Return = 2 then STOP
  194.  
  195.     .zoomtoall
  196.     .SelectAll
  197.     .ApplyMaterial "Jewel", "Opal"
  198.     .ShadeSelected 0, 0, 3
  199.     
  200.  
  201.     String1$ = "The BOOLEAN SUBTRACT command may be used to create a wide variety of complex solids." 
  202.     String2$ = "BOOLEAN INTERSECT and BOOLEAN INTERFERE may also be used for solid transformations."
  203. beep
  204. BEGIN DIALOG EndMess 25, 70, 316, 75, "FINAL HINTS"
  205.     TEXT  4, 4, 310, 16, String1$
  206.     TEXT  4, 25, 310, 17, String2$
  207.     TEXT  42, 48, 118, 8, "Click END to finish the demonstation."
  208.     PUSHBUTTON  223, 47, 40, 16, "END"
  209. END DIALOG
  210.  
  211. ret = DIALOG(EndMess)
  212.  
  213.  
  214. END WITHOBJECT
  215.  
  216.  
  217.  
  218. SUB Cross (xcoo#,ycoo#,zcoo#)
  219. withobject "corelcad.automation.1"
  220.     .SetPointXYZ xcoo, ycoo, zcoo-7
  221.     .SetPointXYZ xcoo, ycoo, zcoo+7
  222.     .LineSegment 
  223.     .ChangeColor 51, 255, 102
  224.     .SetPointXYZ xcoo-7, ycoo, zcoo
  225.     .SetPointXYZ xcoo+7, ycoo, zcoo
  226.     .LineSegment 
  227.     .ChangeColor 0, 0, 0
  228.     .SetPointXYZ xcoo, ycoo-7, zcoo
  229.     .SetPointXYZ xcoo, ycoo+7, zcoo
  230.     .LineSegment 
  231.     .ChangeColor 255, 0, 0
  232.     .Box -1, xcoo-2, ycoo-2, zcoo-2, xcoo+2, ycoo+2, zcoo+2
  233.     .ChangeColor 0, 204, 255
  234.     .setpointxyz xcoo,ycoo,zcoo
  235.     .linesegment
  236. '                wait for 1
  237.     '.selectWithinRegion xcoo-6,ycoo-6,zcoo-6,xcoo+6,ycoo+6,zcoo+6 
  238. end withobject
  239. end sub
  240.  
  241.  
  242. SUB DoLine (x1#,y1#,z1#,x2#,y2#,z2#)
  243.     WITHOBJECT "CorelCAD.automation.1"
  244.     .NewLayer " ", , -1, 0, 0, 0, 0, 255, 0, 2, ""
  245.     .setcurrentlayer " "
  246.     .setpointxyz x1,y1,z1 
  247.     .setpointxyz x2,y2,z2
  248.     .arrowLine 3,1
  249.     .setcurrentlayer "Default Layer"
  250.     end withobject
  251. END SUB
  252.  
  253.  
  254.  
  255.  
  256.