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

  1. 'This script shall enable the user to create a solid Sphere
  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. declare Sub DoSphere(x1&,y1&,z1&,x2&,y2&,z2&)
  14.  
  15. REM Declare Variables
  16. Global Title as string
  17.  
  18. Rem Set Variable
  19. Title$ = "CorelCAD: SOLID SPHERE demonstration"
  20.  
  21. Withobject "CorelCad.Automation.1"
  22.  
  23.     .FILENEW
  24.     
  25.     string1$ = "This script will demonstrate how to create a SOLID SPHERE."
  26.     string2$ = "For more information on the SOLID SPHERE tool, consult CorelCAD's On-line Help."
  27.     BEGIN DIALOG DispMessage 25, 70, 316, 75,Title$
  28.         TEXT  4, 4, 310, 21, String1$
  29.         TEXT  5, 28, 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.     string1$ = "The SPHERE will now be created using the 3D SOLID: SPHERE,CENTER and RADIUS Tool."
  39.     string2$ = "Two points are required for the construction of the SPHERE."
  40.     BEGIN DIALOG DispMessage1 25, 70, 316, 75,Title$
  41.         TEXT  4, 4, 310, 21, String1$
  42.         TEXT  5, 28, 310, 10, String2$
  43.         TEXT  4, 46, 170, 8, "Click NEXT to proceed or CANCEL to exit the Script."
  44.         PUSHBUTTON  192, 44, 40, 16, "Next >>>"
  45.         CANCELBUTTON  240, 44, 40, 16
  46.     END DIALOG
  47.  
  48.     Return% = DIALOG (DispMessage1)
  49.     if Return = 2 then STOP
  50.  
  51.     string1$ = "The first point will be set to specify the center of the SPHERE."
  52.     string2$ = ""
  53.     BEGIN DIALOG DispMessage2 25, 70, 316, 75,Title$
  54.         TEXT  4, 4, 310, 21, String1$
  55.         TEXT  5, 28, 310, 10, String2$
  56.         TEXT  4, 46, 170, 8, "Click NEXT to proceed or CANCEL to exit the Script."
  57.         PUSHBUTTON  192, 44, 40, 16, "Next >>>"
  58.         CANCELBUTTON  240, 44, 40, 16
  59.     END DIALOG
  60.  
  61.     Return% = DIALOG (DispMessage2)
  62.     if Return = 2 then STOP
  63.  
  64.      Cross -30,-30,0
  65.  
  66.     string1$ = "The second point will be set to specify the radius of the SPHERE."
  67.     string2$ = "The Insert Point Roll-up can be used for precise placement of points."
  68.     string3$ = "The Insert Point Roll-up is located in the Tools menu."
  69.     string4$ = ""
  70.     BEGIN DIALOG DispMessage3 25, 70, 316, 98, Title$
  71.         TEXT  4, 4, 310, 12, String1$
  72.         TEXT  4, 18, 310, 10, String2$
  73.         TEXT  4, 32, 310, 12, String3$
  74.         TEXT  4, 46, 310, 11, String4$
  75.         TEXT  4, 69, 310, 8, "Click NEXT to proceed or CANCEL to exit the Script."
  76.         PUSHBUTTON  192, 67, 40, 16, "Next >>>"
  77.         CANCELBUTTON  240, 67, 40, 16
  78.     END DIALOG
  79.     
  80.     Return% = DIALOG (DispMessage3)
  81.     if Return = 2 then STOP
  82.  
  83.  
  84.      DoLine -30,-30,0,0,0,0
  85.      cross 0,0,0
  86.     .SelectPointAt -69.0982, 3.27301, 50, 0
  87.  
  88.  
  89.     Call dosphere ( -30,-30,0,0,0,0 )
  90.     .SelectPointAt -69.0982, 3.27301, 50, 0
  91.  
  92.     .ZoomToAll
  93.     Wait for 2
  94.  
  95.     .SelectAll
  96.     .deleteselection
  97.  
  98.     .Sphere -1, -30,-30,0,0,0,0
  99.  
  100.     string1$ = "A MATERIAL will now be applied to the SPHERE."
  101.     string2$ = "RENDERING may take a moment."
  102.     BEGIN DIALOG DispMessage4 25, 70, 316, 75,Title$
  103.         TEXT  4, 4, 310, 21, String1$
  104.         TEXT  5, 28, 310, 10, String2$
  105.         TEXT  4, 46, 170, 8, "Click NEXT to proceed or CANCEL to exit the Script."
  106.         PUSHBUTTON  192, 44, 40, 16, "Next >>>"
  107.         CANCELBUTTON  240, 44, 40, 16
  108.     END DIALOG
  109.  
  110.     Return% = DIALOG (DispMessage4)
  111.     if Return = 2 then STOP
  112.  
  113.  
  114.     .SelectAll
  115.     .setsurfacerefinement 0,3
  116.     .setsurfacerefinement 1,3
  117.     .setsurfacerefinement 2,3 
  118.     .SetEdgeRefinement 0, 3
  119.     .ApplyMaterial "Metallic", "Bronze"
  120.     .ShadeSelected 0, 0, 2
  121.  
  122.     String1$ = "The quality of the model is affected by the REFINEMENT SETTINGS."
  123.     String2$ = "To increase the REFINEMENTS of any model, use the REFINEMENTS dialog box, loacted in the VIEW menu."
  124. beep
  125. BEGIN DIALOG EndMess 25, 70, 316, 75, "FINAL HINTS"
  126.     TEXT  4, 4, 310, 16, String1$
  127.     TEXT  4, 25, 310, 17, String2$
  128.     TEXT  42, 48, 118, 8, "Click END to finish the demonstation."
  129.     PUSHBUTTON  223, 47, 40, 16, "END"
  130. END DIALOG
  131.  
  132. ret = DIALOG(EndMess)
  133. END WITHOBJECT
  134. '************************************************************************************************
  135.  
  136.  
  137.  
  138. SUB Cross (xcoo&,ycoo&,zcoo&)
  139. withobject "corelcad.automation.1"
  140.     .SetPointXYZ xcoo, ycoo, zcoo-7
  141.     .SetPointXYZ xcoo, ycoo, zcoo+7
  142.     .LineSegment 
  143.     .ChangeColor 51, 255, 102
  144.     .SetPointXYZ xcoo-7, ycoo, zcoo
  145.     .SetPointXYZ xcoo+7, ycoo, zcoo
  146.     .LineSegment 
  147.     .ChangeColor 0, 0, 0
  148.     .SetPointXYZ xcoo, ycoo-7, zcoo
  149.     .SetPointXYZ xcoo, ycoo+7, zcoo
  150.     .LineSegment 
  151.     .ChangeColor 255, 0, 0
  152.     .Box -1, xcoo-1, ycoo-1, zcoo-1, xcoo+1, ycoo+1, zcoo+1
  153.     .ChangeColor 0, 204, 255
  154.     .setpointxyz xcoo,ycoo,zcoo
  155.     .linesegment
  156.                 wait for 1
  157.     '.selectWithinRegion xcoo-6,ycoo-6,zcoo-6,xcoo+6,ycoo+6,zcoo+6 
  158. end withobject
  159. end sub
  160.  
  161.  
  162. SUB DoLine(x1&,y1&,z1&,x2&,y2&,z2&)
  163.     WITHOBJECT "CorelCAD.automation.1"
  164.     .NewLayer " ", , -1, 0, 0, 0, 0, 255, 0, 2, ""
  165.     .setcurrentlayer " "
  166.     .setpointxyz x1,y1,z1 
  167.     .setpointxyz x2,y2,z2
  168.     .arrowLine 3,1
  169.     .setcurrentlayer "Default Layer"
  170.  
  171.     end withobject
  172. END SUB
  173.  
  174.  
  175. SUB DoSphere(x1&,y1&,z1&,x2&,y2&,z2&)
  176.     WITHOBJECT "CorelCAD.automation.1"
  177.     .NewLayer " ", , -1, 0, 0, 0, 0, 255, 0, 2, ""
  178.     .setcurrentlayer " "
  179.     .Sphere -1, -30,-30,0,0,0,0
  180.     .setcurrentlayer "Default Layer"
  181.  
  182.     end withobject
  183. END SUB
  184.