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

  1. 'This script will demonstrate the SPIRAL ARRAY Command
  2.  
  3. '************************************************************************************************************
  4. '************************************************************************************************************
  5. '************************************************************************************************************
  6. '************************************************************************************************************
  7. REM ⌐ 1996 Corel Corporation. All rights reserved.
  8. '************************************************************************************************************
  9.  
  10. declare SUB Cross (xcoo&,ycoo&,zcoo&)
  11. declare SUB DoLine(x1&,y1&,z1&,x2&,y2&,z2&)
  12.  
  13. REM Declare Variables
  14. Global Title as string
  15.  
  16. Rem Set Variable
  17. Title$ = "CorelCAD: Creating a SPIRAL ARRAY"
  18.  
  19. WITHOBJECT "CorelCAD.Automation.1"
  20.  
  21.     REM Call A New File
  22.     .FileNew
  23.  
  24.     REM Call First Dialog
  25.     string1$ = "This script will demonstrate the SPIRAL ARRAY command."
  26.     string2$ = "For more information on ARRAYS consult CorelCAD's On-line Help."
  27.     BEGIN DIALOG DispMessage 25, 70, 316, 75, Title$
  28.         TEXT  4, 4, 310, 12, String1$
  29.         TEXT  4, 18, 310, 10, 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.     REM Call Second Dialog and Draw Sphere
  39.     string1$ = "A SPHERE will be created using the SPHERE: CENTER and RADIUS command."
  40.     string2$ = "This is located on the main toolbar in the 3D-Solids flyout."
  41.     BEGIN DIALOG DispMessage1 25, 70, 316, 75, Title$
  42.         TEXT  4, 4, 310, 12, String1$
  43.         TEXT  4, 18, 310, 10, String2$
  44.         TEXT  4, 46, 170, 8, "Click NEXT to proceed or CANCEL to exit the Script."
  45.         PUSHBUTTON  192, 44, 40, 16, "Next >>>"
  46.         CANCELBUTTON  240, 44, 40, 16
  47.     END DIALOG
  48.  
  49.     Return% = DIALOG (DispMessage1)
  50.     if Return = 2 then STOP
  51.  
  52.     .zoomout
  53.     .zoomout
  54.     .zoomout
  55.     .Sphere -1, -69.6239, -60.873, 0, -62.4962, -75.5613, 0
  56.     
  57.     string1$ = "Two points will be set to specify the AXIS of REVOLUTION."
  58.     string2$ = "The SPIRAL ARRAY dialog box is used to set the offset distance, which will specify the total height of the array."
  59.     BEGIN DIALOG DispMessage2 25, 70, 316, 75, Title$
  60.         TEXT  4, 4, 310, 12, String1$
  61.         TEXT  4, 18, 310, 18, String2$
  62.         TEXT  4, 46, 170, 8, "Click NEXT to proceed or CANCEL to exit the Script."
  63.         PUSHBUTTON  192, 44, 40, 16, "Next >>>"
  64.         CANCELBUTTON  240, 44, 40, 16
  65.     END DIALOG
  66.  
  67.     Return% = DIALOG (DispMessage2)
  68.     if Return = 2 then STOP
  69.     
  70.     cross -43,-9,0
  71.     doline -43,-9,0,-100,-10,0
  72.     cross -100,-10,0
  73.  
  74.     .SelectPointAt -67.7288, -51.2311, 0, 0
  75.     .SpiralArray 30, 2, 180, -1, -43, -9, 0, -100, -10, 0
  76.     .ZoomToAll 
  77.  
  78.     string1$ = "The SPIRAL ARRAY contains 50 objects."
  79.     string2$ = "The SPIRAL ARRAY has 2 revolutions with an OFFSET of 25 inches."
  80.     string3$ = "The model will now be rendered."
  81. BEGIN DIALOG DispMessage3 25, 70, 316, 86,title
  82.     TEXT  4, 4, 310, 12, string1
  83.     TEXT  4, 18, 310, 10, string2
  84.     TEXT  4, 59, 170, 8, "Click NEXT to proceed or CANCEL to exit the Script."
  85.     PUSHBUTTON  192, 57, 40, 16, "Next >>>"
  86.     CANCELBUTTON  240, 57, 40, 16
  87.     TEXT  4, 36, 298, 15, string3
  88. END DIALOG
  89.  
  90.     Return% = DIALOG (DispMessage3)
  91.     if Return = 2 then STOP
  92.  
  93.     .SelectWithinRegion -115.779, -4.41464, 0, -25.1566, -17.9643, 0
  94.     .DeleteSelection 
  95.     .ZoomIn -145.845, 65.8135, 0, 152.637, -105.168, 0
  96.     .SelectAll 
  97.     .ChangeColor 153, 255, 0
  98.     .ShadeEntireView 0, 0, 3, 0
  99.  
  100.     String1$ = "The OPEN WINDOW LAYOUT command, located in the WINDOW menu, can be used to open multiple views of any model."
  101.     String2$ = "The ROTATE 3D VIEW button may be used to rotate the current view."
  102. beep
  103. BEGIN DIALOG EndMess 25, 70, 316, 75, "FINAL HINTS"
  104.     TEXT  4, 4, 310, 16, String1$
  105.     TEXT  4, 25, 310, 17, String2$
  106.     TEXT  42, 48, 118, 8, "Click END to finish the demonstation."
  107.     PUSHBUTTON  223, 47, 40, 16, "END"
  108. END DIALOG
  109.  
  110. ret = DIALOG(EndMess)
  111. END WITHOBJECT
  112.  
  113.  
  114. '************************************************************************************************************
  115. SUB Cross (xcoo&,ycoo&,zcoo&)
  116. withobject "corelcad.automation.1"
  117.     .SetPointXYZ xcoo, ycoo, zcoo-7
  118.     .SetPointXYZ xcoo, ycoo, zcoo+7
  119.     .LineSegment 
  120.     .ChangeColor 51, 255, 102
  121.     .SetPointXYZ xcoo-7, ycoo, zcoo
  122.     .SetPointXYZ xcoo+7, ycoo, zcoo
  123.     .LineSegment 
  124.     .ChangeColor 0, 0, 0
  125.     .SetPointXYZ xcoo, ycoo-7, zcoo
  126.     .SetPointXYZ xcoo, ycoo+7, zcoo
  127.     .LineSegment 
  128.     .ChangeColor 255, 0, 0
  129.     .Box -1, xcoo-2, ycoo-2, zcoo-2, xcoo+2, ycoo+2, zcoo+2
  130.     .ChangeColor 0, 204, 255
  131.     .setpointxyz xcoo,ycoo,zcoo
  132.     .linesegment
  133.                 wait for 1
  134.     '.selectWithinRegion xcoo-6,ycoo-6,zcoo-6,xcoo+6,ycoo+6,zcoo+6 
  135. end withobject
  136. end sub
  137. '************************************************************************************************************
  138. SUB DoLine(x1&,y1&,z1&,x2&,y2&,z2&)
  139.     WITHOBJECT "CorelCAD.automation.1"
  140.     .NewLayer " ", , -1, 0, 0, 0, 0, 255, 0, 2, ""
  141.     .setcurrentlayer " "
  142.     .setpointxyz x1,y1,z1 
  143.     .setpointxyz x2,y2,z2
  144.     .arrowLine 3,1
  145.     .setcurrentlayer "Default Layer"
  146. wait for 1
  147.     end withobject
  148. END SUB
  149. '************************************************************************************************************
  150. '************************************************************************************************************
  151.