home *** CD-ROM | disk | FTP | other *** search
Wrap
'This script gives a demonstration of OBJECT DEFINE and EXTRUDE commands in CorelCAD ' '************************************************************************************************************ '************************************************************************************************************ '************************************************************************************************************ '************************************************************************************************************ REM ⌐ 1995 Corel Corporation. All rights reserved. '************************************************************************************************************ REM Declare Subroutines declare Sub Cross(xcoo#,ycoo#,zcoo#) declare Sub DoLine(x1#,y1#,z1#,x2#,y2#,z2#) declare Sub DoPRISM(x1#,y1#,z1#,x2#,y2#,z2#) REM Declare Variables Global Title as string Rem Set Variable Title$ = "CorelCAD: POLYGON to PRISM demonstration" Withobject "CorelCad.Automation.1" .FileNew string1$ = "This script will demonstrate how to create a solid PRISM from a 2D POLYGON." string2$ = "For more information on the POLYGON and EXTRUDE tools, consult CorelCAD's On-line Help." BEGIN DIALOG DispMessage 25, 70, 316, 75,Title$ TEXT 4, 3, 310, 17, String1$ TEXT 4, 25, 310, 18, String2$ TEXT 4, 46, 170, 8, "Click NEXT to proceed or CANCEL to exit the Script." PUSHBUTTON 192, 44, 40, 16, "Next >>>" CANCELBUTTON 240, 44, 40, 16 END DIALOG Return% = DIALOG (DispMessage) if Return = 2 then STOP string1$ = "A POLYGON will be created by using the POLYGON: CENTER and VERTEX Tool." string2$ = "Two points are required for the construction of this POLYGON." string3$ = "A dialog box allows the user to define the POLYGON as a surface or a wireframe." string4$ = "" BEGIN DIALOG DispMessage2 25, 70, 316, 98, Title$ TEXT 4, 4, 310, 12, String1$ TEXT 4, 18, 310, 10, String2$ TEXT 4, 32, 310, 12, String3$ TEXT 4, 46, 310, 11, String4$ TEXT 4, 69, 310, 8, "Click NEXT to proceed or CANCEL to exit the Script." PUSHBUTTON 192, 67, 40, 16, "Next >>>" CANCELBUTTON 240, 67, 40, 16 END DIALOG Return% = DIALOG (DispMessage2) if Return = 2 then STOP string1$ = "The first point specifies the center of the POLYGON." string2$ = "" BEGIN DIALOG DispMessage3 25, 70, 316, 75,Title$ TEXT 4, 3, 310, 17, String1$ TEXT 4, 25, 310, 18, String2$ TEXT 4, 46, 170, 8, "Click NEXT to proceed or CANCEL to exit the Script." PUSHBUTTON 192, 44, 40, 16, "Next >>>" CANCELBUTTON 240, 44, 40, 16 END DIALOG Return% = DIALOG (DispMessage3) if Return = 2 then STOP CALL cross( -53.4695, -23.5108, 0) string1$ = "The second point specifies the vertex of the POLYGON." string2$ = "" BEGIN DIALOG DispMessage4 25, 70, 316, 75,Title$ TEXT 4, 3, 310, 17, String1$ TEXT 4, 25, 310, 18, String2$ TEXT 4, 46, 170, 8, "Click NEXT to proceed or CANCEL to exit the Script." PUSHBUTTON 192, 44, 40, 16, "Next >>>" CANCELBUTTON 240, 44, 40, 16 END DIALOG Return% = DIALOG (DispMessage4) if Return = 2 then STOP CAll doline (-53.4695, -23.5108, 0,-32.3422, -28.6715, 0) CALL cross(-32.3422, -28.6715, 0) Wait for 1 .Selectall .DeleteSelection .PolygonCenter -1, 6, -53.4695, -23.5108, 0, -32.3422, -28.6715, 0 string1$ = "The POLYGON will now be EXTRUDED into a PRISM." string2$ = "The first point of the EXTRUDE path is set." BEGIN DIALOG DispMessage5 25, 70, 316, 75,title TEXT 4, 3, 310, 17, string1 TEXT 4, 21, 310, 18, string2 TEXT 4, 46, 170, 8, "Click NEXT to proceed or CANCEL to exit the Script." PUSHBUTTON 192, 44, 40, 16, "Next >>>" CANCELBUTTON 240, 44, 40, 16 END DIALOG Return% = DIALOG (DispMessage5) if Return = 2 then STOP .SelectPointAt -62.4463, -5.93935, 0, 0 .StartAddCmdPoint 2 CALL cross(-68.5024, -39.2272, 0) .AddCmdPoint -68.5024, -39.2272, 0 string1$ = "The second point of the EXTRUDE path is set. This will define the EXTRUDE height." string2$ = "Note: To move the cursor in the Z-direction while performing commands, hold the CTRL+SHIFT keys down." BEGIN DIALOG DispMessage6 25, 70, 316, 75,title TEXT 4, 3, 310, 17, string1 TEXT 4, 20, 310, 18, string2 TEXT 4, 46, 170, 8, "Click NEXT to proceed or CANCEL to exit the Script." PUSHBUTTON 192, 44, 40, 16, "Next >>>" CANCELBUTTON 240, 44, 40, 16 END DIALOG Return% = DIALOG (DispMessage6) if Return = 2 then STOP CALL cross(-68.5024, -39.2272, 50) .AddCmdPoint -68.5024, -39.2272, 50 CAll doline (-68.5024, -39.2272, 0,-68.5024, -39.2272, 50) .zoomtoall CALL cross(-68.5024, -39.2272, 50) .SelectPointAt -95.9686, -44.5701, 50, 0 Wait for 1 .EndAddCmdPoint .Extrude 0 .SelectAll .DeleteSelection 'Extruding the polygon into a PRISM .PolygonCenter -1, 6, -53.4695, -23.5108, 0, -32.3422, -28.6715, 0 .SelectPointAt -70.4639, -31.7042, 0, 0 .StartAddCmdPoint 2 .AddCmdPoint -68.5024, -39.2272, 0 .AddCmdPoint -68.5024, -39.2272, 50 .EndAddCmdPoint .Extrude 0 .ZoomToAll String1$ = "The HIDE button can be used to give us a realistic view of our model. It hides all construction lines which would not be normally visible." String2$ = "The HIDE PROPERTIES dialog box can be opened by right-mouse clicking on the HIDE button, located on the STANDARD toolbar." beep BEGIN DIALOG EndMess 25, 70, 316, 75, "FINAL HINTS" TEXT 4, 4, 310, 16, String1$ TEXT 4, 25, 310, 17, String2$ TEXT 42, 48, 118, 8, "Click END to finish the demonstation." PUSHBUTTON 223, 47, 40, 16, "END" END DIALOG ret = DIALOG(EndMess) .hideentireview 0,0,0,0 END WITHOBJECT '************************************************************************************************ SUB Cross (xcoo#,ycoo#,zcoo#) withobject "corelcad.automation.1" .SetPointXYZ xcoo, ycoo, zcoo-7 .SetPointXYZ xcoo, ycoo, zcoo+7 .LineSegment .ChangeColor 51, 255, 102 .SetPointXYZ xcoo-7, ycoo, zcoo .SetPointXYZ xcoo+7, ycoo, zcoo .LineSegment .ChangeColor 0, 0, 0 .SetPointXYZ xcoo, ycoo-7, zcoo .SetPointXYZ xcoo, ycoo+7, zcoo .LineSegment .ChangeColor 255, 0, 0 .Box -1, xcoo-2, ycoo-2, zcoo-2, xcoo+2, ycoo+2, zcoo+2 .ChangeColor 0, 204, 255 .setpointxyz xcoo,ycoo,zcoo .linesegment wait for 1 '.selectWithinRegion xcoo-6,ycoo-6,zcoo-6,xcoo+6,ycoo+6,zcoo+6 end withobject end sub SUB DoLine(x1#,y1#,z1#,x2#,y2#,z2#) WITHOBJECT "CorelCAD.automation.1" .NewLayer " ", , -1, 0, 0, 0, 0, 255, 0, 2, "" .setcurrentlayer " " .setpointxyz x1,y1,z1 .setpointxyz x2,y2,z2 .arrowLine 3,1 .setcurrentlayer "Default Layer" end withobject END SUB SUB DoPRISM(x1#,y1#,z1#,x2#,y2#,z2#) WITHOBJECT "CorelCAD.automation.1" .NewLayer " ", , -1, 0, 0, 0, 0, 255, 0, 2, "" .setcurrentlayer " " .Box -1, -60,-60,0,0,0,60 .setcurrentlayer "Default Layer" end withobject END SUB