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

  1. 'This script will demonstrate the 3 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 3 DIRECTIONAL ARRAY"
  21.  
  22.  
  23. WITHOBJECT "CorelCAD.Automation.1"
  24.  
  25.     REM Call First Dialog
  26.     .filenew
  27.  
  28.  
  29.     String1$ = "This script will demonstrate the 3 DIRECTIONAL ARRAY command."
  30.     String2$ = "For more information on ARRAYS consult CorelCAD's On-line Help."
  31. BEGIN DIALOG DispMessage1 25,70, 316, 70,Title$
  32.     TEXT  4, 2, 310, 17, String1$
  33.     TEXT  4, 20, 310, 19, String2$
  34.     TEXT  6, 46, 310, 13, "Click NEXT to proceed or CANCEL to exit the Script."
  35.     PUSHBUTTON  198, 44, 40, 16, "Next >>>"
  36.     CANCELBUTTON  240, 44, 40, 16
  37. END DIALOG
  38.  
  39.     Return% = DIALOG (DispMessage1)
  40.     if Return = 2 then STOP
  41.  
  42.  
  43.  
  44.     String1$ = "A SPHERE will now be created."
  45.     String2$ = "This is done using the SPHERE: CENTER AND RADIUS tool, located on the main toolbar in the 3D SOLID flyout."
  46. BEGIN DIALOG DispMessage2 25,70, 316, 70,Title$
  47.     TEXT  4, 2, 310, 17, String1$
  48.     TEXT  4, 20, 310, 19, String2$
  49.     TEXT  6, 46, 310, 13, "Click NEXT to proceed or CANCEL to exit the Script."
  50.     PUSHBUTTON  198, 44, 40, 16, "Next >>>"
  51.     CANCELBUTTON  240, 44, 40, 16
  52. END DIALOG
  53.  
  54.     Return% = DIALOG (DispMessage2)
  55.     if Return = 2 then STOP
  56.  
  57.     .zoomout
  58.     .zoomout    
  59.     .zoomout
  60.     .Sphere -1, -40, -40, 0, -25, -40, 0
  61.  
  62.  
  63.     String1$ = "A 3 DIRECTIONAL ARRAY will now be performed."
  64.     String2$ = "The BASE POINT of the ARRAY will be positioned at the center of the SPHERE."
  65. BEGIN DIALOG DispMessage3 25,70, 316, 70,Title$
  66.     TEXT  4, 2, 310, 17, String1$
  67.     TEXT  4, 20, 310, 19, String2$
  68.     TEXT  6, 46, 310, 13, "Click NEXT to proceed or CANCEL to exit the Script."
  69.     PUSHBUTTON  198, 44, 40, 16, "Next >>>"
  70.     CANCELBUTTON  240, 44, 40, 16
  71. END DIALOG
  72.  
  73.     Return% = DIALOG (DispMessage3)
  74.     if Return = 2 then STOP
  75.  
  76.     cross -40,-40,0
  77.  
  78.  
  79.     String1$ = "Three additional points are required for directions and distances."
  80.     String2$ = "Points will be set on the X,Y and Z axis'."
  81. BEGIN DIALOG DispMessage4 25,70, 316, 70,Title$
  82.     TEXT  4, 2, 310, 17, String1$
  83.     TEXT  4, 20, 310, 19, String2$
  84.     TEXT  6, 46, 310, 13, "Click NEXT to proceed or CANCEL to exit the Script."
  85.     PUSHBUTTON  198, 44, 40, 16, "Next >>>"
  86.     CANCELBUTTON  240, 44, 40, 16
  87. END DIALOG
  88.  
  89.     Return% = DIALOG (DispMessage4)
  90.     if Return = 2 then STOP
  91.  
  92.     doline -40,-40,0,-15,-40,0
  93.     cross -15,-40,0
  94.     doline -40,-40,0,-40,-15,0
  95.     cross -40,-15,0
  96.     doline -40,-40,0,-40,-40,25
  97.     cross -40,-40,25
  98.     .SelectPointAt -44, -25.3593, 0, 0
  99.     .ThreeDArray 0, 3, 3, 3, -60, -60, 0, -35, -60, 0, -60, -35, 0, -60, -60, 25
  100.     .zoomtoall
  101.  
  102.     REM Call Fourth Dialog and Perform Array
  103.  
  104.     REM Call Fifth Dialog and Give Information to User
  105.  
  106.  
  107.  
  108.     string1$ = "This ARRAY contains 27 objects."
  109.     string2$ = "There are 3 SPHERES in each of the X,Y and Z directions, with an incremental distance of 25 inches between copies."
  110.     string3$ = "A MATERIAL will now be applied to the SPHERES."
  111.     string4$ = "RENDERING may take a moment."
  112. BEGIN DIALOG DispMessage5 25, 70, 316, 97,Title$
  113.     TEXT  4, 4, 310, 18, String1$
  114.     TEXT  4, 20, 310, 18, String2$
  115.     TEXT  5, 43, 310, 12, String3$
  116.     TEXT  4, 56, 310, 11, String4$
  117.     TEXT  4, 68, 170, 8, "Click NEXT to proceed or CANCEL to exit the Script."
  118.     PUSHBUTTON  192, 67, 40, 16, "Next >>>"
  119.     CANCELBUTTON  240, 67, 40, 16
  120. END DIALOG
  121.     
  122.     Return% = DIALOG (DispMessage5)
  123.     if Return = 2 then STOP    
  124.  
  125.     .selectall
  126.     .Applymaterial "Metallic","Chrome"
  127.     .shadeentireView 0,0,3,0
  128.  
  129. beep
  130.     String1$ = "The Insert Point Roll-Up can be used to precisely set the distances between the copies in the array. This Roll-Up can be found in the TOOLS menu."
  131.     String2$ = "Points in the Z-Direction may also be defined by holding down the CTRL+SHIFT keys."
  132.  
  133.     BEGIN DIALOG EndMess 25, 70, 316, 75, "FINAL HINTS"
  134.         TEXT  4, 4, 310, 16, String1$
  135.         TEXT  4, 25, 310, 17, String2$
  136.         TEXT  42, 48, 118, 8, "Click END to finish the demonstation."
  137.         PUSHBUTTON  223, 47, 40, 16, "END"
  138.     END DIALOG
  139.  
  140.     ret = DIALOG(EndMess)
  141.  
  142. END WITHOBJECT
  143.  
  144.  
  145.  
  146.  
  147. '************************************************************************************************************
  148. SUB Cross (xcoo&,ycoo&,zcoo&)
  149. withobject "corelcad.automation.1"
  150.     .SetPointXYZ xcoo, ycoo, zcoo-7
  151.     .SetPointXYZ xcoo, ycoo, zcoo+7
  152.     .LineSegment 
  153.     .ChangeColor 51, 255, 102
  154.     .SetPointXYZ xcoo-7, ycoo, zcoo
  155.     .SetPointXYZ xcoo+7, ycoo, zcoo
  156.     .LineSegment 
  157.     .ChangeColor 0, 0, 0
  158.     .SetPointXYZ xcoo, ycoo-7, zcoo
  159.     .SetPointXYZ xcoo, ycoo+7, zcoo
  160.     .LineSegment 
  161.     .ChangeColor 255, 0, 0
  162.     .Box -1, xcoo-2, ycoo-2, zcoo-2, xcoo+2, ycoo+2, zcoo+2
  163.     .ChangeColor 0, 204, 255
  164.     .setpointxyz xcoo,ycoo,zcoo
  165.     .linesegment
  166.                 wait for 1
  167.     '.selectWithinRegion xcoo-6,ycoo-6,zcoo-6,xcoo+6,ycoo+6,zcoo+6 
  168. end withobject
  169. end sub
  170. '************************************************************************************************************
  171. SUB DoLine(x1&,y1&,z1&,x2&,y2&,z2&)
  172.     WITHOBJECT "CorelCAD.automation.1"
  173.     .NewLayer " ", , -1, 0, 0, 0, 0, 255, 0, 2, ""
  174.     .setcurrentlayer " "
  175.     .setpointxyz x1,y1,z1 
  176.     .setpointxyz x2,y2,z2
  177.     .arrowLine 3,1
  178.     .setcurrentlayer "Default Layer"
  179.     wait for 1
  180.     end withobject
  181. END SUB
  182. '************************************************************************************************************
  183. '************************************************************************************************************
  184.  
  185.