home *** CD-ROM | disk | FTP | other *** search
- '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#)
-
-
- REM Declare Variables
- Global Title as string
-
- Rem Set Variable
- Title$ = "CorelCAD: RECTANGLE to BOX Demonstration"
-
- Withobject "CorelCad.Automation.1"
-
- .FileNew
-
- string1$ = "This script will demonstrate how to create a solid BOX from a surface RECTANGLE."
- string2$ = "For more information on the RECTANGLE and EXTRUDE commands, consult CorelCAD's On-line Help."
- BEGIN DIALOG DispMessage 25, 70, 316, 75,Title$
- TEXT 4, 3, 310, 17, String1$
- TEXT 5, 22, 310, 19, 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 surface RECTANGLE will now be created by using the RECTANGLE: 2 POINTS tool."
- string2$ = "Two points are required for the construction of the RECTANGLE."
- BEGIN DIALOG DispMessage1 25, 70, 316, 75,Title$
- TEXT 4, 3, 310, 17, String1$
- TEXT 5, 22, 310, 19, 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 (DispMessage1)
- if Return = 2 then STOP
-
- string1$ = "The first point specifies the first corner of the RECTANGLE."
- string2$ = ""
- BEGIN DIALOG DispMessage2 25, 70, 316, 75,Title$
- TEXT 4, 3, 310, 17, String1$
- TEXT 5, 22, 310, 19, 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 (DispMessage2)
- if Return = 2 then STOP
-
- Call Cross ( -60.5382, -53.8782, 37.9088 )
-
- string1$ = "The second point specifies the diagonal corner of the RECTANGLE."
- string2$ = ""
- BEGIN DIALOG DispMessage3 25, 70, 316, 75,Title$
- TEXT 4, 3, 310, 17, String1$
- TEXT 5, 22, 310, 19, 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 doline (-60.5382, -53.8782, 37.9088, -14.2669, -27.8744, 37.9088)
- Call Cross (-14.2669, -27.8744, 37.9088)
-
- .SelectPointAt -100.4463, -5.93935, 0, 0
-
- Wait for 1
-
- .Rectangle 0, -60.5382, -53.8782, 37.9088, -14.2669, -27.8744, 37.9088
-
- .SelectALL
- .DeleteSelection
-
- .Rectangle 0, -60.5382, -53.8782, 37.9088, -14.2669, -27.8744, 37.9088
- .SelectAll
-
- string1$ = "The RECTANGLE will now be EXTRUDED into a BOX."
- string2$ = "The EXTRUDE command is located in the DRAW menu."
- string3$ = "The first point of the EXTRUDE path is set."
- string4$ = ""
- BEGIN DIALOG DispMessage4 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 (DispMessage4)
- if Return = 2 then STOP
-
-
- Call Cross ( -60.5382, -53.8782, 37.9088 )
-
- string1$ = "The second point of the EXTRUDE path will now be 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 DispMessage5 25, 70, 316, 75,Title$
- TEXT 4, 3, 310, 17, String1$
- TEXT 5, 22, 310, 19, 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
-
- CAll doline (-60.5382, -53.8782, 37.9088, -60.5776, -53.9574, 75.674)
- .zoomtoall
- CALL Cross ( -60.5776, -53.9574, 75.674 )
-
- Wait for 1
-
- .SelectAll
- .DeleteSelection
-
- 'Extruding the final Rectangle to a box
-
- .Rectangle 0, -60.5382, -53.8782, 37.9088, -14.2669, -27.8744, 37.9088
- .SolidDefine
- .StartAddCmdPoint 2
- .AddCmdPoint -60.5382, -53.8782, 37.9088
- .AddCmdPoint -60.5776, -53.9574, 75.674
- .EndAddCmdPoint
- .Extrude 0
- .wireframe
-
- String1$ = "An EXTRUDE PATH can also be defined by selecting an existing line rather than setting two points."
- String2$ = "The CURVE tool may be used to define complex EXTRUDE PATHS. This tool can be found on the LINES 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)
-
-
- 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
-