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

  1. 'This script will demonstrate an application of the DEFINE and EXTRUDE commands
  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: CIRCLE to CYLINDER demonstration"
  20. Withobject "CorelCad.Automation.1"
  21.     
  22.     .FileNew
  23.  
  24.     String1$ = "This script will demonstrate how to create a solid CYLINDER using a CIRCLE."
  25.     String2$ = "For more information on the CIRCLE and EXTRUDE commands, 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.         String1$ = "A CIRCLE will be created by using the CIRCLE: CENTER and RADIUS Tool."
  39.         String2$ = "Two points are required for the construction of the CIRCLE."
  40.         String3$ = "A dialog box allows the user to define the CIRCLE as a surface or a wireframe."
  41.         String4$ = "" 
  42.     BEGIN DIALOG DispMessage2 25,70, 316, 98, Title$
  43.         TEXT  4, 4, 310, 18, String1$
  44.         TEXT  4, 20, 310, 18, String2$
  45.         TEXT  4, 36, 310, 18, String3$
  46.         TEXT  4, 52, 310, 18, String4$
  47.         TEXT  4, 68, 170, 8, "Click NEXT to proceed or CANCEL to exit the Script."
  48.         PUSHBUTTON  192, 67, 40, 16, "Next >>>"
  49.         CANCELBUTTON  240, 67, 40, 16
  50.     END DIALOG
  51.     
  52.     Return% = DIALOG (DispMessage2)
  53.     if Return = 2 then STOP
  54.  
  55.  
  56.  
  57.     String1$ = "The first point specifies the center of the CIRCLE."
  58.     String2$ = ""
  59. BEGIN DIALOG DispMessage3 25,70, 316, 70,Title$
  60.     TEXT  4, 2, 310, 17, String1$
  61.     TEXT  4, 20, 310, 19, String2$
  62.     TEXT  6, 46, 310, 13, "Click NEXT to proceed or CANCEL to exit the Script."
  63.     PUSHBUTTON  198, 44, 40, 16, "Next >>>"
  64.     CANCELBUTTON  240, 44, 40, 16
  65. END DIALOG
  66.  
  67.     Return% = DIALOG (DispMessage3)
  68.     if Return = 2 then STOP
  69.  
  70.     
  71.     Call Cross (-39.623, -52.8353, 37.9088)
  72.  
  73.     String1$ = "The second point specifies the radius of the CIRCLE"
  74.     String2$ = ""
  75. BEGIN DIALOG DispMessage4 25,70, 316, 70,Title$
  76.     TEXT  4, 2, 310, 17, String1$
  77.     TEXT  4, 20, 310, 19, String2$
  78.     TEXT  6, 46, 310, 13, "Click NEXT to proceed or CANCEL to exit the Script."
  79.     PUSHBUTTON  198, 44, 40, 16, "Next >>>"
  80.     CANCELBUTTON  240, 44, 40, 16
  81. END DIALOG
  82.  
  83.     Return% = DIALOG (DispMessage4)
  84.     if Return = 2 then STOP
  85.     
  86.     Call Doline (-39.623, -52.8353, 37.9088, -30.2082, -63.4686, 37.9088)
  87.     Call Cross (-30.2082, -63.4686, 37.9088)
  88.  
  89.  
  90. Wait for 1    
  91.     .CircleRadius 0, -39.623, -52.8353, 37.9088, -30.2082, -63.4686, 37.9088
  92.  
  93. .SelectALL
  94. .DeleteSelection
  95.  
  96.     .CircleRadius 0, -39.623, -52.8353, 37.9088, -30.2082, -63.4686, 37.9088
  97.  
  98.  
  99.  
  100.         String1$ = "The CIRCLE will now be EXTRUDED into a CYLINDER."
  101.         String2$ = "The EXTRUDE command is located in the DRAW menu."
  102.         String3$ = "The first point of the EXTRUDE path will now be set."
  103.         String4$ = "" 
  104.     BEGIN DIALOG DispMessage5 25,70, 316, 98, Title$
  105.         TEXT  4, 4, 310, 18, String1$
  106.         TEXT  4, 20, 310, 18, String2$
  107.         TEXT  4, 36, 310, 18, String3$
  108.         TEXT  4, 52, 310, 18, String4$
  109.         TEXT  4, 68, 170, 8, "Click NEXT to proceed or CANCEL to exit the Script."
  110.         PUSHBUTTON  192, 67, 40, 16, "Next >>>"
  111.         CANCELBUTTON  240, 67, 40, 16
  112.     END DIALOG
  113.     
  114.     Return% = DIALOG (DispMessage5)
  115.     if Return = 2 then STOP
  116.     
  117.     .SelectALL
  118.     Call Cross (-39.623, -52.8353, 37.9088)
  119.  
  120.  
  121.  
  122.     String1$ = "The second point of the EXTRUDE path will now be set. This will define the EXTRUDE height."
  123.     String2$ = "Note: To move the cursor in the Z-direction while performing commands, Hold the CTRL+SHIFT keys down."
  124. BEGIN DIALOG DispMessage8 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 (DispMessage8)
  133.     if Return = 2 then STOP
  134.  
  135.     Call Doline (-39.623, -52.8353, 37.9088, -39.623, -52.8353, 87.9088)
  136.     Call Cross (-39.623, -52.8353, 87.9088)    
  137.     .zoomtoall
  138.     Wait for 1
  139.     .SelectAll
  140.     .DeleteSelection
  141.  
  142.     .CircleRadius 0, -39.623, -52.8353, 37.9088, -30.2082, -63.4686, 37.9088
  143.     .SelectAll
  144.     .SolidDefine
  145.  
  146.  
  147. 'The circle is being extruded into a cylinder.
  148.  
  149.     .SelectPointAt -52.991, -47.6212, 37.9088, 0
  150.     .StartAddCmdPoint 2
  151.     .AddCmdPoint -39.623, -52.8353, 37.9088
  152.     .AddCmdPoint -39.623, -52.8353, 87.9088
  153.     .EndAddCmdPoint 
  154.     .Extrude 0
  155.     .zoomtoall
  156.  
  157. beep
  158.  
  159. BEGIN DIALOG DispMessage7 25, 70, 154, 65,Title$
  160.     TEXT  29, 14, 98, 8, "The demonstration is complete."
  161.     PUSHBUTTON  61, 34, 40, 16, "End"
  162. END DIALOG
  163.  
  164.     Return% = DIALOG (DispMessage7)
  165.     if Return = 2 then STOP
  166.  
  167.  
  168.  
  169.  
  170. END WITHOBJECT
  171. '************************************************************************************************
  172.  
  173.  
  174.  
  175.  
  176.  
  177. SUB Cross (xcoo#,ycoo#,zcoo#)
  178. withobject "corelcad.automation.1"
  179.     .SetPointXYZ xcoo, ycoo, zcoo-7
  180.     .SetPointXYZ xcoo, ycoo, zcoo+7
  181.     .LineSegment 
  182.     .ChangeColor 51, 255, 102
  183.     .SetPointXYZ xcoo-7, ycoo, zcoo
  184.     .SetPointXYZ xcoo+7, ycoo, zcoo
  185.     .LineSegment 
  186.     .ChangeColor 0, 0, 0
  187.     .SetPointXYZ xcoo, ycoo-7, zcoo
  188.     .SetPointXYZ xcoo, ycoo+7, zcoo
  189.     .LineSegment 
  190.     .ChangeColor 255, 0, 0
  191.     .Box -1, xcoo-2, ycoo-2, zcoo-2, xcoo+2, ycoo+2, zcoo+2
  192.     .ChangeColor 0, 204, 255
  193.     .setpointxyz xcoo,ycoo,zcoo
  194.     .linesegment
  195.                 wait for 1
  196.     '.selectWithinRegion xcoo-6,ycoo-6,zcoo-6,xcoo+6,ycoo+6,zcoo+6 
  197. end withobject
  198. end sub
  199.  
  200.  
  201. SUB DoLine(x1#,y1#,z1#,x2#,y2#,z2#)
  202.     WITHOBJECT "CorelCAD.automation.1"
  203.     .NewLayer " ", , -1, 0, 0, 0, 0, 255, 0, 2, ""
  204.     .setcurrentlayer " "
  205.     .setpointxyz x1,y1,z1 
  206.     .setpointxyz x2,y2,z2
  207.     .arrowLine 3,1
  208.     .setcurrentlayer "Default Layer"
  209.     end withobject
  210. END SUB
  211.  
  212.  
  213.  
  214.