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

  1. 'This script gives a demonstration of OBJECT DEFINE and EXTRUDE commands in CorelCAD
  2. '
  3. '************************************************************************************************************
  4. '************************************************************************************************************
  5. '************************************************************************************************************
  6. '************************************************************************************************************
  7. REM ⌐ 1995 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: RECTANGLE to BOX Demonstration"
  20.  
  21. Withobject "CorelCad.Automation.1"
  22.     
  23.     .FileNew
  24.  
  25.     string1$ = "This script will demonstrate how to create a solid BOX from a surface RECTANGLE."
  26.     string2$ = "For more information on the RECTANGLE and EXTRUDE commands, consult CorelCAD's On-line Help."
  27.     BEGIN DIALOG DispMessage 25, 70, 316, 75,Title$
  28.         TEXT  4, 3, 310, 17, String1$
  29.         TEXT  5, 22, 310, 19, 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 surface RECTANGLE will now be created by using the RECTANGLE: 2 POINTS tool."
  39.     string2$ = "Two points are required for the construction of the RECTANGLE."
  40.     BEGIN DIALOG DispMessage1 25, 70, 316, 75,Title$
  41.         TEXT  4, 3, 310, 17, String1$
  42.         TEXT  5, 22, 310, 19, 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 specifies the first corner of the RECTANGLE."
  52.     string2$ = ""
  53.     BEGIN DIALOG DispMessage2 25, 70, 316, 75,Title$
  54.         TEXT  4, 3, 310, 17, String1$
  55.         TEXT  5, 22, 310, 19, 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.5382, -53.8782, 37.9088 )
  65.  
  66.     string1$ = "The second point specifies the diagonal corner of the RECTANGLE."
  67.     string2$ = ""
  68.     BEGIN DIALOG DispMessage3 25, 70, 316, 75,Title$
  69.         TEXT  4, 3, 310, 17, String1$
  70.         TEXT  5, 22, 310, 19, 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.  
  80.     CAll doline (-60.5382, -53.8782, 37.9088, -14.2669, -27.8744, 37.9088)    
  81.     Call Cross (-14.2669, -27.8744, 37.9088)
  82.  
  83.     .SelectPointAt -100.4463, -5.93935, 0, 0
  84.  
  85.     Wait for 1
  86.  
  87.     .Rectangle 0, -60.5382, -53.8782, 37.9088, -14.2669, -27.8744, 37.9088
  88.  
  89.     .SelectALL
  90.     .DeleteSelection
  91.  
  92.     .Rectangle 0, -60.5382, -53.8782, 37.9088, -14.2669, -27.8744, 37.9088
  93.     .SelectAll
  94.  
  95.     string1$ = "The RECTANGLE will now be EXTRUDED into a BOX."
  96.     string2$ = "The EXTRUDE command is located in the DRAW menu."
  97.     string3$ = "The first point of the EXTRUDE path is set."
  98.     string4$ = ""
  99.     BEGIN DIALOG DispMessage4 25, 70, 316, 98, Title$
  100.         TEXT  4, 4, 310, 12, String1$
  101.         TEXT  4, 18, 310, 10, String2$
  102.         TEXT  4, 32, 310, 12, String3$
  103.         TEXT  4, 46, 310, 11, String4$
  104.         TEXT  4, 69, 310, 8, "Click NEXT to proceed or CANCEL to exit the Script."
  105.         PUSHBUTTON  192, 67, 40, 16, "Next >>>"
  106.         CANCELBUTTON  240, 67, 40, 16
  107.     END DIALOG
  108.     
  109.     Return% = DIALOG (DispMessage4)
  110.     if Return = 2 then STOP
  111.  
  112.  
  113.     Call Cross ( -60.5382, -53.8782, 37.9088 )
  114.  
  115.     string1$ = "The second point of the EXTRUDE path will now be set. This will define the EXTRUDE height." 
  116.     string2$ = "Note: To move the cursor in the Z-direction while performing commands, Hold the CTRL+SHIFT keys down."
  117.     BEGIN DIALOG DispMessage5 25, 70, 316, 75,Title$
  118.         TEXT  4, 3, 310, 17, String1$
  119.         TEXT  5, 22, 310, 19, String2$
  120.         TEXT  4, 46, 170, 8, "Click NEXT to proceed or CANCEL to exit the Script."
  121.         PUSHBUTTON  192, 44, 40, 16, "Next >>>"
  122.         CANCELBUTTON  240, 44, 40, 16
  123.     END DIALOG
  124.  
  125.     Return% = DIALOG (DispMessage5)
  126.     if Return = 2 then STOP
  127.  
  128.     CAll doline (-60.5382, -53.8782, 37.9088, -60.5776, -53.9574, 75.674)
  129.     .zoomtoall
  130.     CALL Cross ( -60.5776, -53.9574, 75.674 )
  131.  
  132.     Wait for 1
  133.  
  134.     .SelectAll
  135.     .DeleteSelection
  136.  
  137.     'Extruding the final Rectangle to a box
  138.  
  139.     .Rectangle 0, -60.5382, -53.8782, 37.9088, -14.2669, -27.8744, 37.9088
  140.     .SolidDefine    
  141.     .StartAddCmdPoint 2
  142.     .AddCmdPoint -60.5382, -53.8782, 37.9088
  143.     .AddCmdPoint -60.5776, -53.9574, 75.674
  144.     .EndAddCmdPoint 
  145.     .Extrude 0
  146.     .wireframe
  147.  
  148.     String1$ = "An EXTRUDE PATH can also be defined by selecting an existing line rather than setting two points." 
  149.     String2$ = "The CURVE tool may be used to define complex EXTRUDE PATHS. This tool can be found on the LINES toolbar."
  150. beep
  151. BEGIN DIALOG EndMess 25, 70, 316, 75, "FINAL HINTS"
  152.     TEXT  4, 4, 310, 16, String1$
  153.     TEXT  4, 25, 310, 17, String2$
  154.     TEXT  42, 48, 118, 8, "Click END to finish the demonstation."
  155.     PUSHBUTTON  223, 47, 40, 16, "END"
  156. END DIALOG
  157.  
  158. ret = DIALOG(EndMess)
  159.  
  160.  
  161. END WITHOBJECT
  162. '************************************************************************************************
  163.  
  164.  
  165. SUB Cross (xcoo#,ycoo#,zcoo#)
  166. withobject "corelcad.automation.1"
  167.     .SetPointXYZ xcoo, ycoo, zcoo-7
  168.     .SetPointXYZ xcoo, ycoo, zcoo+7
  169.     .LineSegment 
  170.     .ChangeColor 51, 255, 102
  171.     .SetPointXYZ xcoo-7, ycoo, zcoo
  172.     .SetPointXYZ xcoo+7, ycoo, zcoo
  173.     .LineSegment 
  174.     .ChangeColor 0, 0, 0
  175.     .SetPointXYZ xcoo, ycoo-7, zcoo
  176.     .SetPointXYZ xcoo, ycoo+7, zcoo
  177.     .LineSegment 
  178.     .ChangeColor 255, 0, 0
  179.     .Box -1, xcoo-2, ycoo-2, zcoo-2, xcoo+2, ycoo+2, zcoo+2
  180.     .ChangeColor 0, 204, 255
  181.     .setpointxyz xcoo,ycoo,zcoo
  182.     .linesegment
  183.                 wait for 1
  184.     '.selectWithinRegion xcoo-6,ycoo-6,zcoo-6,xcoo+6,ycoo+6,zcoo+6 
  185. end withobject
  186. end sub
  187.  
  188.  
  189. SUB DoLine(x1#,y1#,z1#,x2#,y2#,z2#)
  190.     WITHOBJECT "CorelCAD.automation.1"
  191.     .NewLayer " ", , -1, 0, 0, 0, 0, 255, 0, 2, ""
  192.     .setcurrentlayer " "
  193.     .setpointxyz x1,y1,z1 
  194.     .setpointxyz x2,y2,z2
  195.     .arrowLine 3,1
  196.     .setcurrentlayer "Default Layer"
  197.     end withobject
  198. END SUB
  199.