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

  1. 'This script will give a demonstration of the LINEAR ARRAY command in CorelCAD
  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.  
  16. REM Declare Variables
  17. Global Title as string
  18.  
  19. Rem Set Variable
  20. Title$ = "CorelCAD : Creating a LINEAR ARRAY"
  21.  
  22.  
  23. WITHOBJECT "CorelCAD.Automation.1"
  24.  
  25.     REM Call First Dialog
  26.     .FileNew
  27.  
  28.     string1$ = "This script will demonstrate the LINEAR ARRAY Command."
  29.     string2$ = "For more information on ARRAYS consult CorelCAD's On-line Help."
  30.     BEGIN DIALOG DispMessage 25, 70, 316, 75, Title$
  31.         TEXT  4, 4, 310, 12, String1$
  32.         TEXT  4, 18, 310, 10, String2$
  33.         TEXT  4, 46, 170, 8, "Click NEXT to proceed or CANCEL to exit the Script."
  34.         PUSHBUTTON  192, 44, 40, 16, "Next >>>"
  35.         CANCELBUTTON  240, 44, 40, 16
  36.     END DIALOG
  37.  
  38.     Return% = DIALOG (DispMessage)
  39.     if Return = 2 then STOP
  40.  
  41.     REM Call Second Dialog and Draw Circle
  42.     string1$ = "A CONE will be created."
  43.     string2$ = "This is done using the 3D SOLID CONE."
  44.     string3$ = "It can be found on the main toolbar in the 3D Objects Flyout."
  45.     string4$ = ""
  46.     BEGIN DIALOG DispMessage1 25, 70, 316, 98, Title$
  47.         TEXT  4, 4, 310, 12, String1$
  48.         TEXT  4, 18, 310, 10, String2$
  49.         TEXT  4, 32, 310, 12, String3$
  50.         TEXT  4, 46, 310, 11, String4$
  51.         TEXT  4, 69, 310, 8, "Click NEXT to proceed or CANCEL to exit the Script."
  52.         PUSHBUTTON  192, 67, 40, 16, "Next >>>"
  53.         CANCELBUTTON  240, 67, 40, 16
  54.     END DIALOG
  55.     
  56.     Return% = DIALOG (DispMessage1)
  57.     if Return = 2 then STOP
  58.  
  59.  
  60.     .Cone -1, -73, -26, 0, -66, -23, 0, -66, -23, 27
  61.     .ZoomToAll
  62.  
  63.     REM Call Third Dialog and Zoom Out
  64.     string1$ = "Using F3 we can ZOOM OUT before beginning the ARRAY."
  65.     string2$ = ""
  66.     BEGIN DIALOG DispMessage2 25, 70, 316, 75, Title$
  67.         TEXT  4, 4, 310, 12, String1$
  68.         TEXT  4, 18, 310, 10, String2$
  69.         TEXT  4, 46, 170, 8, "Click NEXT to proceed or CANCEL to exit the Script."
  70.         PUSHBUTTON  192, 44, 40, 16, "Next >>>"
  71.         CANCELBUTTON  240, 44, 40, 16
  72.     END DIALOG
  73.  
  74.     Return% = DIALOG (DispMessage2)
  75.     if Return = 2 then STOP
  76.  
  77.     .ZoomOut
  78.     .ZoomOut
  79.     .ZoomOut
  80.     .ZoomOut
  81.  
  82.     REM Call Fourth Dialog and Perform Array
  83.     string1$ = "The LINEAR ARRAY command will now be performed. It is located in the EDIT:ARRAY menu."
  84.     string2$ = "A base point is first set."
  85.     BEGIN DIALOG DispMessage3 25, 70, 316, 75, Title$
  86.         TEXT  4, 4, 310, 12, String1$
  87.         TEXT  4, 18, 310, 10, String2$
  88.         TEXT  4, 46, 170, 8, "Click NEXT to proceed or CANCEL to exit the Script."
  89.         PUSHBUTTON  192, 44, 40, 16, "Next >>>"
  90.         CANCELBUTTON  240, 44, 40, 16
  91.     END DIALOG
  92.  
  93.     Return% = DIALOG (DispMessage3)
  94.     if Return = 2 then STOP
  95.  
  96.  
  97.     CROSS -73, -26, 0
  98.  
  99.     string1$ = "A point is set to indicate the relative distance and direction between the objects."
  100.     string2$ = ""
  101.     BEGIN DIALOG DispMessage4 25, 70, 316, 75, Title$
  102.         TEXT  4, 4, 310, 12, String1$
  103.         TEXT  4, 18, 310, 10, String2$
  104.         TEXT  4, 46, 170, 8, "Click NEXT to proceed or CANCEL to exit the Script."
  105.         PUSHBUTTON  192, 44, 40, 16, "Next >>>"
  106.         CANCELBUTTON  240, 44, 40, 16
  107.     END DIALOG
  108.  
  109.     Return% = DIALOG (DispMessage4)
  110.     if Return = 2 then STOP
  111.  
  112.  
  113.     doLine -73, -26, 0,-73-40, -26-40, 0
  114.     wait for 1
  115.     cross -73-40, -26-40, 0
  116.  
  117.     .SelectPointAt -81.699, 0.00890302, 0, 0
  118.     .LinearArray 0, 10, 0, 0, 0, -40, -40, 0
  119.     .ZoomToAll
  120.                                 
  121.     
  122.  
  123.     REM Call Fifth Dialog and Give Information to User
  124.     string1$ = "This ARRAY contains 10 objects, with an incremental distance of  56 inches between the objects."
  125.     string2$ = "A MATERIAL will now be applied to the cones, RENDERING may take a moment."
  126.     BEGIN DIALOG DispMessage5 25, 70, 316, 75, Title$
  127.         TEXT  4, 4, 310, 12, String1$
  128.         TEXT  4, 18, 310, 10, String2$
  129.         TEXT  4, 46, 170, 8, "Click NEXT to proceed or CANCEL to exit the Script."
  130.         PUSHBUTTON  192, 44, 40, 16, "Next >>>"
  131.         CANCELBUTTON  240, 44, 40, 16
  132.     END DIALOG
  133.  
  134.     Return% = DIALOG (DispMessage5)
  135.     if Return = 2 then STOP
  136.  
  137.  
  138.     REM Render and Shade
  139.     .selectall
  140.     .ApplyMaterial "Mineral","Sand"
  141.     .ShadeEntireView 0,0,3,0
  142.  
  143.     String1$ = "The base point of any array does not have to be set on the object." 
  144.     String2$ = "The array path will follow the direction and distance between the base point and the second point."
  145. beep
  146.     BEGIN DIALOG DispMessage100 25, 70, 316, 75, "FINAL HINTS"
  147.         TEXT  4, 4, 310, 16, String1$
  148.         TEXT  4, 25, 310, 17, String2$
  149.         TEXT  42, 48, 118, 8, "Click END to finish the demonstation."
  150.         PUSHBUTTON  223, 47, 40, 16, "END"
  151.     END DIALOG
  152.     
  153.     Return% = DIALOG (DispMessage100)
  154.     if Return = 2 then STOP
  155.     
  156. END WITHOBJECT
  157.  
  158.  
  159.  
  160. SUB Cross (xcoo&,ycoo&,zcoo&)
  161. withobject "corelcad.automation.1"
  162.     .SetPointXYZ xcoo, ycoo, zcoo-7
  163.     .SetPointXYZ xcoo, ycoo, zcoo+7
  164.     .LineSegment 
  165.     .ChangeColor 51, 255, 102
  166.     .SetPointXYZ xcoo-7, ycoo, zcoo
  167.     .SetPointXYZ xcoo+7, ycoo, zcoo
  168.     .LineSegment 
  169.     .ChangeColor 0, 0, 0
  170.     .SetPointXYZ xcoo, ycoo-7, zcoo
  171.     .SetPointXYZ xcoo, ycoo+7, zcoo
  172.     .LineSegment 
  173.     .ChangeColor 255, 0, 0
  174.     .Box -1, xcoo-2, ycoo-2, zcoo-2, xcoo+2, ycoo+2, zcoo+2
  175.     .ChangeColor 0, 204, 255
  176.     .setpointxyz xcoo,ycoo,zcoo
  177.     .linesegment
  178.                 wait for 1
  179.     '.selectWithinRegion xcoo-6,ycoo-6,zcoo-6,xcoo+6,ycoo+6,zcoo+6 
  180. end withobject
  181. end sub
  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. '************************************************************************************************************
  195.  
  196.