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

  1. 'This script demonstrates the 3D SLICE command
  2.  
  3. '************************************************************************************************************
  4. '*****R******************************************************************************************************
  5. '********************************y***************************************************************************
  6. '**********************************************************************A*************************************
  7. REM ⌐ 1996 Corel Corporation. All rights reserved.
  8. '*********************************************************************************************************N**
  9.  
  10. REM Declare Subroutines
  11. declare Sub Cross(xcoo#,ycoo#,zcoo#)
  12. declare Sub DoLine(x1#,y1#,z1#,x2#,y2#,z2#)
  13.  
  14. REM Declare Variables
  15. Global Title as string
  16.  
  17. Rem Set Variable
  18. Title$ = "CorelCAD:3D SLICE demonstration"
  19.  
  20. Withobject "CorelCad.Automation.1"
  21.     
  22.     .FileNew
  23.  
  24.     String1$ = "This script demonstrates the 3D SLICE command."
  25.     String2$ = "For more information on 3D SLICE consult CorelCAD's On-line Help."
  26. BEGIN DIALOG DispMessage1 25,70, 316, 70,Title$
  27.     TEXT  4, 2, 310, 17, String1$
  28.     TEXT  4, 20, 310, 19, String2$
  29.     TEXT  6, 46, 310, 13, "Click NEXT to proceed or CANCEL to exit the Script."
  30.     PUSHBUTTON  198, 44, 40, 16, "Next >>>"
  31.     CANCELBUTTON  240, 44, 40, 16
  32. END DIALOG
  33.  
  34.     Return% = DIALOG (DispMessage1)
  35.     if Return = 2 then STOP
  36.  
  37.  
  38.  
  39.     String1$ = "A BOX will first be created."
  40.     String2$ = ""
  41. BEGIN DIALOG DispMessage2 25,70, 316, 70,Title$
  42.     TEXT  4, 2, 310, 17, String1$
  43.     TEXT  4, 20, 310, 19, String2$
  44.     TEXT  6, 46, 310, 13, "Click NEXT to proceed or CANCEL to exit the Script."
  45.     PUSHBUTTON  198, 44, 40, 16, "Next >>>"
  46.     CANCELBUTTON  240, 44, 40, 16
  47. END DIALOG
  48.  
  49.     Return% = DIALOG (DispMessage2)
  50.     if Return = 2 then STOP
  51.  
  52.     .Box -1, 7.83156, -209.925, 197.01, 39.5494, -191.084, 217.636
  53.     .zoomtoAll
  54.  
  55.  
  56.     String1$ = "3 points will be specified to define the SLICE PLANE."
  57.     String2$ = "Once the SLICE has been completed, the object will be separated for clarity."
  58. BEGIN DIALOG DispMessage3 25,70, 316, 70,Title$
  59.     TEXT  4, 2, 310, 17, String1$
  60.     TEXT  4, 20, 310, 19, String2$
  61.     TEXT  6, 46, 310, 13, "Click NEXT to proceed or CANCEL to exit the Script."
  62.     PUSHBUTTON  198, 44, 40, 16, "Next >>>"
  63.     CANCELBUTTON  240, 44, 40, 16
  64. END DIALOG
  65.  
  66.     Return% = DIALOG (DispMessage3)
  67.     if Return = 2 then STOP
  68.     
  69.     REM Select first point
  70.     call cross(23.6905, -191.084, 217.636)
  71.     wait for 1
  72.     
  73.     REM Select Second Point
  74.     call doline(23.6905, -191.084, 217.636,23.6905, -209.925, 217.636)
  75.     call cross(23.6905, -209.925, 217.636)
  76.     wait for 1 
  77.  
  78.     REM Draw First Line
  79.  
  80.  
  81.  
  82.     REM Delete First Point
  83.     .SelectWithinRegion 8.95967, -163.289, 197.01, 25.3888, -178.662, 197.01
  84.     .deleteselection
  85.     .SelectAll
  86.     
  87.     REM Select Third Point
  88.     call doline(23.6905, -209.925, 217.636,39.5494, -209.925, 197.01)
  89.     call cross(39.5494, -209.925, 197.01) 
  90. wait for 1    
  91.  
  92.  
  93.     REM Delete Second and Third Point    
  94.     .SelectWithinRegion 5.7578, -181.917, 197.01, 28.3854, -196.672, 197.01
  95.     .DeleteSelection 
  96.     .SelectAll
  97.     .SelectWithinRegion 26.5726, -202.559, 197.01, 53.4275, -222.016, 197.01
  98.     .DeleteSelection
  99.     .SelectAll
  100.  
  101.     REM Draw Third Line
  102.     call doline(39.5494, -209.925, 197.01,23.6905, -191.084, 217.636)
  103.     wait for 1
  104.     
  105.     REM Erase Third Line
  106.     .Undo
  107.  
  108.     REM Draw Fourth Line and Fifth Line
  109.     call doline(39.5494, -209.925, 197.01,39.5494, -191.084, 197.01)
  110.     call doline(39.5494, -191.084, 197.01,23.6905, -191.084, 217.636)
  111.     .SelectWithinRegion -10.4395, -172.396, 197.01, 49.5493, -207.25, 197.01
  112.     .ThreeDSlice 23.6905, -191.084, 217.636, 23.6905, -209.925, 217.636, 39.5494, -209.925, 197.01
  113.     
  114.     .SelectAll
  115.     .DeleteSelection
  116.     .Box -1, 7.83156, -209.925, 197.01, 39.5494, -191.084, 217.636
  117.     .ThreeDSlice 23.6905, -191.084, 217.636, 23.6905, -209.925, 217.636, 39.5494, -209.925, 197.01
  118.     .SelectPointAt 32.7237, -189.114, 197.01, 0
  119.     .Move 0, 0, 39.5494, -209.925, 217.636, 57.1783, -213.762, 217.636
  120.     .SelectAll
  121.  
  122.  
  123.     String1$ = "A MATERIAL will now be applied to the objects."
  124.     String2$ = "RENDERING may take a moment."
  125. BEGIN DIALOG DispMessage4 25,70, 316, 70,Title$
  126.     TEXT  4, 2, 310, 17, String1$
  127.     TEXT  4, 20, 310, 19, String2$
  128.     TEXT  6, 46, 310, 13, "Click NEXT to proceed or CANCEL to exit the Script."
  129.     PUSHBUTTON  198, 44, 40, 16, "Next >>>"
  130.     CANCELBUTTON  240, 44, 40, 16
  131. END DIALOG
  132.  
  133.     Return% = DIALOG (DispMessage4)
  134.     if Return = 2 then STOP
  135.  
  136.     .zoomtoall
  137.     .ApplyMaterial "Woods", "Lacquered"
  138.     .ShadeEntireView 0,0,3,0
  139.  
  140.  
  141. beep
  142.     String1$ = "The 3D SLICE command allows the user to cut any model into break-away sections."
  143.     String2$ = "This allows the user to view the inner parts of the model."
  144. BEGIN DIALOG EndMess 25, 70, 316, 75, "FINAL HINTS"
  145.     TEXT  4, 4, 310, 16, String1$
  146.     TEXT  4, 25, 310, 17, String2$
  147.     TEXT  42, 48, 118, 8, "Click END to finish the demonstation."
  148.     PUSHBUTTON  223, 47, 40, 16, "END"
  149. END DIALOG
  150.  
  151. ret = DIALOG(EndMess)
  152.  
  153.  
  154.  
  155. END WITHOBJECT
  156.  
  157.  
  158.  
  159. SUB Cross (xcoo#,ycoo#,zcoo#)
  160. withobject "corelcad.automation.1"
  161.     .SetPointXYZ xcoo, ycoo, zcoo-7
  162.     .SetPointXYZ xcoo, ycoo, zcoo+7
  163.     .LineSegment 
  164.     .ChangeColor 51, 255, 102
  165.     .SetPointXYZ xcoo-7, ycoo, zcoo
  166.     .SetPointXYZ xcoo+7, ycoo, zcoo
  167.     .LineSegment 
  168.     .ChangeColor 0, 0, 0
  169.     .SetPointXYZ xcoo, ycoo-7, zcoo
  170.     .SetPointXYZ xcoo, ycoo+7, zcoo
  171.     .LineSegment 
  172.     .ChangeColor 255, 0, 0
  173.     .Box -1, xcoo-2, ycoo-2, zcoo-2, xcoo+2, ycoo+2, zcoo+2
  174.     .ChangeColor 0, 204, 255
  175.     .setpointxyz xcoo,ycoo,zcoo
  176.     .linesegment
  177.                 wait for 1
  178.     '.selectWithinRegion xcoo-6,ycoo-6,zcoo-6,xcoo+6,ycoo+6,zcoo+6 
  179. end withobject
  180. end sub
  181.  
  182.  
  183. SUB DoLine(x1#,y1#,z1#,x2#,y2#,z2#)
  184.     WITHOBJECT "CorelCAD.automation.1"
  185.     .NewLayer " ", , -1, 0, 0, 0, 0, 255, 0, 2, ""
  186.     .setcurrentlayer " "
  187.     .setpointxyz x1,y1,z1 
  188.     .setpointxyz x2,y2,z2
  189.     .arrowLine 3,1
  190.     .setcurrentlayer "Default Layer"
  191.     end withobject
  192. END SUB
  193.  
  194.