home *** CD-ROM | disk | FTP | other *** search
- 'This script will demonstrate DIMENSION commands on a simple 2D 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 2D figure"
-
- REM Declare Subroutines
-
- WITHOBJECT "CorelCAD.Automation.1"
-
- REM Call A New File
- .FileNew
-
- REM Call First Dialog
- string1$ = "This script will demonstrate DIMENSION commands."
- string2$ = "For more information on DIMENSION commands consult CorelCAD's On-line Help."
- BEGIN DIALOG DispMessage1 25, 70, 316, 75, Title$
- TEXT 4, 4, 310, 18, 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 (DispMessage1)
- if Return = 2 then STOP
-
-
- REM Call Second Dialog and Create Drawing
-
- string1$ = "A model will be created to be DIMENSIONED."
- string2$ = ""
- BEGIN DIALOG DispMessage2 25, 70, 316, 75, Title$
- TEXT 4, 4, 310, 18, 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 (DispMessage2)
- if Return = 2 then STOP
-
-
- REM Open Figure 1
- .Rectangle -1, -44.8403, -9.555, 0, -37.9971, -19.6866, 0
- .CircleRadius -1, -41.4187, -9.555, 0, -44.8403, -9.555, 0
- .SetPointXYZ -44.278, -7.94593, 0
- .SetPointXYZ -44.8384, -13.7966, 0
- .SolidAdd
- .ZoomToAll
- .ZoomOut
- .ZoomOut
-
- REM Call Third Dialog and Create First Dimension
-
- string1$ = "The Y-axis direction will be DIMENSIONED using the Y LINEAR DIMENSION command from the DIMENSION flyout."
- string2$ = ""
- BEGIN DIALOG DispMessage3 25, 70, 316, 75, Title$
- TEXT 4, 4, 310, 18, 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 (DispMessage3)
- if Return = 2 then STOP
-
- call cross(-44.8403, -19.6866, 0)
- call cross(-44.8403, -9.555, 0)
- call doline(-44.8403, -19.6866, 0,-54.1157, -19.6422, 0)
- call doline(-44.8403, -9.555, 0,-54.0904, -9.60367, 0)
- wait for 1
- .undo
- .undo
- .SelectWithinRegion -45.4022, -19.2249, 0, -44.1248, -19.9982, 0
- .deleteselection
- .SelectWithinRegion -45.6399, -8.90094, 0, -44.2192, -10.2531, 0
- .deleteselection
-
- .DimensionLinear -1, 1, -44.8403, -19.6866, 0, -44.8403, -9.555, 0, -54.1103, -7.87136, 0
- .ZoomToAll
-
- REM Call Fourth Dialog and Dimension Width of the Rectangular Box
-
- string1$ = "The width of the model will be DIMENSIONED using the X-LINEAR DIMENSION command."
- string2$ = ""
- BEGIN DIALOG DispMessage4 25, 70, 316, 75, Title$
- TEXT 4, 4, 310, 18, 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 (DispMessage4)
- if Return = 2 then STOP
-
- call cross(-44.8403, -19.6866, 0)
- call cross(-37.9971, -19.6866, 0)
- .zoomout
- .zoomout
-
- call doline(-44.8403, -19.6866, 0,-44.8293, -27.4212, -0.1)
- call doline(-37.9971, -19.6866, 0,-38.0717, -27.4201, -0.1)
-
- wait for 1
- .undo
- .undo
- .SelectWithinRegion -45.4022, -19.2249, 0, -44.1248, -19.9982, 0
- .deleteselection
- .SelectWithinRegion -38.805, -19.1323, -0.1, -37.1064, -20.7837, -0.1
- .deleteselection
-
- .DimensionLinear -1, 0, -44.8403, -19.6866, 0, -37.9971, -19.6866, 0, -37.3229, -27.4534, 0
- .ZoomToAll
-
- REM Call Fifth Dialog and Dimension Height of the Rectangular Box
-
- string1$ = "The semicircle will be DIMENSIONED using the RADIUS DIMENSION command."
- string2$ = ""
- BEGIN DIALOG DispMessage5 25, 70, 316, 75, Title$
- TEXT 4, 4, 310, 18, 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 (DispMessage5)
- if Return = 2 then STOP
-
-
- call cross(-39.5863, -6.61537, 0)
- call doline(-41.4187, -9.555, 0,-39.5863, -6.61537, 0)
- call doline(-39.5863, -6.61537, 0,-34.0096, -6.60939, 0)
- wait for 1
- .undo
- .undo
- .SelectWithinRegion -40.9769, -5.45742, 0, -37.6525, -8.3711, 0
- .deleteselection
-
- .DimensionRadius -1, -39.5615, -6.6813, 0, -35.0279, -6.65849, 0
- .ZoomToAll
-
- string1$ = "A MATERIAL will now be applied to the object."
- string2$ = "RENDERING may take a moment."
- BEGIN DIALOG DispMessage6 25, 70, 316, 75, Title$
- TEXT 4, 4, 310, 18, 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
-
- .SelectAll
- .ApplyMaterial "Others","Insulation"
- .ShadeEntireView -1,-1,3,0
-
- String1$ = "When DIMENSIONING circular objects, select the the feature to be dimensioned and the placement of the dimension text."
- String2$ = "CorelCAD locates the center of the object to be dimensioned."
- beep
- BEGIN DIALOG DispMessage100 25, 70, 316, 75, "FINAL HINTS"
- TEXT 4, 4, 310, 18, String1$
- TEXT 4, 25, 310, 18, 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
- '************************************************************************************************************
- '************************************************************************************************************
-
-