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

  1. 'This script will demonstrate the SPHERICAL ARRAY Command
  2.  
  3. '************************************************************************************************************
  4. '************************************************************************************************************
  5. '************************************************************************************************************
  6. '************************************************************************************************************
  7. REM ⌐ 1996 Corel Corporation. All rights reserved.
  8. '************************************************************************************************************
  9.  
  10.  
  11. REM Declare Subroutines
  12. declare Sub Cross(xcoo&,ycoo&,zcoo&)
  13. declare Sub DoLine(x1&,y1&,z1&,x2&,y2&,z2&)
  14. '************************************************************************************************************
  15. '************************************************************************************************************
  16.  
  17. REM Declare Variables
  18. Global Title as string
  19.  
  20. Rem Set Variable
  21. Title$ = "CorelCAD:Creating a SPHERICAL ARRAY"
  22.  
  23. WITHOBJECT "CorelCAD.Automation.1"
  24.  
  25.     REM Call A New File
  26.     .FileNew
  27.  
  28.     REM Call First Dialog
  29.     string1$ = "This script will demonstrate the SPHERICAL ARRAY command."
  30.     string2$ = "For more information on ARRAYS consult CorelCAD's On-line Help."
  31.  
  32.     BEGIN DIALOG DispMessage 25, 70, 316, 75,Title$
  33.         TEXT  5, 4, 310, 11, String1$
  34.         TEXT  5, 17, 310, 20, String2$
  35.         TEXT  5, 46, 170, 8, "Click NEXT to proceed or CANCEL to exit the Script."
  36.         PUSHBUTTON  192, 44, 40, 16, "Next >>>"
  37.         CANCELBUTTON  240, 44, 40, 16
  38.     END DIALOG
  39.  
  40.     Return% = DIALOG (DispMessage)
  41.     if Return = 2 then STOP
  42.  
  43.  
  44.     REM Call Second Dialog and Draw Rectangle
  45.     string1$ = "A CONE will be created using the CONE: CENTER and RADIUS command."
  46.     string2$ = "This is located on the main toolbar in the 3D OBJECTS flyout."
  47.  
  48.     BEGIN DIALOG DispMessage2 25, 70, 316, 75,Title$
  49.         TEXT  5, 4, 310, 11, String1$
  50.         TEXT  5, 17, 310, 20, String2$
  51.         TEXT  5, 46, 170, 8, "Click NEXT to proceed or CANCEL to exit the Script."
  52.         PUSHBUTTON  192, 44, 40, 16, "Next >>>"
  53.         CANCELBUTTON  240, 44, 40, 16
  54.     END DIALOG
  55.  
  56.     Return% = DIALOG (DispMessage2)
  57.     if Return = 2 then STOP
  58.  
  59.  
  60.     .Cone -1, -60, -20, 0, -60, -10, 0, -99.6697, -19.5316, 0
  61.  
  62.     string1$ = "Two points are required for the completion of a SPHERICAL ARRAY."
  63.     string2$ = "The first point will be set to specify the center of the ARRAY. The second point will specify the location of the north pole of the ARRAY."
  64.     BEGIN DIALOG DispMessage3 25, 70, 316, 75,Title$
  65.         TEXT  5, 4, 310, 11, String1$
  66.         TEXT  5, 17, 310, 20, String2$
  67.         TEXT  5, 46, 170, 8, "Click NEXT to proceed or CANCEL to exit the Script."
  68.         PUSHBUTTON  192, 44, 40, 16, "Next >>>"
  69.         CANCELBUTTON  240, 44, 40, 16
  70.     END DIALOG
  71.  
  72.     Return% = DIALOG (DispMessage3)
  73.     if Return = 2 then STOP
  74.  
  75.     cross -60,-20,0
  76.     doline -60,-20,0,-60,-20,20
  77.     cross -60,-20,20
  78.  
  79.     .SelectPointAt -100,-100,-100,0
  80.     .selectnext
  81.     .SphericalArray 15, 5, 3, -1, -60, -20, 0, -60,-20,20
  82.     .zoomtoall
  83.  
  84.     string1$ = "This ARRAY is made up of 20 CONES around the equator and 10 CONES at the poles."
  85.     string2$ = "There are 4 rows on either side of the equator and all of the CONES have been rotated."
  86.     string3$ = "The model will now be rendered."
  87.  
  88. BEGIN DIALOG DispMessage4 25, 70, 316, 86,title
  89.     TEXT  4, 4, 310, 12, string1
  90.     TEXT  4, 18, 310, 10, string2
  91.     TEXT  4, 59, 170, 8, "Click NEXT to proceed or CANCEL to exit the Script."
  92.     PUSHBUTTON  192, 57, 40, 16, "Next >>>"
  93.     CANCELBUTTON  240, 57, 40, 16
  94.     TEXT  4, 36, 298, 15, string3
  95. END DIALOG
  96.     Return% = DIALOG (DispMessage4)
  97.     if Return = 2 then STOP
  98.  
  99.     .SelectWithinRegion -70.1734, -13.4743, 20, -52.2391, -26.0335, 20
  100.     .DeleteSelection 
  101.  
  102.  
  103.     .SelectAll 
  104.     .ApplyMaterial "Jewel", "Mother of Pearl"
  105.     .ZoomIn -115.778, -4.31066, 20, 16.0877, -80.4289, 20
  106.     .ShadeEntireView 0, 0, 3, 0
  107.     
  108.     String1$ = "To perform the SPHERICAL ARRAY, the user must set parameters that define the number of copies around the equator, poles, as well as the number of rows in the array."
  109.     String2$ = "A practical use of the SPHERICAL ARRAY would be to construct the dimples on a golf ball."
  110. beep
  111. BEGIN DIALOG EndMess 25, 70, 316, 75, "FINAL HINTS"
  112.     TEXT  4, 4, 310, 16, String1$
  113.     TEXT  4, 25, 310, 17, String2$
  114.     TEXT  42, 48, 118, 8, "Click END to finish the demonstation."
  115.     PUSHBUTTON  223, 47, 40, 16, "END"
  116. END DIALOG
  117.  
  118. ret = DIALOG(EndMess)
  119. END WITHOBJECT
  120.  
  121.  
  122.  
  123. '************************************************************************************************************
  124. SUB Cross (xcoo&,ycoo&,zcoo&)
  125. withobject "corelcad.automation.1"
  126.     .SetPointXYZ xcoo, ycoo, zcoo-7
  127.     .SetPointXYZ xcoo, ycoo, zcoo+7
  128.     .LineSegment 
  129.     .ChangeColor 51, 255, 102
  130.     .SetPointXYZ xcoo-7, ycoo, zcoo
  131.     .SetPointXYZ xcoo+7, ycoo, zcoo
  132.     .LineSegment 
  133.     .ChangeColor 0, 0, 0
  134.     .SetPointXYZ xcoo, ycoo-7, zcoo
  135.     .SetPointXYZ xcoo, ycoo+7, zcoo
  136.     .LineSegment 
  137.     .ChangeColor 255, 0, 0
  138.     .Box -1, xcoo-2, ycoo-2, zcoo-2, xcoo+2, ycoo+2, zcoo+2
  139.     .ChangeColor 0, 204, 255
  140.     .setpointxyz xcoo,ycoo,zcoo
  141.     .linesegment
  142.                 wait for 1
  143.     '.selectWithinRegion xcoo-6,ycoo-6,zcoo-6,xcoo+6,ycoo+6,zcoo+6 
  144. end withobject
  145. end sub
  146. '************************************************************************************************************
  147. SUB DoLine(x1&,y1&,z1&,x2&,y2&,z2&)
  148.     WITHOBJECT "CorelCAD.automation.1"
  149.     .NewLayer " ", , -1, 0, 0, 0, 0, 255, 0, 2, ""
  150.     .setcurrentlayer " "
  151.     .setpointxyz x1,y1,z1 
  152.     .setpointxyz x2,y2,z2
  153.     .arrowLine 3,1
  154.     .setcurrentlayer "Default Layer"
  155. wait for 1
  156.     end withobject
  157. END SUB
  158. '************************************************************************************************************
  159. '************************************************************************************************************
  160.  
  161.