home *** CD-ROM | disk | FTP | other *** search
- 'This script demonstrates the 3D TRIM command
-
- '************************************************************************************************************
- '************************************************************************************************************
- '************************************************************************************************************
- '************************************************************************************************************
- REM ⌐ 1996 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: 3D TRIM demonstration"
-
- Withobject "CorelCad.Automation.1"
-
- .FileNew
-
-
-
- String1$ = "This script demonstrates the 3D TRIM command."
- String2$ = "For more information on TRIM consult CorelCAD's On-line Help."
- BEGIN DIALOG DispMessage1 25,70, 316, 70,Title$
- TEXT 4, 2, 310, 17, String1$
- TEXT 4, 20, 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
-
-
- String1$ = "A BOX will first be created."
- String2$ = ""
- BEGIN DIALOG DispMessage2 25,70, 316, 70,Title$
- TEXT 4, 2, 310, 17, String1$
- TEXT 4, 20, 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
-
- .Box -1, -3.30613, -192.811, 170.015, 34.322, -160.002, 197.013
- .ZoomToAll
- .zoomout
-
-
-
- String1$ = "Three points will be specified to define the cutting plane."
- String2$ = ""
- BEGIN DIALOG DispMessage3 25,70, 316, 70,Title$
- TEXT 4, 2, 310, 17, String1$
- TEXT 4, 20, 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 Select First Point
- call cross(-3.30613, -160.002, 197.013)
- wait for 1
-
- REM Select Second Point
- call Doline(-3.30613, -160.002, 197.013,-3.30613, -192.811, 197.013)
- call cross(-3.30613, -192.811, 197.013)
- wait for 1
-
-
-
-
- REM Delete First Point
- .SelectWithinRegion -24.9238, -124.997, 170.015, 3.16183, -141.979, 170.015
- .deleteselection
- .SelectAll
-
- REM Select Third Point
- call doline(-3.30613, -192.811, 197.013,34.322, -192.811, 170.015)
- call cross(34.322, -192.811, 170.015)
- wait for 1
-
- REM Delete Second and Third Point
- .SelectWithinRegion -24.9238, -124.997, 170.015, 3.16183, -141.979, 170.015
- .DeleteSelection
- .SelectAll
- .SelectWithinRegion 22.4479, -182.696, 170.015, 46.479, -201.045, 170.015
- .DeleteSelection
- .SelectAll
-
- REM Draw Third Line
- call doline(34.322, -192.811, 170.015,-3.30613, -160.002, 197.013)
- wait for 1
-
- REM Erase Third Line
- .undo
-
- REM Erase Second and Third Point
- .ZoomToAll
- .SelectWithinRegion -13.9589, -187.766, 197.013, 7.35007, -198.833, 197.013
- .DeleteSelection
- .SelectWithinRegion 32.6205, -210.203, 197.013, 56.6211, -229.381, 197.013
- .DeleteSelection
- REM Draw Fourth and Fifth Line
- call doline(34.322, -192.811, 170.015,34.322, -160.002, 170.015)
- call doline(34.322, -160.002, 170.015,-3.30613, -160.002, 197.013)
-
-
-
- String1$ = "A fourth point will be set to specify the side of the object to be removed."
- String2$ = ""
- BEGIN DIALOG DispMessage4 25,70, 316, 70,Title$
- TEXT 4, 2, 310, 17, String1$
- TEXT 4, 20, 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
-
- call cross(34.322, -192.811, 197.013)
- wait for 1
- .SelectAll
- .DeleteSelection
- .Box -1, -3.30613, -192.811, 170.015, 34.322, -160.002, 197.013
- .ThreeDTrim -3.30613, -160.002, 197.013, -3.30613, -192.811, 197.013, 34.322, -192.811, 170.015, 34.322, -192.811, 197.013
- .ZoomToAll
- .SelectAll
- .SetEdgeRefinement 0, 6
- .SetSurfaceRefinement 2, 5
-
-
- String1$ = "A MATERIAL will now be applied to object."
- String2$ = "RENDERING may take a moment."
- BEGIN DIALOG DispMessage5 25,70, 316, 70,Title$
- TEXT 4, 2, 310, 17, String1$
- TEXT 4, 20, 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
-
- .ApplyMaterial "Woods", "Light Grain"
- .ShadeEntireView 0,0,3,0
-
- beep
- String1$ = "Use the 3D TRIM command when working with solids."
- String2$ = "Use the TRIM command when working with wireframes."
- BEGIN DIALOG EndMess 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
-
- 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
-