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

  1. 'This script will give a demonstration of the solid BOX 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. declare Sub DoBox()
  14.  
  15.  
  16. REM Declare Variables
  17. Global Title as string
  18.  
  19. Rem Set Variable
  20. Title$ = "CorelCAD:SOLID BOX demonstration"
  21.  
  22. Withobject "CorelCad.Automation.1"
  23.     .FileNew
  24.  
  25.     string1$ = "This script will demonstrate how to create a SOLID BOX."
  26.     string2$ = "For more information on the BOX tool, consult CorelCAD's On-line Help."
  27.     BEGIN DIALOG DispMessage 25, 70, 316, 75, Title$
  28.         TEXT  4, 4, 310, 12, String1$
  29.         TEXT  4, 18, 310, 16, String2$
  30.         TEXT  4, 46, 170, 8, "Click NEXT to proceed or CANCEL to exit the Script."
  31.         PUSHBUTTON  192, 44, 40, 16, "Next >>>"
  32.         CANCELBUTTON  240, 44, 40, 16
  33.     END DIALOG
  34.  
  35.     Return% = DIALOG (DispMessage)
  36.     if Return = 2 then STOP
  37.  
  38.     string1$ = "A BOX will now be created by using the 3D SOLID: BOX, 2 POINTS tool."
  39.     string2$ = "Two points are required for the construction of the BOX."
  40.     BEGIN DIALOG DispMessage1 25, 70, 316, 75, Title$
  41.         TEXT  4, 4, 310, 12, String1$
  42.         TEXT  4, 18, 310, 16, String2$
  43.         TEXT  4, 46, 170, 8, "Click NEXT to proceed or CANCEL to exit the Script."
  44.         PUSHBUTTON  192, 44, 40, 16, "Next >>>"
  45.         CANCELBUTTON  240, 44, 40, 16
  46.     END DIALOG
  47.  
  48.     Return% = DIALOG (DispMessage1)
  49.     if Return = 2 then STOP
  50.     
  51.     string1$ = "The first point will be set to specify the first corner of the BOX."
  52.     string2$ = ""
  53.     BEGIN DIALOG DispMessage2 25, 70, 316, 75, Title$
  54.         TEXT  4, 4, 310, 12, String1$
  55.         TEXT  4, 18, 310, 16, String2$
  56.         TEXT  4, 46, 170, 8, "Click NEXT to proceed or CANCEL to exit the Script."
  57.         PUSHBUTTON  192, 44, 40, 16, "Next >>>"
  58.         CANCELBUTTON  240, 44, 40, 16
  59.     END DIALOG
  60.  
  61.     Return% = DIALOG (DispMessage2)
  62.     if Return = 2 then STOP
  63.  
  64.     CALL Cross(-60,-60,0)
  65.  
  66.     string1$ = "The second point will be set to specify the diagonal corner of the BOX."
  67.     string2$ = ""
  68.     BEGIN DIALOG DispMessage3 25, 70, 316, 75, Title$
  69.         TEXT  4, 4, 310, 12, String1$
  70.         TEXT  4, 18, 310, 16, String2$
  71.         TEXT  4, 46, 170, 8, "Click NEXT to proceed or CANCEL to exit the Script."
  72.         PUSHBUTTON  192, 44, 40, 16, "Next >>>"
  73.         CANCELBUTTON  240, 44, 40, 16
  74.     END DIALOG
  75.  
  76.     Return% = DIALOG (DispMessage3)
  77.     if Return = 2 then STOP
  78.  
  79.     CAll doline (-60,-60,0,-60,0,0)
  80.     wait for 1
  81.     CAll doline (-60,0,0,0,0,0)
  82.     wait for 1
  83.     CAll doline (0,0,0,0,0,60)
  84.     .zoomToAll
  85.     call cross(0,0,60)
  86.     .zoomToall
  87.  
  88.     Call doBox 
  89.     .SelectPointAt -69.0982, 3.27301, 50, 0
  90.  
  91.     .ZoomToAll
  92.     Wait for 2
  93.     .SelectAll
  94.     .deleteselection
  95.  
  96.     .Box -1, -60,-60,0,0,0,60
  97.  
  98.     string1$ = "A MATERIAL will now be applied to the BOX"
  99.     string2$ = "RENDERING may take a moment."
  100.     BEGIN DIALOG DispMessage4 25, 70, 316, 75, Title$
  101.         TEXT  4, 4, 310, 12, String1$
  102.         TEXT  4, 18, 310, 16, String2$
  103.         TEXT  4, 46, 170, 8, "Click NEXT to proceed or CANCEL to exit the Script."
  104.         PUSHBUTTON  192, 44, 40, 16, "Next >>>"
  105.         CANCELBUTTON  240, 44, 40, 16
  106.     END DIALOG
  107.  
  108.     Return% = DIALOG (DispMessage4)
  109.     if Return = 2 then STOP
  110.  
  111.     .SelectAll
  112.     
  113.     .ApplyMaterial "Mineral", "Bricks"
  114.     .ShadeSelected 0, 0, 3
  115.     String1$ = "By default, the cursor moves about the X-Y PLANE." 
  116.     String2$ = "To set points above or below this plane, hold the CTRL+SHIFT keys down while dragging the mouse. This will move the cursor about the Z-AXIS."
  117.     String3$ = "The INSERT POINT ROLLUP may also be used to set points anywhere in 3D space. This may be activated by pressing the INSERT key."
  118. beep
  119. BEGIN DIALOG EndMess 25, 70, 316, 91, "FINAL HINTS"
  120.     TEXT  4, 4, 310, 16,String1
  121.     TEXT  4, 16, 310, 16, String2
  122.     TEXT  39, 65, 118, 8, "Click END to finish the demonstation."
  123.     PUSHBUTTON  220, 64, 40, 16, "END"
  124.     TEXT  4, 41, 306, 16, string3
  125. END DIALOG
  126.  
  127. ret = DIALOG(EndMess)
  128.  
  129. END WITHOBJECT
  130. '************************************************************************************************
  131.  
  132.  
  133.  
  134. SUB Cross (xcoo&,ycoo&,zcoo&)
  135. withobject "corelcad.automation.1"
  136.     .SetPointXYZ xcoo, ycoo, zcoo-7
  137.     .SetPointXYZ xcoo, ycoo, zcoo+7
  138.     .LineSegment 
  139.     .ChangeColor 51, 255, 102
  140.     .SetPointXYZ xcoo-7, ycoo, zcoo
  141.     .SetPointXYZ xcoo+7, ycoo, zcoo
  142.     .LineSegment 
  143.     .ChangeColor 0, 0, 0
  144.     .SetPointXYZ xcoo, ycoo-7, zcoo
  145.     .SetPointXYZ xcoo, ycoo+7, zcoo
  146.     .LineSegment 
  147.     .ChangeColor 255, 0, 0
  148.     .Box -1, xcoo-2, ycoo-2, zcoo-2, xcoo+2, ycoo+2, zcoo+2
  149.     .ChangeColor 0, 204, 255
  150.     .setpointxyz xcoo,ycoo,zcoo
  151.     .linesegment
  152.                 wait for 1
  153.     '.selectWithinRegion xcoo-6,ycoo-6,zcoo-6,xcoo+6,ycoo+6,zcoo+6 
  154. end withobject
  155. end sub
  156.  
  157.  
  158. SUB DoLine (x1&,y1&,z1&,x2&,y2&,z2&)
  159.     WITHOBJECT "CorelCAD.automation.1"
  160.     .NewLayer " ", , -1, 0, 0, 0, 0, 255, 0, 2, ""
  161.     .setcurrentlayer " "
  162.     .setpointxyz x1,y1,z1 
  163.     .setpointxyz x2,y2,z2
  164.     .arrowLine 3,1
  165.     .setcurrentlayer "Default Layer"
  166.     end withobject
  167. END SUB
  168.  
  169.  
  170.  
  171. SUB DoBox
  172.     WITHOBJECT "CorelCAD.automation.1"
  173.     .NewLayer " ", , -1, 0, 0, 0, 0, 255, 0, 2, ""
  174.     .setcurrentlayer " "
  175.     .Box -1, -60,-60,0,0,0,60
  176.     .setcurrentlayer "Default Layer"
  177.  
  178.     end withobject
  179. END SUB
  180.