home *** CD-ROM | disk | FTP | other *** search
- 'This script will demonstrate DIMENSION commands on a simple 3D object
-
- '************************************************************************************************************
- '************************************************************************************************************
- '************************************************************************************************************
- '************************************************************************************************************
- REM ⌐ 1996 Corel Corporation. All rights reserved.
- '************************************************************************************************************
-
-
- 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: DIMENSIONING a simple 3D figure"
-
- REM Declare Subroutines
-
- WITHOBJECT "CorelCAD.Automation.1"
-
- REM Call A New File
- .FileNew
-
- REM Call First Dialog
-
- string1$ = "This script will demonstrate the DIMENSION commands."
- string2$ = "For more information on DIMENSION commands consult CorelCAD's On-line Help."
- BEGIN DIALOG DispMessage1 25, 70, 316, 70,Title$
- TEXT 4, 3, 310, 17, String1$
- TEXT 5, 25, 310, 19, String2$
- TEXT 6, 46, 310, 13, "Click NEXT to proceed or CANCEL to exit the Script."
- PUSHBUTTON 198, 44, 40, 16, "Next >>>"
- CANCELBUTTON 240, 44, 40, 16
- END DIALOG
-
- Return% = DIALOG (DispMessage1)
- if Return = 2 then STOP
-
- REM Call Second Dialog and Draw Simple 3D Figure
-
- string1$ = "A BOX will be created to DIMENSION."
- string2$ = ""
- BEGIN DIALOG DispMessage2 25, 70, 316, 70,Title$
- TEXT 4, 3, 310, 17, String1$
- TEXT 5, 25, 310, 19, String2$
- TEXT 6, 46, 310, 13, "Click NEXT to proceed or CANCEL to exit the Script."
- PUSHBUTTON 198, 44, 40, 16, "Next >>>"
- CANCELBUTTON 240, 44, 40, 16
- END DIALOG
-
- Return% = DIALOG (DispMessage2)
- if Return = 2 then STOP
-
- REM Create Rectangular Box To Be Dimensioned
- .Box -1, -54.7076, -23.4799, 0, -49.8334, -25.674, 2.4411
- .ZoomToAll
- .ZoomOut
- .ZoomOut
-
- REM Call Third Dialog and Dimension One Feature of Rectangular Box
- string1$ = "The length of the BOX will be DIMENSIONED using the X LINEAR DIMENSION command from the DIMENSION flyout."
- string2$ = "We will use ENDPOINT SNAP in the SNAP flyout to specify DIMENSION end-points."
- BEGIN DIALOG DispMessage3 25, 70, 316, 70,Title$
- TEXT 4, 3, 310, 17, String1$
- TEXT 5, 25, 310, 19, String2$
- TEXT 6, 46, 310, 13, "Click NEXT to proceed or CANCEL to exit the Script."
- PUSHBUTTON 198, 44, 40, 16, "Next >>>"
- CANCELBUTTON 240, 44, 40, 16
- END DIALOG
-
- Return% = DIALOG (DispMessage3)
- if Return = 2 then STOP
- REM Script Ends When User Closes Dialog
-
- REM Create First Dimension
- call cross(-54.7076, -25.674, 0)
- call cross(-49.8334, -25.674, 0)
- call doline(-54.7076, -25.674, 0,-54.6968, -28.081, 0)
- call doline(-49.8334, -25.674, 0,-49.825, -28.044, 0)
- wait for 1
- .undo
- .undo
- .SelectWithinRegion -54.4425, -27.8756, 2.4411, -53.315, -28.4935, 2.4411
- .deleteselection
- .SelectWithinRegion -49.5622, -27.8088, 2.4411, -48.5589, -28.378, 2.4411
- .deleteselection
- .DimensionLinear -1, 0, -54.7076, -25.674, 0, -49.8334, -25.674, 0, -52.0871, -28.0692, 0
- .ZoomToAll
-
- REM Call Fourth Dialog and Dimension Width of the Rectangular Box
-
- string1$ = "The width will be DIMENSIONED using the Y-LINEAR DIMENSION command."
- string2$ = ""
- BEGIN DIALOG DispMessage4 25, 70, 316, 70,Title$
- TEXT 4, 3, 310, 17, String1$
- TEXT 5, 25, 310, 19, String2$
- TEXT 6, 46, 310, 13, "Click NEXT to proceed or CANCEL to exit the Script."
- PUSHBUTTON 198, 44, 40, 16, "Next >>>"
- CANCELBUTTON 240, 44, 40, 16
- END DIALOG
-
- Return% = DIALOG (DispMessage4)
- if Return = 2 then STOP
-
- REM Create Second Dimension
- call cross(-49.8334, -25.674, 0)
- call cross(-49.8334, -23.4799, 0)
- call doline(-49.8334, -25.674, 0,-47.0714, -25.6813, 0)
- call doline(-49.8334, -23.4799, 0,-47.0621, -23.5114, 0)
- wait for 1
- .undo
- .undo
- .SelectWithinRegion -49.5622, -27.8088, 2.4411, -48.5589, -28.378, 2.4411
- .deleteselection
- .SelectWithinRegion -49.4487, -25.4706, 2.4411, -48.5352, -26.418, 2.4411
- .deleteselection
- .DimensionLinear -1, 1, -49.8334, -23.4799, 0, -49.8334, -25.674, 0, -47.0955, -25.1169, 0
- .ZoomToAll
-
- REM Call Fifth Dialog and Dimension Height of the Rectangular Box
- string1$ = "The height will be DIMENSIONED using the Z-LINEAR command"
- string2$ = ""
- BEGIN DIALOG DispMessage5 25, 70, 316, 70,Title$
- TEXT 4, 3, 310, 17, String1$
- TEXT 5, 25, 310, 19, String2$
- TEXT 6, 46, 310, 13, "Click NEXT to proceed or CANCEL to exit the Script."
- PUSHBUTTON 198, 44, 40, 16, "Next >>>"
- CANCELBUTTON 240, 44, 40, 16
- END DIALOG
-
- Return% = DIALOG (DispMessage5)
- if Return = 2 then STOP
-
- REM Create Third Dimension and Zoom to All
- call cross(-54.7076, -23.4799, 0)
- call cross(-54.7076, -23.4799, 2.4411)
- call doline(-54.7076, -23.4799, 0,-56.16, -25.9342, 2.4411)
- call doline(-54.7076, -23.4799, 2.4411,-56.9865, -23.4996, 2.4411)
- wait for 1
- .undo
- .undo
- .zoomout
- .SelectWithinRegion -54.3776, -25.5144, 2.4411, -53.4079, -26.3908, 2.4411
- .deleteselection
- .SelectWithinRegion -55.2369, -23.0612, 2.4411, -53.898, -24.1741, 2.4411
- .deleteselection
- .DimensionLinear -1, 2, -54.7076, -23.4799, 0, -54.7076, -23.4799, 2.4411, -57.0157, -22.1567, 0
- .ZoomToAll
-
- string1$ = "A MATERIAL will be applied to the BOX."
- string2$ = "RENDERING may take a moment."
- BEGIN DIALOG DispMessage6 25, 70, 316, 70,Title$
- TEXT 4, 3, 310, 17, String1$
- TEXT 5, 25, 310, 19, String2$
- TEXT 6, 46, 310, 13, "Click NEXT to proceed or CANCEL to exit the Script."
- PUSHBUTTON 198, 44, 40, 16, "Next >>>"
- CANCELBUTTON 240, 44, 40, 16
- END DIALOG
-
- Return% = DIALOG (DispMessage6)
- if Return = 2 then STOP
- .SelectWithinRegion -55.1196, -23.0698, 2.4411, -54.2263, -23.7867, 2.4411
- .deleteselection
- .SelectAll
- .ApplyMaterial "Woods", "Pine"
- .ShadeEntireView -1,-1,3,0
-
- String1$ = "There is a seperate tool to DIMENSION each axial direction. (X-LINEAR, Y-LINEAR, Z-LINEAR)."
- String2$ = "The FREE DIMENSION tool in the DIMENSION flyout can be used to quickly DIMENSION any two points."
- beep
- BEGIN DIALOG DispMessage100 25, 70, 316, 75, "FINAL HINTS"
- TEXT 4, 4, 310, 16, string1
- TEXT 4, 19, 310, 17, string2
- TEXT 42, 48, 118, 8, "Click END to finish the demonstation."
- PUSHBUTTON 223, 47, 40, 16, "END"
- END DIALOG
-
- Return% = DIALOG (DispMessage100)
- if Return = 2 then STOP
-
- END WITHOBJECT
-
- '************************************************************************************************
- '************************************************************************************************************
- '************************************************************************************************************
-
-
- SUB Cross (xcoo#,ycoo#,zcoo#)
- withobject "corelcad.automation.1"
- .SetPointXYZ xcoo, ycoo, zcoo-.2
- .SetPointXYZ xcoo, ycoo, zcoo+.2
- .LineSegment
- .ChangeColor 51, 255, 102
- .SetPointXYZ xcoo-.2, ycoo, zcoo
- .SetPointXYZ xcoo+.2, ycoo, zcoo
- .LineSegment
- .ChangeColor 0, 0, 0
- .SetPointXYZ xcoo, ycoo-.2, zcoo
- .SetPointXYZ xcoo, ycoo+.2, zcoo
- .LineSegment
- .ChangeColor 255, 0, 0
- .Box -1, xcoo-.1, ycoo-.1, zcoo-.1, xcoo+.1, ycoo+.1, zcoo+.1
- .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 .5,1
- .setcurrentlayer "Default Layer"
- end withobject
- END SUB
- '************************************************************************************************************
- '************************************************************************************************************
-
-