Callback methods
20.17. View Gadgets
20.17.6. Defining PLOT Views setup form !!MyForm
view .Diagram AT . . . PLOT height 20 width 40 exit
define method !!MyForm( ) -- form constructor method -- Initialise plot view gadget !this.diagram.borders = false
!this.diagram.background( ‘darkslate’ ) !this.diagram.add( ‘plot1-1’ )
endmethod
The area occupied by borders and scroll bars is within the area you specify for the gadget If the border is switched off, the actual display area expands to fill the available space. When borders are turned off, the PLOT view becomes fixed and you cannot zoom or pan within it. This may be useful if you are using PLOT views as if they were paragraphs; for example, as decoration or for information. To define the contents of the view specify the PLOTFILE pathname with the .add() method. To remove a PLOT from the current PLOT view, use the .clear() method. This will leave the view empty. If you want to replace the displayed PLOT with another one then just re-use the .add() method with the new PLOT file.
20.17.7. Defining DRAFT’s Area (2D) Views setup form !!MyForm . . .
view .DrawingAT . . .AREA height 20 width 40
put /SITE1/SHEET
limits 200 100 TO 600 500 exit
exit
define method !!MyForm( ) -- form constructor method -- Initialise AREA view gadget !this.drawing.borders = true !this.drawing.background( ‘beige’ ) !this.drawing.highlight( ‘red’ ) endmethod
The area occupied by borders and scroll bars is within the size you specify for the gadget. To define the colour items are displayed in when picked with the left-hand mouse button, use the .sethighlight() method with one of the standard DRAFT colour numbers or colournames. The contents of the view may be any valid 2D graphical element, such as a DRAFT SHEET, VIEW, LIBRARY, etc. To define the contents of the view, use the put command thus:
Command Effect
put CE Draws the current element
put /SITE1/SHEET Draws the named Sheet element
If you put new content into an area view that already contains a drawing, the original content will be replaced by the new, not added to it.
Note: There is currently no .put() method! So to replace the view contents you will need to use the old PML1 syntax:
The maximum limits for the drawing, such that only part of the specified content is drawn (giving, in effect, a window on the overall content area), may be set using the limits keyword as above or using the .limits() member in the form’s constructor method, as follows:
!box[1] = 200 !box[2] = 100 !box[3] = 600 !box[4] = 500
!this.drawing.limits = !box
where the limits define two opposite corners of the required area in sheet co-ordinates. For a full list of VIEW members and methods,
20.17.8. Defining DESIGN’s Volume (3D) Views setup form !!MyForm . . .
view .ModelAT . . .VOLUME height 20 width 40
limits auto look east 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 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.
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
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