Defining Design’s Volume (3D) Views
- Last UpdatedJan 09, 2024
- 4 minute read
setup form !!MyForm . . .
...
view .ModelAT . . .VOLUME
height 20 width 40
limits auto
look east
exit
...
exit
define method !!MyForm( )
-- form constructor method
...
-- initialize 3D view gadget
!this.model.borders = false
!this.model.background( ‘darkslate’ )
!this.model.shaded( true )
!this.model.projection( ‘PERSPECTIVE’ )
!this.model.radius( 100 )
!this.model.range( 500.0 )
!this.model.direction( !dir )
!this.model.eyemode( .false. )
!this.model.through( !thru )
!this.model.walkthrough( true )
!this.model.step( 25 )
...
endmethod
The area occupied by borders and sliders is within the area you specify for the gadget.
To enable colour-shaded representation use the .shaded() method. By default a wireline representation .shaded(false) is used.
All aspects of the 3D view transformation may be specified:
To enable PERSPECTIVE mode use the .projection(‘PERSPECTIVE’) method. By default the projection is PARALLEL.
The view direction is controlled via the 3D view’s .direction member. This is a 3 element array of REAL, representing a direction vector in model space ( DEAST, DNORTH, DUP ). So to look east you would specify:
!dir[1] = 1.0
!dir[2] = 0.0
!dir[3] = 0.0
!this.model.direction = !dir
The 3D view gadget labels the view direction information in 'ENU' (East-West, North-South, Up-Down) format within the view status line and scroll borders, by default. The LABELSTYLE member allows the user to specify either 'ENU' or 'XYZ' labelling. In the 'XYZ' scheme the form of the view direction display in the status line is x<bearing>y<elevation>z, where the bearing angle is in the range [-180, 180] and the elevation angle is in the range [-90, 90]. The corresponding scroll bars are labelled "-Y -X Y X -Y" and "-Z 0 Z".
The 3D view's bearing and elevation members can also be used to set the view direction (if the elevation is Up or Down then changing the bearing will have no effect on the view direction).
The centre of interest or through point of the 3D view is controlled via the .through member. This is a 3 element array of REAL, representing a position in model space (EAST, NORTH, UP).
!thru[1] = 1000.0
!thru[2] = 5600.5
!thru[3] = 500.0
!this.model.through = !thru
The .radius() method specifies the radius of the view in current units - an imaginary sphere around the through point.
The .range() method specifies how far away from the Through point you want the Eye point to be.
To enable WALKTHROUGH mode specify .walkthrough(true) together with the walking step size in current units using the .step() method.
For a full list of View Members and methods, refer to Software Customization Reference Manual for further information.
Setting Aspects of the View Transformation by Syntax
The commands below allow aspects of the view transformation to be set using the old syntax:
edit view !!MyForm.Model VOLUME
followed by one of the following modifiers:
|
Modifier |
Effect |
|---|---|
|
ELEVATION EAST |
Looks from the East. |
|
LOOK EAST |
Looks towards the East. |
|
LOOK N45W75D |
Looks towards specified direction. |
|
LOOK THROUGH E10 N50 U85 |
Looks through specified point. |
|
LOOK THROUGH /A1 |
Looks through named elements origin. |
|
LOOK THROUGH ID @ |
Prompts for cursor pick on Through-point. |
|
LOOK THROUGH ID VALV @ |
Prompts for cursor pick on Valve for through-point. |
|
LOOK FROM E10 N50 U85 |
looks from specified point (defines eye position) |
|
LOOK FROM /A1 |
Looks from named element (as eye position). |
|
LOOK FROM ID @ |
Prompts for cursor pick on from-point. |
|
LOOK FROM ID VALV @ |
Prompts for cursor-on Valve for from-point. |
|
LOOK TOWARDS E10 N50 U85 |
Looks towards the given direction. |
|
LOOK TOWARDS /A1 |
Looks towards named element . |
|
ISOMETRIC 3 |
Looks in specified isometric direction. |
|
PLAN |
Looks down (default). |
View Limits
Each volume view needs to know what region of the design model is to be displayed (the 3D view limits). The Design application has the notion of a current limits box. Unless you specify otherwise, the limits set for a new view gadget will default to the Design current limits box (as set by, say, the LIMITS or AUTOLIMITS commands in Design).
In addition, each volume view has an AUTO flag associated with it, which determines whether or not that view will be updated automatically whenever the Design current limits box is changed.
To define the view limits and the way in which they are to be updated, use the old syntax:
edit view !!MyForm.Model VOLUME
followed by one of
|
Modifier |
Effect |
|---|---|
|
LIMITS AUTO |
Display limits updated automatically to match current view limits (default). |
|
LIMITS LOCAL |
Display limits initially set to current view limits but not updated automatically. |
|
LIMITS LOCAL N1000 E2500 U0 TO N3000 E5000 U2000 |
Display limits initially set to specified positions and not updated automatically. |
|
LIMITS LOCAL /EQUI2 /EQUI4 |
Display limits initially set to enclose the specified elements and not updated automatically. |
You can set the limits box for a view, subject to the current AUTO flag using the .limits() method:
-- limits brick set as array of REAL [E1, E2, N1, N2, U1, U2]
!brick[1] = 1000.0
...
!brick[6] = 1560.4
!this.model.limits( !brick )
In Design you may change the current limits box at any time by using one of the command formats
AUTOLIMITS N1000 E2500 U0 TO N3000 E5000 U2000
AUTOLIMITS /EQUI2 /EQUI4
Any volume views which have LIMITS AUTO set will be redrawn to match the new limits.
Mousemode
3D views have a mousemode member which can be set to Zoom, Pan, Rotate, or Walk
Saving and Restoring 3D Views
3D views have two methods which are used to save and restore up to four views, until the user leaves Design:
!!view.saveview( !n )
!!view.restoreview( !n )
Where 1 <= !n <= 4.