Defining MODEL's Volume (3D) Views
- Last UpdatedJan 28, 2025
- 3 minute read
The 3D view gadget has three regions, namely the Drawing Area, the Status Line and the Borders.
The drawing area contains the picture.
The status line is below the picture and shows interactive feedback about the view parameters. For example:
n25w12d Pers<36 Model Rotate Fast
The borders contain the view sliders, which allow adjustment of the viewing direction via the bearing and elevation angles.
The status line and the borders can be turned on or off using the view properties StatusLine and Borders.
The status line must be displayed to be able to display the borders.
Note:
If you want the picture to completely fill the view, then define the form with NoPadding
and define the view with StatusLine off.
layout form !!MyForm . . .
...
view .ModelAT . . .VOLUME
height 20 width 40
limits auto
look east
StatusLine on
exit
...
exit
define method !!MyForm( )
-- form constructor method
...
-- Initialise 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 status line is within the area the use specifies for the gadget.
To enable color-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 you 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 center 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 the Software Customization Reference documentation.