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

  1. 'This script demonstrates the 3D TRIM 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. REM Declare Variables
  16. Global Title as string
  17.  
  18. Rem Set Variable
  19. Title$ = "CorelCAD: 3D TRIM demonstration"
  20.  
  21. Withobject "CorelCad.Automation.1"
  22.     
  23.     .FileNew
  24.  
  25.  
  26.  
  27.     String1$ = "This script demonstrates the 3D TRIM command."
  28.     String2$ = "For more information on TRIM 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$ = "A BOX will first 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, -3.30613, -192.811, 170.015, 34.322, -160.002, 197.013
  55.     .ZoomToAll
  56.     .zoomout
  57.  
  58.  
  59.  
  60.     String1$ = "Three points will be specified to define the cutting plane."
  61.     String2$ = ""
  62. BEGIN DIALOG DispMessage3 25,70, 316, 70,Title$
  63.     TEXT  4, 2, 310, 17, String1$
  64.     TEXT  4, 20, 310, 19, String2$
  65.     TEXT  6, 46, 310, 13, "Click NEXT to proceed or CANCEL to exit the Script."
  66.     PUSHBUTTON  198, 44, 40, 16, "Next >>>"
  67.     CANCELBUTTON  240, 44, 40, 16
  68. END DIALOG
  69.  
  70.     Return% = DIALOG (DispMessage3)
  71.     if Return = 2 then STOP
  72.  
  73.     
  74.     REM Select First Point
  75.     call cross(-3.30613, -160.002, 197.013)    
  76.     wait for 1
  77.  
  78.     REM Select Second Point
  79.     call Doline(-3.30613, -160.002, 197.013,-3.30613, -192.811, 197.013)
  80.     call cross(-3.30613, -192.811, 197.013)
  81.     wait for 1
  82.  
  83.     
  84.     
  85.  
  86.     REM Delete First Point
  87.     .SelectWithinRegion -24.9238, -124.997, 170.015, 3.16183, -141.979, 170.015
  88.     .deleteselection
  89.     .SelectAll
  90.  
  91.     REM Select Third Point
  92.     call doline(-3.30613, -192.811, 197.013,34.322, -192.811, 170.015)
  93.     call cross(34.322, -192.811, 170.015)
  94.     wait for 1
  95.  
  96.     REM Delete Second and Third Point    
  97.     .SelectWithinRegion -24.9238, -124.997, 170.015, 3.16183, -141.979, 170.015
  98.     .DeleteSelection 
  99.     .SelectAll
  100.     .SelectWithinRegion 22.4479, -182.696, 170.015, 46.479, -201.045, 170.015
  101.     .DeleteSelection
  102.     .SelectAll    
  103.     
  104.     REM Draw Third Line
  105.     call doline(34.322, -192.811, 170.015,-3.30613, -160.002, 197.013)
  106.     wait for 1
  107.  
  108.     REM Erase Third Line
  109.     .undo
  110.     
  111.     REM Erase Second and Third Point
  112.     .ZoomToAll
  113.     .SelectWithinRegion -13.9589, -187.766, 197.013, 7.35007, -198.833, 197.013
  114.     .DeleteSelection
  115.     .SelectWithinRegion 32.6205, -210.203, 197.013, 56.6211, -229.381, 197.013
  116.     .DeleteSelection
  117.     REM Draw Fourth and Fifth Line
  118.     call doline(34.322, -192.811, 170.015,34.322, -160.002, 170.015)
  119.     call doline(34.322, -160.002, 170.015,-3.30613, -160.002, 197.013)
  120.  
  121.  
  122.  
  123.     String1$ = "A fourth point will be set to specify the side of the object to be removed."
  124.     String2$ = ""
  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.     call cross(34.322, -192.811, 197.013)
  137.     wait for 1
  138.     .SelectAll
  139.     .DeleteSelection
  140.     .Box -1, -3.30613, -192.811, 170.015, 34.322, -160.002, 197.013
  141.     .ThreeDTrim -3.30613, -160.002, 197.013, -3.30613, -192.811, 197.013, 34.322, -192.811, 170.015, 34.322, -192.811, 197.013
  142.     .ZoomToAll
  143.     .SelectAll
  144.     .SetEdgeRefinement 0, 6
  145.     .SetSurfaceRefinement 2, 5
  146.  
  147.  
  148.     String1$ = "A MATERIAL will now be applied to object."
  149.     String2$ = "RENDERING may take a moment."
  150. BEGIN DIALOG DispMessage5 25,70, 316, 70,Title$
  151.     TEXT  4, 2, 310, 17, String1$
  152.     TEXT  4, 20, 310, 19, String2$
  153.     TEXT  6, 46, 310, 13, "Click NEXT to proceed or CANCEL to exit the Script."
  154.     PUSHBUTTON  198, 44, 40, 16, "Next >>>"
  155.     CANCELBUTTON  240, 44, 40, 16
  156. END DIALOG
  157.  
  158.     Return% = DIALOG (DispMessage5)
  159.     if Return = 2 then STOP
  160.  
  161.     .ApplyMaterial "Woods", "Light Grain"
  162.     .ShadeEntireView 0,0,3,0
  163.  
  164. beep
  165.     String1$ = "Use the 3D TRIM command when working with solids."
  166.     String2$ = "Use the TRIM command when working with wireframes."
  167. BEGIN DIALOG EndMess 25, 70, 316, 75, "FINAL HINTS"
  168.     TEXT  4, 4, 310, 16, string1
  169.     TEXT  4, 19, 310, 17, string2
  170.     TEXT  42, 48, 118, 8, "Click END to finish the demonstation."
  171.     PUSHBUTTON  223, 47, 40, 16, "END"
  172. END DIALOG
  173.  
  174. ret = DIALOG(EndMess)
  175.  
  176.  
  177.  
  178. END WITHOBJECT
  179.  
  180.  
  181.  
  182. SUB Cross (xcoo#,ycoo#,zcoo#)
  183. withobject "corelcad.automation.1"
  184.     .SetPointXYZ xcoo, ycoo, zcoo-7
  185.     .SetPointXYZ xcoo, ycoo, zcoo+7
  186.     .LineSegment 
  187.     .ChangeColor 51, 255, 102
  188.     .SetPointXYZ xcoo-7, ycoo, zcoo
  189.     .SetPointXYZ xcoo+7, ycoo, zcoo
  190.     .LineSegment 
  191.     .ChangeColor 0, 0, 0
  192.     .SetPointXYZ xcoo, ycoo-7, zcoo
  193.     .SetPointXYZ xcoo, ycoo+7, zcoo
  194.     .LineSegment 
  195.     .ChangeColor 255, 0, 0
  196.     .Box -1, xcoo-2, ycoo-2, zcoo-2, xcoo+2, ycoo+2, zcoo+2
  197.     .ChangeColor 0, 204, 255
  198.     .setpointxyz xcoo,ycoo,zcoo
  199.     .linesegment
  200.                 wait for 1
  201.     '.selectWithinRegion xcoo-6,ycoo-6,zcoo-6,xcoo+6,ycoo+6,zcoo+6 
  202. end withobject
  203. end sub
  204.  
  205.  
  206. SUB DoLine(x1#,y1#,z1#,x2#,y2#,z2#)
  207.     WITHOBJECT "CorelCAD.automation.1"
  208.     .NewLayer " ", , -1, 0, 0, 0, 0, 255, 0, 2, ""
  209.     .setcurrentlayer " "
  210.     .setpointxyz x1,y1,z1 
  211.     .setpointxyz x2,y2,z2
  212.     .arrowLine 3,1
  213.     .setcurrentlayer "Default Layer"
  214.     end withobject
  215. END SUB
  216.