home *** CD-ROM | disk | FTP | other *** search
/ Corel Draw 7 / CD7_CAD.ISO / cad / 2dirarry.csc next >
Encoding:
Text File  |  1996-10-28  |  6.0 KB  |  178 lines

  1. 'This script will demonstrate the 2 DIRECTIONAL ARRAY command
  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 2 DIRECTIONAL ARRAY"
  21.  
  22. WITHOBJECT "CorelCAD.Automation.1"
  23.  
  24.     REM Call First Dialog
  25.     .filenew
  26.  
  27.  
  28.     String1$ = "This script will demonstrate the 2 DIRECTIONAL ARRAY command. For more information on ARRAYS consult CorelCAD's On-line Help."
  29.     string2$ = ""
  30. BEGIN DIALOG DispMessage1 25, 70, 316, 70,Title$
  31.     TEXT  4, 4, 310, 18, String1$
  32.     TEXT  4, 20, 310, 18, String2$
  33.     TEXT  6, 46, 170, 18, "Click NEXT to proceed or CANCEL to exit the Script."
  34.     PUSHBUTTON  198, 44, 40, 16, "Next >>>"
  35.     CANCELBUTTON  240, 44, 40, 16
  36. END DIALOG
  37.  
  38.     Return% = DIALOG (DispMessage1)
  39.     if Return = 2 then STOP
  40.  
  41. String1$ = "A FRUSTUM will now be created. This is done using the FRUSTUM: CENTER AND RADIUS tool, located on the main toolbar in the 3D SOLID Flyout."
  42. string2$ = ""
  43. BEGIN DIALOG Dispa 25, 70, 316, 70,Title$
  44.     TEXT  4, 4, 310, 18, String1$
  45.     TEXT  4, 20, 310, 18, String2$
  46.     TEXT  6, 46, 170, 18, "Click NEXT to proceed or CANCEL to exit the Script."
  47.     PUSHBUTTON  198, 44, 40, 16, "Next >>>"
  48.     CANCELBUTTON  240, 44, 40, 16
  49. END DIALOG
  50.     Return% = DIALOG (Dispa)
  51.     if Return = 2 then STOP
  52.  
  53.  
  54.     .Frustum -1, -60, -40, 0, -50, -40, 0, -50, -40, 10, -55.6787, -45.8934, 0
  55.  
  56.  
  57.     String1$ = "A 2 DIRECTIONAL ARRAY will now be performed."
  58.     String2$ = "The BASE POINT of the ARRAY will be positioned at the center of the FRUSTUM."
  59. BEGIN DIALOG DispMessage2 25, 70, 316, 70,Title$
  60.     TEXT  4, 4, 310, 18, String1$
  61.     TEXT  4, 20, 310, 18, String2$
  62.     TEXT  6, 46, 170, 18, "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 (DispMessage2)
  68.     if Return = 2 then STOP
  69.  
  70.     cross -60,-40,0
  71.  
  72.  
  73.     String1$ = "The second point will indicate the first direction and distance of the ARRAY."
  74.     String2$ = "The third point will indicate the second direction and distance."
  75. BEGIN DIALOG DispMessage3 25, 70, 316, 70,Title$
  76.     TEXT  4, 4, 310, 18, String1$
  77.     TEXT  4, 20, 310, 18, String2$
  78.     TEXT  6, 46, 170, 18, "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 (DispMessage3)
  84.     if Return = 2 then STOP    
  85.  
  86.     doline -60,-40,0,-30,-40,0
  87. wait for 1
  88.     cross -30,-40,0
  89.     doline -60,-40,0,-60,-10,0
  90. wait for 1    
  91.     cross -60,-10,0
  92.     
  93.     .SelectPointAt -59.5168, -49.567, 0, 0
  94.     .TwoDArray 0, 3, 3, -60, -40, 0, -30, -40, 0, -60, -10, 0
  95.     .zoomtoall
  96.  
  97.  
  98.  
  99.     String1$ = "This ARRAY contains 9 objects,3 SOLIDS in each of the X and Y directions."
  100.     String2$ = "A MATERIAL will now be applied to the FRUSTUMS."
  101.     String3$ = "RENDERING may take a moment."
  102.     String4$ = ""
  103.     BEGIN DIALOG DispMessage5 25,70, 316, 98, Title$
  104.         TEXT  4, 4, 310, 18, String1$
  105.         TEXT  4, 20, 310, 18, String2$
  106.         TEXT  4, 36, 310, 18, String3$
  107.         TEXT  4, 52, 310, 18, String4$
  108.         TEXT  4, 68, 170, 8, "Click NEXT to proceed or CANCEL to exit the Script."
  109.         PUSHBUTTON  192, 67, 40, 16, "Next >>>"
  110.         CANCELBUTTON  240, 67, 40, 16
  111.     END DIALOG
  112.     
  113.     Return% = DIALOG (DispMessage5)
  114.     if Return = 2 then STOP
  115.     
  116.     .selectall
  117.     .ApplyMaterial "Jewel", "Opal" 
  118.     .ShadeEntireView 0,0,3,0
  119.  
  120. beep
  121.     String1$ = "The distance set in each direction can be between copies (INCREMENTAL) or between the original object and the final duplicate (OVERALL)."
  122.     String2$ = "The ARRAY commands are used to arrange multiple copies of objects into specific patterns."
  123.  
  124. BEGIN DIALOG EndMess 25, 70, 316, 75, "FINAL HINTS"
  125.     TEXT  4, 4, 310, 16, String1$
  126.     TEXT  4, 25, 310, 17, String2$
  127.     TEXT  42, 48, 118, 8, "Click END to finish the demonstation."
  128.     PUSHBUTTON  223, 47, 40, 16, "END"
  129. END DIALOG
  130.  
  131. ret = DIALOG(EndMess)
  132.  
  133.  
  134.  
  135.     
  136. END WITHOBJECT
  137.  
  138.  
  139.  
  140.  
  141.  
  142. '************************************************************************************************************
  143. SUB Cross (xcoo&,ycoo&,zcoo&)
  144. withobject "corelcad.automation.1"
  145.     .SetPointXYZ xcoo, ycoo, zcoo-7
  146.     .SetPointXYZ xcoo, ycoo, zcoo+7
  147.     .LineSegment 
  148.     .ChangeColor 51, 255, 102
  149.     .SetPointXYZ xcoo-7, ycoo, zcoo
  150.     .SetPointXYZ xcoo+7, ycoo, zcoo
  151.     .LineSegment 
  152.     .ChangeColor 0, 0, 0
  153.     .SetPointXYZ xcoo, ycoo-7, zcoo
  154.     .SetPointXYZ xcoo, ycoo+7, zcoo
  155.     .LineSegment 
  156.     .ChangeColor 255, 0, 0
  157.     .Box -1, xcoo-2, ycoo-2, zcoo-2, xcoo+2, ycoo+2, zcoo+2
  158.     .ChangeColor 0, 204, 255
  159.     .setpointxyz xcoo,ycoo,zcoo
  160.     .linesegment
  161.                 wait for 1
  162.     '.selectWithinRegion xcoo-6,ycoo-6,zcoo-6,xcoo+6,ycoo+6,zcoo+6 
  163. end withobject
  164. end sub
  165. '************************************************************************************************************
  166. SUB DoLine(x1&,y1&,z1&,x2&,y2&,z2&)
  167.     WITHOBJECT "CorelCAD.automation.1"
  168.     .NewLayer " ", , -1, 0, 0, 0, 0, 255, 0, 2, ""
  169.     .setcurrentlayer " "
  170.     .setpointxyz x1,y1,z1 
  171.     .setpointxyz x2,y2,z2
  172.     .arrowLine 3,1
  173.     .setcurrentlayer "Default Layer"
  174.     end withobject
  175. END SUB
  176. '************************************************************************************************************
  177. '************************************************************************************************************
  178.