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

  1. 'This script will demonstrate the BOOLEAN ADD command
  2.  
  3. '********D****************************************************************************************************
  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 ADD demonstration"
  21.  
  22. Withobject "CorelCad.Automation.1"
  23.     
  24.     .FileNew
  25.  
  26.  
  27.     String1$ = "This script will demonstrate the BOOLEAN ADD command."
  28.     String2$ = "For more information on BOOLEAN commands consult CorelCAD's On-line Help."
  29. BEGIN DIALOG DispMessage1 25,70, 316, 70,Title$
  30.     TEXT  4, 2, 310, 17, String1$
  31.     TEXT  4, 20, 310, 19, String2$
  32.     TEXT  6, 46, 310, 13, "Click NEXT to proceed or CANCEL to exit the Script."
  33.     PUSHBUTTON  198, 44, 40, 16, "Next >>>"
  34.     CANCELBUTTON  240, 44, 40, 16
  35. END DIALOG
  36.  
  37.     Return% = DIALOG (DispMessage1)
  38.     if Return = 2 then STOP
  39.  
  40.  
  41.     String1$ = "Two BOXES 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, -14.8784, -155.499, 135.696, 19.813, -123.115, 110.137
  55.     .Box -1, 19.813, -155.499, 122.916, 5.8359, -134.837, 170.015
  56.  
  57.  
  58.     String1$ = "The BOOLEAN ADD command will combine the two intersecting solids."
  59.     String2$ = "The BOOLEAN ADD command is located in the TRANSFORM menu."
  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.     REM Set First Point
  73.  
  74.  
  75.     String1$ = "The first BOX to be added will be selected."
  76.     String2$ = "The selection becomes highlighted in green."
  77. BEGIN DIALOG DispMessage4 25,70, 316, 70,Title$
  78.     TEXT  4, 2, 310, 17, String1$
  79.     TEXT  4, 20, 310, 19, String2$
  80.     TEXT  6, 46, 310, 13, "Click NEXT to proceed or CANCEL to exit the Script."
  81.     PUSHBUTTON  198, 44, 40, 16, "Next >>>"
  82.     CANCELBUTTON  240, 44, 40, 16
  83. END DIALOG
  84.  
  85.     Return% = DIALOG (DispMessage4)
  86.     if Return = 2 then STOP
  87.  
  88.  
  89.     call cross(5.8359, -155.499, 170.015)
  90.     REM Highlight Box in Green
  91.     .NewLayer " ", , -1, 0, 0, 0, 0, 255, 1, 6, ""
  92.     .setcurrentlayer " "
  93.     .Box -1, 19.813, -155.499, 122.916, 5.8359, -134.837, 170.015
  94.     .setcurrentlayer "Default Layer"
  95.     .SelectPointAt -36.1455, -179.537, 170.015, 0
  96.     wait for 1
  97.     
  98.     REM    Delete First Point
  99.     .SelectWithinRegion -15.4229, -114.796, 135.696, 3.34915, -126.551, 135.696
  100.     .DeleteSelection
  101.         
  102.     REM Erase and Redraw
  103.     .SelectAll
  104.     .DeleteSelection
  105.     .Box -1, -14.8784, -155.499, 135.696, 19.813, -123.115, 110.137
  106.     .Box -1, 19.813, -155.499, 122.916, 5.8359, -134.837, 170.015
  107.  
  108.  
  109.  
  110.     String1$ = "The second object to be added will be selected."
  111.     String2$ = "The selection becomes highlighted in green."
  112. BEGIN DIALOG DispMessage5 25,70, 316, 70,Title$
  113.     TEXT  4, 2, 310, 17, String1$
  114.     TEXT  4, 20, 310, 19, String2$
  115.     TEXT  6, 46, 310, 13, "Click NEXT to proceed or CANCEL to exit the Script."
  116.     PUSHBUTTON  198, 44, 40, 16, "Next >>>"
  117.     CANCELBUTTON  240, 44, 40, 16
  118. END DIALOG
  119.  
  120.     Return% = DIALOG (DispMessage5)
  121.     if Return = 2 then STOP
  122.  
  123.     REM Set Second Point
  124.     call cross(-14.8784, -155.499, 135.696)
  125.  
  126.  
  127.     REM Highlight Box in Green
  128.     .NewLayer " ", , -1, 0, 0, 0, 0, 255, 1, 6, ""
  129.     .setcurrentlayer " "
  130.     .Box -1, -14.8784, -155.499, 135.696, 19.813, -123.115, 110.137
  131.     .setcurrentlayer "Default Layer"
  132.     .SelectPointAt -36.1455, -179.537, 170.015, 0
  133.     wait for 1
  134.     
  135.     REM Erase and Redraw
  136.     .SelectAll
  137.     .DeleteSelection
  138.     .Box -1, -14.8784, -155.499, 135.696, 19.813, -123.115, 110.137
  139.     .Box -1, 19.813, -155.499, 122.916, 5.8359, -134.837, 170.015
  140.  
  141.  
  142.     String1$ = "The selected BOXES will now be added together to form one object."
  143.     String2$ = ""
  144. BEGIN DIALOG DispMessage6 25,70, 316, 70,Title$
  145.     TEXT  4, 2, 310, 17, String1$
  146.     TEXT  4, 20, 310, 19, String2$
  147.     TEXT  6, 46, 310, 13, "Click NEXT to proceed or CANCEL to exit the Script."
  148.     PUSHBUTTON  198, 44, 40, 16, "Next >>>"
  149.     CANCELBUTTON  240, 44, 40, 16
  150. END DIALOG
  151.  
  152.     Return% = DIALOG (DispMessage6)
  153.     if Return = 2 then STOP
  154.  
  155.     .SetPointXYZ 20.8991, -159.049, 170.015
  156.     .SetPointXYZ 4.77214, -189.564, 170.015
  157.     .SolidAdd 
  158.     .ZoomToAll
  159.     .SelectAll
  160.     .SetEdgeRefinement 0, 6
  161.     .SetSurfaceRefinement 2, 5
  162.     .SelectPointAt -36.1455, -179.537, 170.015, 0
  163.  
  164.  
  165.     String1$ = "A MATERIAL will now be applied to the object."
  166.     String2$ = "RENDERING may take a minute."
  167. BEGIN DIALOG DispMessage7 25,70, 316, 70,Title$
  168.     TEXT  4, 2, 310, 17, String1$
  169.     TEXT  4, 20, 310, 19, String2$
  170.     TEXT  6, 46, 310, 13, "Click NEXT to proceed or CANCEL to exit the Script."
  171.     PUSHBUTTON  198, 44, 40, 16, "Next >>>"
  172.     CANCELBUTTON  240, 44, 40, 16
  173. END DIALOG
  174.  
  175.     Return% = DIALOG (DispMessage7)
  176.     if Return = 2 then STOP
  177.  
  178.     .SelectAll
  179.     .ApplyMaterial "Jewel", "Opal"
  180.     .ShadeSelected 0, 0, 3
  181.  
  182.  
  183. beep
  184.     String1$ = "Adding solids together allows the user to create complex models. Materials, textures and lighting may also be applied."
  185.     String2$ = "Models created in CorelCAD may be exported to an *.STL file format for industrial fabrication."
  186. BEGIN DIALOG EndMess 25, 70, 316, 75, "FINAL HINTS"
  187.     TEXT  4, 4, 310, 16, String1$
  188.     TEXT  4, 25, 310, 17, String2$
  189.     TEXT  42, 48, 118, 8, "Click END to finish the demonstation."
  190.     PUSHBUTTON  223, 47, 40, 16, "END"
  191. END DIALOG
  192.  
  193. ret = DIALOG(EndMess)
  194.     
  195.  
  196. END WITHOBJECT
  197.  
  198.  
  199.  
  200.  
  201. SUB Cross (xcoo#,ycoo#,zcoo#)
  202. withobject "corelcad.automation.1"
  203.     .SetPointXYZ xcoo, ycoo, zcoo-7
  204.     .SetPointXYZ xcoo, ycoo, zcoo+7
  205.     .LineSegment 
  206.     .ChangeColor 51, 255, 102
  207.     .SetPointXYZ xcoo-7, ycoo, zcoo
  208.     .SetPointXYZ xcoo+7, ycoo, zcoo
  209.     .LineSegment 
  210.     .ChangeColor 0, 0, 0
  211.     .SetPointXYZ xcoo, ycoo-7, zcoo
  212.     .SetPointXYZ xcoo, ycoo+7, zcoo
  213.     .LineSegment 
  214.     .ChangeColor 255, 0, 0
  215.     .Box -1, xcoo-2, ycoo-2, zcoo-2, xcoo+2, ycoo+2, zcoo+2
  216.     .ChangeColor 0, 204, 255
  217.     .setpointxyz xcoo,ycoo,zcoo
  218.     .linesegment
  219.     '.selectWithinRegion xcoo-6,ycoo-6,zcoo-6,xcoo+6,ycoo+6,zcoo+6 
  220. end withobject
  221. end sub
  222.  
  223.  
  224. SUB DoLine (x1#,y1#,z1#,x2#,y2#,z2#)
  225.     WITHOBJECT "CorelCAD.automation.1"
  226.     .NewLayer " ", , -1, 0, 0, 0, 0, 255, 0, 2, ""
  227.     .setcurrentlayer " "
  228.     .setpointxyz x1,y1,z1 
  229.     .setpointxyz x2,y2,z2
  230.     .arrowLine 3,1
  231.     .setcurrentlayer "Default Layer"
  232.     end withobject
  233. END SUB
  234.  
  235.  
  236.  
  237.  
  238.