VS:GetView

From Vectorworks Developer
Revision as of 11:08, 18 October 2016 by MaKro (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix

Description

Returns information about the current 3D view.
PROCEDURE GetView(
VAR xAngleR  :REAL;
VAR yAngleR  :REAL;
VAR zAngleR  :REAL;
VAR offsetX,offsetY,offsetZ  :REAL);
def vs.GetView():
    return (xAngleR, yAngelR, zAngleR, offset)

Parameters

xAngleR REAL Returns X rotation angle of view.
yAngleR REAL Returns Y rotation angle of view.
zAngleR REAL Returns Z rotation angle of view.
offset REAL Center of view rotation.

Remarks

Returns information about the current 3D view.

All parameters are for output:

xAngleR, the angle the view is rotated away from the x-axis
yAngleR, the angle the view is rotated away from the y-axis
zAngleR, the angle the view is rotated away from the z-axis
offsetX, Y, and Z, the center of the view

(MaKro, 2016.10.18):
Use GetProjection(ActLayer) == 6 and xyzAngleR == 0 to check if the view is Top/Plan

Example

VectorScript

PROCEDURE Example;
VAR
xAngleR, yAngleR, zAngleR, offsetX, offsetY, offsetZ :REAL;
BEGIN
GetView(xAngleR, yAngleR, zAngleR, offsetX, offsetY, offsetZ);
Message(xAngleR, ' ', yAngleR, ' ', zAngleR, ' ', offsetX, ' ', offsetY, ' ', offsetZ);
END;
RUN(Example);

Another example:

PROCEDURE Example;
VAR
xAngleR, yAngleR, zAngleR, offsetX, offsetY, offsetZ :REAL;
viewNameStr :STRING;
BEGIN
GetView(xAngleR, yAngleR, zAngleR, offsetX, offsetY, offsetZ);
IF (xAngleR =    0) & (yAngleR =    0)    & (zAngleR =    0) THEN viewNameStr := 'Top or Top/Plan'            ELSE
IF (xAngleR =  -90) & (yAngleR =    0)    & (zAngleR =    0) THEN viewNameStr := 'Front'                      ELSE
IF (xAngleR =  -90) & (yAngleR =  -90)    & (zAngleR =    0) THEN viewNameStr := 'Right'                      ELSE
IF (xAngleR =  180) & (yAngleR =    0)    & (zAngleR =    0) THEN viewNameStr := 'Bottom'                     ELSE
IF (xAngleR =   90) & (yAngleR =    0)    & (zAngleR =  180) THEN viewNameStr := 'Back'                       ELSE
IF (xAngleR =  -90) & (yAngleR =   90)    & (zAngleR =    0) THEN viewNameStr := 'Left'                       ELSE
IF (xAngleR =  -45) & Eq(yAngleR, -35, 1) & (zAngleR =  -30) THEN viewNameStr := 'Right Isometric'            ELSE
IF (xAngleR =  -45) & Eq(yAngleR,  35, 1) & (zAngleR =   30) THEN viewNameStr := 'Left Isometric'             ELSE
IF (xAngleR =   45) & Eq(yAngleR, -35, 1) & (zAngleR = -150) THEN viewNameStr := 'Right Rear Isometric'       ELSE
IF (xAngleR =   45) & Eq(yAngleR,  35, 1) & (zAngleR =  150) THEN viewNameStr := 'Left Rear Isometric'        ELSE
IF (xAngleR = -135) & Eq(yAngleR, -35, 1) & (zAngleR =   30) THEN viewNameStr := 'Lower Right Isometric'      ELSE
IF (xAngleR = -135) & Eq(yAngleR,  35, 1) & (zAngleR =  -30) THEN viewNameStr := 'Lower Left Isometric'       ELSE
IF (xAngleR =  135) & Eq(yAngleR, -35, 1) & (zAngleR =  150) THEN viewNameStr := 'Lower Right Rear Isometric' ELSE
IF (xAngleR =  135) & Eq(yAngleR,  35, 1) & (zAngleR = -150) THEN viewNameStr := 'Lower Left Rear Isometric';
Message(
xAngleR, ' ', 
yAngleR, ' ', 
zAngleR, '    ',
offsetX, ' ', 
offsetY, ' ', 
offsetZ, '  view name: ', 
viewNameStr);
END;
RUN(Example);

Python

def Example():
	xAngleR, yAngleR, zAngleR, offsetPt = vs.GetView()
	vs.Message(xAngleR, ' ', yAngleR, ' ', zAngleR, ' ', offsetPt[0], ' ', offsetPt[1], ' ', offsetPt[2])

Example()

Version

Availability: from VectorWorks8.0
Personal tools
NamespacesFFFF

Variants
Actions
Advanced Search
See Also
Navigation
Toolbox