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

  1. REM Declare Subroutines
  2.  
  3. REM Declare Variables
  4. Global Title as string
  5.  
  6. REM Variable Declarations
  7. DIM i%
  8. DIM XCoord$
  9. DIM XCoordNum%
  10. DIM ShadeNum%
  11. DIM ShadeType$(7)
  12. DIM MatType1$(6)
  13. DIM MatNum1%
  14. DIM MatNum2%
  15. DIM MetType$(4)
  16. DIM CategoryType$(6)
  17. DIM GlassType$(4)
  18. DIM JewelType$(4) 
  19. DIM MinType$(4)
  20. DIM PlasType$(4)
  21. DIM WoodType$(4)
  22. DIM ImageNum%
  23. DIM Yes$
  24. DIM YesNum%
  25. DIM No$
  26. DIM NoNum%
  27. DIM FileName$
  28. DIM FileNum%
  29. DIM FontType$(6)
  30. DIM Fontnum%
  31.  
  32. Title$ = "CorelCAD: TEXT EXTRUDE demonstration"
  33. REM Call First Dialog Box
  34.  
  35.  
  36.  
  37. Withobject "CorelCAD.Automation.1"
  38. .FileNEW
  39.  
  40.  
  41.     Message " CorelDraw7.0 must be installed for this script to run."
  42.  
  43.     String1$ = "This script will create TEXT in CorelDRAW 7.0, PASTE it into CORELCAD, then EXTRUDE it."
  44.     String2$ = "For more information on OLE and EXTRUDE commands, consult CorelCAD's On-line Help."
  45. BEGIN DIALOG DispMessage 25, 70, 316, 75,TITLE
  46.     TEXT  4, 4, 310, 16, STRING1
  47.     TEXT  4, 18, 310, 16, STRING2
  48.     TEXT  4, 46, 170, 8, "Click NEXT to proceed or CANCEL to exit the Script."
  49.     PUSHBUTTON  192, 44, 40, 16, "Next >>>"
  50.     CANCELBUTTON  240, 44, 40, 16
  51. END DIALOG
  52.  
  53.     Return% = DIALOG (DispMessage)
  54.     if Return = 2 then STOP
  55.  
  56.  
  57.     String1$ = "CorelDRAW 7.0 will now be launched in the background. This may take a moment."
  58.     String2$ = ""
  59. BEGIN DIALOG DispMessage1 25, 70, 316, 75,TITLE
  60.     TEXT  4, 4, 310, 16, STRING1
  61.     TEXT  4, 18, 310, 16, 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 (DispMessage1)
  68.     if Return = 2 then STOP
  69.  
  70. End Withobject
  71.  
  72.  
  73. NewText = "COREL"
  74.  
  75. WITHOBJECT "CorelDraw.Automation.7"
  76.     .fileNew
  77.     .CreateArtisticText NewText,150000,150000
  78.     .SelectAllobjects
  79.  
  80. .SetCharacterAttributes 0, 255, "Times New Roman", 13, 900, 0, 0, 0, 0, 0, 0, 0, 1    
  81.         .SelectAllobjects
  82.         .ConvertToCurves
  83.         .BreakApart
  84.         .Combine    
  85.  
  86. '*****************************************************************************************************************
  87. '*****************************************************************************************************************
  88. '*****************************************************************************************************************
  89. '*****************************************************************************************************************
  90.     'Select all lines prior to exporting.
  91.     String1$ = "The TEXT has been created in CorelDRAW 7.0. (This is running in the background)."
  92.     String2$ = "CorelDRAW 7.0 will now COPY the text to the clipboard."
  93. BEGIN DIALOG DispMessage2 25, 70, 316, 75,TITLE
  94.     TEXT  4, 4, 310, 16, STRING1
  95.     TEXT  4, 18, 310, 16, STRING2
  96.     TEXT  4, 46, 170, 8, "Click NEXT to proceed or CANCEL to exit the Script."
  97.     PUSHBUTTON  192, 44, 40, 16, "Next >>>"
  98.     CANCELBUTTON  240, 44, 40, 16
  99. END DIALOG
  100.  
  101.     Return% = DIALOG (DispMessage2)
  102.     if Return = 2 then STOP
  103.  
  104.     .copytoClipboard
  105. End Withobject
  106.  
  107. Withobject "CorelCad.Automation.1"
  108.  
  109.     .FileNew
  110.     String1$ = "The text will now be PASTED into CorelCAD."
  111.     string2$ = ""
  112. BEGIN DIALOG DispMessage3 25, 70, 316, 75,TITLE
  113.     TEXT  4, 4, 310, 16, STRING1
  114.     TEXT  4, 18, 310, 16, STRING2
  115.     TEXT  4, 46, 170, 8, "Click NEXT to proceed or CANCEL to exit the Script."
  116.     PUSHBUTTON  192, 44, 40, 16, "Next >>>"
  117.     CANCELBUTTON  240, 44, 40, 16
  118. END DIALOG
  119.  
  120.     Return% = DIALOG (DispMessage3)
  121.     if Return = 2 then STOP
  122.  
  123.     .Editpaste
  124.     .ZoomToAll
  125.     .SelectAll
  126.  
  127.     .Move 0, 0, 0, 0, 0, 0, 0, 0
  128.     .SelectPointAt -3.34298, 2.28576, 0, 0
  129.     .SelectAll
  130.     .SolidExplode
  131.      .SolidExplode
  132.     .SelectAll 
  133.     .SolidDefine
  134.  
  135.     String1$ = "The next step will be to EXTRUDE the text."
  136.     String2$ = "This will give the text its thickness. The EXTRUDE command is found in the DRAW menu."
  137. BEGIN DIALOG DispMessage4 25, 70, 316, 75,TITLE
  138.     TEXT  4, 4, 310, 16, STRING1
  139.     TEXT  4, 18, 310, 16, STRING2
  140.     TEXT  4, 46, 170, 8, "Click NEXT to proceed or CANCEL to exit the Script."
  141.     PUSHBUTTON  192, 44, 40, 16, "Next >>>"
  142.     CANCELBUTTON  240, 44, 40, 16
  143. END DIALOG
  144.  
  145.     Return% = DIALOG (DispMessage4)
  146.     if Return = 2 then STOP
  147.  
  148.     ExtNum% = 6
  149.         
  150.     .StartAddCmdPoint 2
  151.     .AddCmdPoint 0, 0, 0
  152.     .AddCmdPoint 0, 0, ExtNum
  153.     .EndAddCmdPoint 
  154.     .Extrude 0
  155.  
  156.  
  157. .ZoomToAll
  158. WAIT FOR 1
  159.  
  160.     String1$ = "The holes in the lettering will be BOOLEAN SUBTRACTED prior to RENDERING the text."
  161.     String2$ = ""
  162. BEGIN DIALOG DispMessage5 25, 70, 316, 75,TITLE
  163.     TEXT  4, 4, 310, 16, STRING1
  164.     TEXT  4, 18, 310, 16, STRING2
  165.     TEXT  4, 46, 170, 8, "Click NEXT to proceed or CANCEL to exit the Script."
  166.     PUSHBUTTON  192, 44, 40, 16, "Next >>>"
  167.     CANCELBUTTON  240, 44, 40, 16
  168. END DIALOG
  169.  
  170.     Return% = DIALOG (DispMessage5)
  171.     if Return = 2 then STOP
  172.  
  173.     .SelectPointAt 30.194, 115.298, 0, 0
  174.     .SetPointXYZ 38.565, 97.8948, 0
  175.     .SetPointXYZ 34.7797, 96.3013, 0
  176.     .SolidSubtract 
  177.     .SetPointXYZ 57.0253, 99.7412, 0
  178.     .SetPointXYZ 53.7364, 96.6608, 0
  179.     .SolidSubtract 
  180.  
  181.     String1$ = "Select a MATERIAL to be applied to the TEXT."
  182.     String2$ = "MATERIALS can be applied by using the MATERIAL roll-up."
  183. BEGIN DIALOG DispMessage6 25, 70, 316, 75,TITLE
  184.     TEXT  4, 4, 310, 16, STRING1
  185.     TEXT  4, 18, 310, 16, STRING2
  186.     TEXT  4, 46, 170, 8, "Click NEXT to proceed or CANCEL to exit the Script."
  187.     PUSHBUTTON  192, 44, 40, 16, "Next >>>"
  188.     CANCELBUTTON  240, 44, 40, 16
  189. END DIALOG
  190.  
  191.     Return% = DIALOG (DispMessage6)
  192.     if Return = 2 then STOP
  193.  
  194.     'SHADING QUALITY
  195.  
  196.     ShadeType(1) = "Flat Shading"
  197.     ShadeType(2) = "Gouraud Shading"
  198.     ShadeType(3) = "Phong Shading"
  199.     ShadeType(4) = "Preview"
  200.     ShadeType(5) = "Full Render"
  201.     ShadeType(6) = "Ray Traced Preview"
  202.     ShadeType(7) = "Ray Traced Render"
  203.  
  204.  
  205.     ShadeNum = 4
  206.  
  207.  
  208.     'DEFINING CATEGORY TYPES
  209.  
  210.     MatType1(1) = "Metallic"
  211.     MatType1(2) = "Glass"
  212.     MatType1(3) = "Jewel"
  213.     MatType1(4) = "Mineral"
  214.     MatType1(5) = "Plastics"
  215.     MatType1(6) = "Woods"
  216.  
  217.  
  218.     MatNum1 = 4
  219.  
  220.  
  221.     'DEFINING THE MATERIAL
  222.  
  223.  
  224.     MatNum2 = 1
  225.  
  226.  
  227.     GlassType(1) = "Crystal Blue"
  228.     GlassType(2) = "Crystal Red"
  229.     GlassType(3) = "Glass Green"
  230.     GlassType(4) = "Glass Frosted"
  231.  
  232.     JewelType(1) = "Sapphire"
  233.     JewelType(2) = "Ambrite"
  234.     JewelType(3) = "Ruby"
  235.     JewelType(4) = "Tiger's Eye"
  236.  
  237.     MetType(1) = "Bronze"
  238.     MetType(2) = "Copper"
  239.     MetType(3) = "Chrome"
  240.     MetType(4) = "Steel"
  241.  
  242.     MinType(1) = "Bricks"
  243.     MinType(2) = "Blue Marbel"
  244.     MinType(3) = "Granite"
  245.     MinType(4) = "Pavement"
  246.  
  247.     PlasType(1) = "Bumpy Orange"
  248.     PlasType(2) = "Matte Black"
  249.     PlasType(3) = "Shiny Red"
  250.     PlasType(4) = "Clear Blue"
  251.  
  252.     WoodType(1) = "Cedar"
  253.     WoodType(2) = "Mahogany"
  254.     WoodType(3) = "Oak"
  255.     WoodType(4) = "Pine"
  256.  
  257. ' ************************************************************************************************
  258. ' ************************************************************************************************
  259. ' ************************************************************************************************
  260. ' ************************************************************************************************
  261.  
  262.     START:
  263.  
  264.     DONECOLORCHANGE:
  265.  
  266.     BEGIN DIALOG StartDia 25, 70, 132, 114, "Material Selection"
  267.         LISTBOX  26, 26, 72, 56, MatType1$, MatNum1%
  268.         OKBUTTON  15, 94, 44, 14
  269.         CANCELBUTTON  61, 94, 44, 14
  270.         TEXT  8, 3, 122, 9, "Select Material Category."
  271.         GROUPBOX  20, 15, 84, 69, "Category Selection"
  272.     END DIALOG
  273.     Return = DIALOG(StartDia)    'Runs the dialog box
  274.     If return = 2 then stop        'If the user presses ESC, cancels the script
  275.     .SelectAll     'Selects the object to apply the Shading or Material.
  276.  
  277.     
  278.     If MatNum1 = 1 then
  279.  
  280.         BEGIN DIALOG Matchange3 25, 70, 132, 115, "Material Selection"
  281.             LISTBOX  32, 36, 72, 48, MetType$, MatNum2%
  282.             OKBUTTON  12, 96, 48, 14
  283.             CANCELBUTTON  64, 96, 48, 14
  284.             TEXT  3, 8, 128, 12, "Select Material to be applied."
  285.             GROUPBOX  26, 24, 84, 64, "Metallic Types"
  286.         END DIALOG
  287.                 Return = DIALOG(Matchange3)    'Runs the dialog box
  288.                 If return = 2 then stop        'If the user presses ESC, cancels the script
  289.         
  290.         Select Case matnum2%
  291.              Case 1
  292.                 .ApplyMaterial "Metallic", "Bronze"
  293.             Case    2    
  294.                 .ApplyMaterial "Metallic", "Copper"                    
  295.             Case    3    
  296.                 .ApplyMaterial "Metallic", "Chrome"
  297.             Case     4    
  298.                 .ApplyMaterial "Metallic", "Steel"
  299.             Case else 
  300.         End Select
  301.     
  302.     elseif MatNum1 = 2 then
  303.         BEGIN DIALOG Matchange1 25, 70, 133, 112, "Material Selection"
  304.             LISTBOX  32, 36, 72, 45, GlassType$, MatNum2%
  305.             OKBUTTON  12, 94, 48, 14
  306.             CANCELBUTTON  64, 94, 48, 14
  307.             TEXT  4, 8, 129, 12, "Select Material to be applied."
  308.             GROUPBOX  26, 24, 84, 63, "Glass Types"
  309.         END DIALOG
  310.         Return = DIALOG(Matchange1)    'Runs the dialog box
  311.         If Return = 2 then stop        'If the user presses ESC, cancels the script
  312.  
  313.         Select Case MatNum2%
  314.             Case    1    
  315.                 .ApplyMaterial "Glass","Crystal Blue"
  316.             Case    2
  317.                 .ApplyMaterial "Glass","Crystal Red"    
  318.             Case    3    
  319.                 .ApplyMaterial "Glass","Glass Green"
  320.             Case    4
  321.                 .ApplyMaterial "Glass","Glass Frosted"
  322.         End Select
  323.  
  324.     elseif matnum1 = 3 then
  325.  
  326.         BEGIN DIALOG Matchange2 25, 70, 130, 112, "Material Selection"
  327.             LISTBOX  32, 36, 72, 47, JewelType$, MatNum2%
  328.             OKBUTTON  13, 94, 48, 14
  329.             CANCELBUTTON  65, 94, 48, 14
  330.             TEXT  1, 8, 129, 10, "Select Material to be applied."
  331.             GROUPBOX  26, 24, 84, 64, "Jewel Types"
  332.         END DIALOG
  333.         Return = DIALOG(Matchange2)    'Runs the dialog box
  334.         If return = 2 then stop        'If the user presses ESC, cancels the script
  335.  
  336.         Select Case MatNum2%
  337.             Case    1    
  338.                 .ApplyMaterial "Jewel","Sapphire"
  339.             Case    2    
  340.                 .ApplyMaterial "Jewel","Ambrite"    
  341.             Case    3    
  342.                 .ApplyMaterial "Jewel","Ruby"
  343.             Case    4    
  344.                 .ApplyMaterial "Jewel","Tiger's Eye"
  345.         End Select
  346.  
  347.     elseif matnum1  =4 then
  348.  
  349.         BEGIN DIALOG Matchange4 25, 70, 134, 112, "Material Selection"
  350.             LISTBOX  32, 36, 72, 48, MinType$, MatNum2%
  351.             OKBUTTON  16, 94, 48, 14
  352.             CANCELBUTTON  68, 94, 48, 14
  353.             TEXT  4, 8, 129, 12, "Select Material to be applied."
  354.             GROUPBOX  26, 25, 84, 64, "Mineral Types"
  355.         END DIALOG
  356.         Return = DIALOG(Matchange4)    'Runs the dialog box
  357.         If return = 2 then stop        'If the user presses ESC, cancels the script
  358.  
  359.         Select Case MatNum2%
  360.             Case    1    
  361.                 .ApplyMaterial "Mineral","Bricks"
  362.             Case    2    
  363.                 .ApplyMaterial "Mineral","Blue Marbel"    
  364.             Case    3    
  365.                 .ApplyMaterial "Mineral","Granite"
  366.             Case    4    
  367.                 .ApplyMaterial "Mineral","Pavement"
  368.         End Select
  369.  
  370.     elseif matnum1=5 then
  371.  
  372.         BEGIN DIALOG Matchange5 25, 70, 132, 112, "Material Selection"
  373.             LISTBOX  32, 36, 72, 46, PlasType$, MatNum2%
  374.             OKBUTTON  14, 92, 48, 15
  375.             CANCELBUTTON  66, 92, 48, 15
  376.             TEXT  2, 8, 128, 12, "Select Material to be applied."
  377.             GROUPBOX  26, 24, 84, 60, "Plastic Types"
  378.         END DIALOG
  379.         Return = DIALOG(Matchange5)    'Runs the dialog box
  380.         If return = 2 then stop        'If the user presses ESC, cancels the script
  381.  
  382.         Select Case MatNum2%
  383.             Case    1    
  384.                 .ApplyMaterial "Plastics", "Bumpy Orange"
  385.             Case    2    
  386.                 .ApplyMaterial "Plastics", "Matte Black"
  387.             Case    3    
  388.                 .ApplyMaterial "Plastics", "Shiny Red"
  389.             Case    4    
  390.                 .ApplyMaterial "Plastics", "Clear Blue"
  391.         End Select
  392.  
  393.     elseif matnum1 = 6 then
  394.  
  395.         BEGIN DIALOG Matchange6 25, 70, 130, 112, "Material Selection"
  396.             LISTBOX  32, 36, 72, 48, WoodType$, MatNum2%
  397.             OKBUTTON  16, 95, 48, 13
  398.             CANCELBUTTON  68, 95, 48, 13
  399.             TEXT  2, 8, 128, 12, "Select Material to be applied."
  400.             GROUPBOX  26, 24, 84, 65, "Wood Types"
  401.         END DIALOG
  402.         Return = DIALOG(Matchange6)    'Runs the dialog box
  403.         If return = 2 then stop        'If the user presses ESC, cancels the scrip
  404.  
  405.         Select Case MatNum2%
  406.             Case    1    
  407.                 .ApplyMaterial "Woods", "Cedar"
  408.             Case    2    
  409.                 .ApplyMaterial "Woods", "Mahogany"
  410.             Case    3    
  411.                 .ApplyMaterial "Woods", "Oak"
  412.             Case    4    
  413.                 .ApplyMaterial "Woods", "Pine"
  414.         End Select
  415.  
  416.     Endif
  417.  
  418.     .SelectAll 
  419.     .EDITCUT
  420.     .EDITPASTE 0,0,0    
  421.     .ZoomToAll 
  422.     .ShadeEntireView 0,0,3,0
  423.  
  424. BEEP
  425. BEGIN DIALOG DispMessage8 25, 70, 154, 65,Title$
  426.     TEXT  29, 14, 98, 8, "The demonstration is complete."
  427.     PUSHBUTTON  61, 34, 40, 16, "End"
  428. END DIALOG
  429.     Return% = DIALOG (DispMessage8)
  430.     if Return = 2 then STOP
  431. END WITHOBJECT
  432.  
  433.  
  434.  
  435.  
  436.  
  437.