[Integration Kit Contents] [Integration Kit What's New] [Integration Kit Function Index] [More Documentation] [PTC]

Viewport Inquiries

sd-inq-vp-names
sd-inq-current-vp
sd-set-current-vp
sd-inq-vp-exists-p
sd-inq-vp-cursor-size

sd-inq-vp-corners
sd-inq-vp-maximized-p
sd-inq-vp-iconified-p
sd-resize-vp
sd-maximize-vp
sd-iconify-vp
sd-restore-vp
sd-get-window-placement
sd-set-window-placement
sd-store-window-placement
sd-restore-window-placement

sd-synchronize-vp
sd-desynchronize-vp

sd-inq-vp-bg-color
sd-set-vp-default-bg-color
sd-inq-vp-type2d-p
sd-inq-vp-frozen-p
sd-inq-vp-direction-axes

sd-inq-vp-capping-color
sd-set-vp-capping-color
sd-inq-vp-capping-color-status
sd-inq-vp-capping-status
sd-inq-vp-interference-status

sd-inq-vp-camera
sd-set-vp-camera

sd-inq-vp-clip-front-enabled-p
sd-inq-vp-clip-back-enabled-p

sd-inq-vp-light-autoupdate
sd-inq-vp-light-switch
sd-inq-vp-light-color
sd-inq-vp-light-type
sd-inq-vp-light-current
sd-inq-vp-light-brightness
sd-inq-vp-light-follow
sd-inq-vp-light-direction
sd-inq-vp-light-position
sd-inq-vp-light-attenuation
sd-inq-vp-light-attenuation-enabled-p
sd-inq-vp-light-spot
sd-inq-vp-light-spot-enabled-p
sd-inq-vp-light-cone

sd-inq-vp-show

sd-inq-vp-drawlist-locked-p
sd-inq-vp-drawlist-objects
sd-inq-vp-drawlist-member-p

sd-inq-vp-model-clipping-enabled-p

sd-get-last-vp-pick

Function Index Top of Page

SD-INQ-VP-NAMES  [function]

(sd-inq-vp-names)
Description:
Returns a list containing the names of all viewports currently defined.

Return value:
names {list of STRINGs}
the names of all viewports currently defined in the system

Function Index Top of Page

SD-INQ-CURRENT-VP  [function]

(sd-inq-current-vp)
Description:
Returns the name of the current viewport, the one with the active window frame.

Return value:
name {STRING} - Name of current viewport
nil - no current viewport available

Function Index Top of Page

SD-SET-CURRENT-VP  [function]

(sd-set-current-vp vport)
Description:
Makes the viewport vport the current viewport (active window frame).

Parameters:
vport {STRING} - the name of the viewport to make current

Return value:
t - success
nil - failure

Function Index Top of Page

SD-INQ-VP-EXISTS-P  [function]

(sd-inq-vp-exists-p vport)
Description:
Checks whether the specified viewport exists or not.

Parameters:
vport {STRING} - the name of the viewport to inquire

Return value:
t - if the viewport exists
nil - otherwise

Function Index Top of Page

SD-INQ-VP-CURSOR-SIZE  [function]

(sd-inq-vp-cursor-size)
Description:
Returns the size of the viewport cursor in pixels.

Return value:
size {FIXNUM} - the size in pixels of the viewport cursor cross-hair

Function Index Top of Page

SD-INQ-VP-CAPPING-COLOR  [function]

(sd-inq-vp-capping-color)
Description:
Returns the color used for capped faces.

Return value:
color {GPNT3D r,g,b vector}
the color used to display capped surfaces (i.e. surfaces trimmed by the intersection of a body with a clipping plane)

Function Index Top of Page

SD-INQ-VP-CAPPING-COLOR-STATUS  [function]

(sd-inq-vp-capping-color-status)
Description:
Returns whether capped faces are displayed or not.

Return value:
:on - if capped surfaces are displayed with the capping color
:off
if capped surfaces are displayed with the part color (i.e. the capping color is ignored)

Function Index Top of Page

SD-SET-VP-CAPPING-COLOR  [function]

(sd-set-vp-capping-color spec)
Description:
Sets the color to use for displaying capped surfaces (i.e. surfaces trimmed by the intersection of a body with a clipping plane).

Parameters:
spec - must be one of the following:
color {GPNT3D r,g,b vector}
color used to display capped surfaces
:off
the use of a capping color and just use the part color for capped surfaces
:on - the use of whatever capping color is currently set (the default)

Return value:
t - success
nil - failure

Function Index Top of Page

SD-INQ-VP-CORNERS  [function]

(sd-inq-vp-corners vport)
Description:
Gets the two corner points that define the size and location of the viewport.
The values include the border and the title bar of the viewport.

Parameters:
vport {STRING} - the name of the viewport to inquire

Return value:
corners {list of 2 GPNT2D screen coordinates} - the viewport corners

Function Index Top of Page

SD-INQ-VP-MAXIMIZED-P  [function]

(sd-inq-vp-maximized-p vport)
Description:
Determines whether or not the viewport is maximized.

Parameters:
vport {STRING} - the name of the viewport to inquire

Return value:
t - if the viewport is maximized
nil - if the viewport is not maximized

Function Index Top of Page

SD-INQ-VP-ICONIFIED-P  [function]

(sd-inq-vp-iconified-p vport)
Description:
Determines whether or not the viewport is iconified.

Parameters:
vport {STRING} - the name of the viewport to inquire

Return value:
t - if the viewport is iconified
nil - if the viewport is not iconified

Function Index Top of Page

SD-RESIZE-VP  [function]

(sd-resize-vp vport
                 :x x 
                 :y y 
                 :width width 
                 :height height)
Description:
Resizes the given viewport to the given size.
The values include the border and the title bar of the viewport.

Parameters:
vport {STRING} - the name of the viewport to resize
:x {FIXNUM} - the new position of the left border of the viewport
:y {FIXNUM} - the new position of the top border of the viewport
:width {FIXNUM} - the new width of the viewport
:height {FIXNUM} - the new height of the viewport

Return value:
t - to indicate success
nil - to indicate a failure

Function Index Top of Page

SD-MAXIMIZE-VP  [function]

(sd-maximize-vp vport)
Description:
Maximizes the given viewport.

Parameters:
vport {STRING} - the name of the viewport to maximize

Return value:
t - to indicate success
nil - to indicate a failure

Function Index Top of Page

SD-ICONIFY-VP  [function]

(sd-iconify-vp vport)
Description:
Iconifies the given viewport.

Parameters:
vport {STRING} - the name of the viewport to iconify

Return value:
t - to indicate success
nil - to indicate a failure

Function Index Top of Page

SD-RESTORE-VP  [function]

(sd-restore-vp vport)
Description:
Restores the normal size of a currently maximized or iconified viewport.

Parameters:
vport {STRING} - the name of the viewport to resize

Return value:
t - to indicate success
nil - to indicate a failure

Function Index Top of Page

SD-GET-WINDOW-PLACEMENT  [function]

(sd-get-window-placement viewport)
Description:
Returns the window placement data of the given viewport. These data can be passed to sd-set-window-placement to restore the size of a viewport to its current size.

Parameters:
vport {STRING} - the name of the viewport to inquire

Return value:
placement - {OPAQUE-STRUCTURE} - the placement data of this viewport
nil - to indicate a failure

Function Index Top of Page

SD-SET-WINDOW-PLACEMENT  [function]

(sd-set-window-placement viewport placement)
Description:
Restores the given viewport to the size stored in the given placement data. These data can be inquired by sd-get-window-placement.

Parameters:
vport {STRING} - the name of the viewport to inquire
placement {OPAQUE-STRUCTURE} - the placement data inquired by sd-get-window-placement

Return value:
t - to indicate success
nil - to indicate a failure

Function Index Top of Page

SD-STORE-WINDOW-PLACEMENT  [function]

(sd-store-window-placement viewport|:all)
Description:
Stores the current size of the given viewport or all viewports to be later restored by sd-restore-window-placement.

Parameters:
vport {STRING} - the name of the viewport to store the placement
:all - to store the placement of all currently existing viewports.

Return value:
t - to indicate success
nil - to indicate a failure

Function Index Top of Page

SD-RESTORE-WINDOW-PLACEMENT  [function]

(sd-restore-window-placement viewport|:all)
Description:
Restores the current size of the given viewport or all viewports to the size being stored upon calling sd-store-window-placement.

Parameters:
vport {STRING} - the name of the viewport to restore the placement
:all - to restore the placement of all currently existing viewports.

Return value:
t - to indicate success
nil - to indicate a failure

Function Index Top of Page

SD-SYNCHRONIZE-VP  [function]

(sd-synchronize-vp vport1 vport2)
Description:
Synchronizes the model view of both viewports. Every change of the view in one viewport is applied to the other viewport as well. The order of the given viewports is not important.

NOTE: Make sure to desynchronize the viewports using the function sd-desynchronize-vp before one of them gets deleted. Otherwise the system becomes unstable!

Parameters:
vport1 {STRING} - name of viewport 1
vport2 {STRING} - name of viewport 2

Return value:
t - success
nil - failure

Function Index Top of Page

SD-DESYNCHRONIZE-VP  [function]

(sd-desynchronize-vp)
Description:
Desynchronize the viewports which were synchronized with function sd-synchronize-vp.

Return value:
t - success
nil - failure

Function Index Top of Page

SD-INQ-VP-BG-COLOR  [function]

(sd-inq-vp-bg-color vport)
Description:
Returns the background color of the viewport. The return value depends on the color definition of the viewport, i.e. either a single value for viewports with just one color or a list of two or three color values in case of a gradient background.

Parameters:
vport {STRING} - the name of the viewport to inquire

Return value:
color {GPNT3D r,g,b vector}
The background color of the viewport if it has just one single color
(color1 color2) {LIST of 2 GPNT3D r,g,b vectors}
Color1 and color2 of a two color gradient background
(color1 color2 color3) {LIST of 3 GPNT3D r,g,b vectors}
Color1, color2 and color3 of a three color gradient background

Function Index Top of Page

SD-SET-VP-DEFAULT-BG-COLOR  [function]

(sd-set-vp-default-bg-color color1 &optional color2 color3)
Description:
Sets the default background color for all new viewports.

Parameters:
color1 {GPNT3D r,g,b vector}
If given as only parameter, this color will become the single viewport background color. If more colors are specified, this color becomes the top color of the gradient.
color2 {GPNT3D r,g,b vector}
If given and no third color given, this color specifies the second color (bottom color) of a two color gradient, otherwise the middle color of a three color gradient.
color3 {GPNT3D r,g,b vector}
If given, this color specifies the third (bottom) color of a three color gradient.

Return value:
t - success
nil - failure

Function Index Top of Page

SD-INQ-VP-TYPE2D-P  [function]

(sd-inq-vp-type2d-p vport)
Description:
Determines the type of the viewport (2d or 3d).

Parameters:
vport {STRING} - the name of the viewport to inquire

Return value:
t - if vport is a 2d layout viewport
nil - if vport is a 3d viewport

Function Index Top of Page

SD-INQ-VP-FROZEN-P  [function]

(sd-inq-vp-frozen-p vport)
Description:
Determines whether or not the viewport is frozen (which means that redraws are suppressed).

Parameters:
vport {STRING} - the name of the viewport to inquire

Return value:
t - if the viewport is frozen
nil - if the viewport is not frozen

Function Index Top of Page

SD-INQ-VP-DIRECTION-AXES  [function]

(sd-inq-vp-direction-axes vport)
Description:
Determines whether or not the viewport's direction axes indicator is displayed.

Parameters:
vport {STRING} - the name of the viewport to inquire

Return value:
:on - if the viewport's direction axes indicator is displayed
:off - if it is not

Function Index Top of Page

SD-INQ-VP-CAMERA  [function]

(sd-inq-vp-camera vport)
Description:
Returns a structure (camera) that completely defines the viewing orientation of a viewport.

Return value:
camera {SD-VP-CAMERA-STRUCT}
the structure containing the camera settings, which is defined as follows:
(defstruct sd-vp-camera-struct
  (from-pt    nil :type gpnt3d)
  (to-pt      nil :type gpnt3d)
  (up-dir     nil :type gpnt3d)
  (back-clip  0   :type long-float)
  (front-clip 0   :type long-float)
  (projection 0   :type long-float)
  (view-field 0   :type long-float)
)

Parameters:
vport {STRING} - the name of the viewport to inquire

Function Index Top of Page

SD-SET-VP-CAMERA  [function]

(sd-set-vp-camera vport camera :smooth flag)
Description:
Specifies the viewing orientation (camera) of a viewport.

Parameters:
vport {STRING} - the name of the viewport to set
camera {SD-VP-CAMERA-STRUCT}
the structure containing the camera settings, which is defined as follows:
(defstruct sd-vp-camera-struct
  (from-pt    nil :type gpnt3d)
  (to-pt      nil :type gpnt3d)
  (up-dir     nil :type gpnt3d)
  (back-clip  0   :type long-float)
  (front-clip 0   :type long-float)
  (projection 0   :type long-float)
  (view-field 0   :type long-float)
)
  
:smooth {BOOLEAN} - indicates if the camera change should be smooth or immediate

Return value:
t - success
nil - failure

Function Index Top of Page

SD-INQ-VP-CLIP-FRONT-ENABLED-P  [function]

(sd-inq-vp-clip-front-enabled-p vport)
Parameters:
vport {STRING} - the name of the viewport to inquire

Return value:
t - if the front clipping plane is turned on
nil - if the front clipping plane is off

Function Index Top of Page

SD-INQ-VP-CLIP-BACK-ENABLED-P  [function]

(sd-inq-vp-clip-back-enabled-p vport)
Parameters:
vport {STRING} - the name of the viewport to inquire

Return value:
t - if the back clipping plane is turned on
nil - if the back clipping plane is off

Function Index Top of Page

SD-INQ-VP-CAPPING-STATUS  [function]

(sd-inq-vp-capping-status vport)
Parameters:
vport {STRING} - the name of the viewport to inquire

Return value:
:on - if capping is enabled
:off - if it is not

Function Index Top of Page

SD-INQ-VP-INTERFERENCE-STATUS  [function]

(sd-inq-vp-interference-status vport)
Parameters:
vport {STRING} - the name of the viewport to inquire

Return value:
:on - if interference is enabled
:off - if it is not

Function Index Top of Page

SD-INQ-VP-LIGHT-AUTOUPDATE  [function]

(sd-inq-vp-light-autoupdate vport)
Parameters:
vport {STRING} - the name of the viewport to inquire

Return value:
:on - if autoupdate is enabled
:off - if it is not

Function Index Top of Page

SD-INQ-VP-LIGHT-SWITCH  [function]

(sd-inq-vp-light-switch vport light)
Parameters:
vport {STRING} - the name of the viewport to inquire
light {FIXNUM from 0 to 15} - the number of the light to inquire

Return value:
:on - if the light is turned on
:off - if it is off

Function Index Top of Page

SD-INQ-VP-LIGHT-COLOR  [function]

(sd-inq-vp-light-color vport light)
Parameters:
vport {STRING} - the name of the viewport to inquire
light {FIXNUM from 0 to 15} - the number of the light to inquire

Return value:
color {GPNT3D r,g,b vector} - the color of the light

Function Index Top of Page

SD-INQ-VP-LIGHT-TYPE  [function]

(sd-inq-vp-light-type vport light)
Parameters:
vport {STRING} - the name of the viewport to inquire
light {FIXNUM from 0 to 15} - the number of the light to inquire

Return value:
:ambient - if the light is ambient (always and only true for light number 0)
:positional - if it is a positional light
:spot - if it is a spot light
:directional - if it is a directional light

Function Index Top of Page

SD-INQ-VP-LIGHT-CURRENT  [function]

(sd-inq-vp-light-current vport)
Parameters:
vport {STRING} - the name of the viewport to inquire
light {FIXNUM from 0 to 15} - the number of the light to inquire

Return value:
current-light {FIXNUM from 0 to 15} - the number of the current light

Function Index Top of Page

SD-INQ-VP-LIGHT-BRIGHTNESS  [function]

(sd-inq-vp-light-brightness vport light)
Parameters:
vport {STRING} - the name of the viewport to inquire
light {FIXNUM from 0 to 15} - the number of the light to inquire

Return value:
brightness {SHORT-FLOAT} - the brightness of the light

Function Index Top of Page

SD-INQ-VP-LIGHT-FOLLOW  [function]

(sd-inq-vp-light-follow vport light)
Parameters:
vport {STRING} - the name of the viewport to inquire
light {FIXNUM from 0 to 15} - the number of the light to inquire

Return value:
:viewer
if the light source maintains the same direction relative to the viewer as the view orientation is changed
:fixed - if the light source's position is fixed

Function Index Top of Page

SD-INQ-VP-LIGHT-DIRECTION  [function]

(sd-inq-vp-light-direction vport light)
Parameters:
vport {STRING} - the name of the viewport to inquire
light {FIXNUM from 0 to 15} - the number of the light to inquire

Return value:
direction {GPNT3D unit vector} - the direction of the light
nil - if the light is non-directional (i.e. positional)

Function Index Top of Page

SD-INQ-VP-LIGHT-POSITION  [function]

(sd-inq-vp-light-position vport light)
Parameters:
vport {STRING} - the name of the viewport to inquire
light {FIXNUM from 0 to 15} - the number of the light to inquire

Return value:
direction {GPNT3D global coordinate} - the location of the light
nil - if the light is non-positional (i.e. directional)

Function Index Top of Page

SD-INQ-VP-LIGHT-ATTENUATION  [function]

(sd-inq-vp-light-attenuation vport light)
Parameters:
vport {STRING} - the name of the viewport to inquire
light {FIXNUM from 0 to 15} - the number of the light to inquire

Return value:
attenuation {LONG-FLOAT > 0.0} - the attenuation factor of the light

Function Index Top of Page

SD-INQ-VP-LIGHT-ATTENUATION-ENABLED-P  [function]

(sd-inq-vp-light-attenuation-enabled-p vport light)
Parameters:
vport {STRING} - the name of the viewport to inquire
light {FIXNUM from 0 to 15} - the number of the light to inquire

Return value:
t - if attenuation is enabled for this light
nil - if attenuation is disabled

Function Index Top of Page

SD-INQ-VP-LIGHT-SPOT  [function]

(sd-inq-vp-light-spot vport light)
Parameters:
vport {STRING} - the name of the viewport to inquire
light {FIXNUM from 0 to 15} - the number of the light to inquire

Return value:
spot-power {FIXNUM from 1 to 16383} - the spot power of the light

Function Index Top of Page

SD-INQ-VP-LIGHT-SPOT-ENABLED-P  [function]

(sd-inq-vp-light-spot-enabled-p vport light)
Parameters:
vport {STRING} - the name of the viewport to inquire
light {FIXNUM from 0 to 15} - the number of the light to inquire

Return value:
t - if the spot power is enabled
nil - if it is disabled

Function Index Top of Page

SD-INQ-VP-LIGHT-CONE  [function]

(sd-inq-vp-light-cone vport light)
Parameters:
vport {STRING} - the name of the viewport to inquire
light {FIXNUM from 0 to 15} - the number of the light to inquire

Return value:
cone-angle {SHORT-FLOAT angle in radians}
the cone angle of the light if it is a spot light

Function Index Top of Page

SD-INQ-VP-SHOW  [function]

(sd-inq-vp-show vport option)
Description:
Returns the current setting of parameters which control the visual appearance of elements being shown in the viewport.

Parameters:
vport {STRING} - the name of the viewport to inquire
option - must be one of the following:
:3dgeo - specifies 3D geometry
:3dgeo_edged - specifies 3D edges
:3dgeo_face_color - specifies 3D faces will be drawn with face color
:3dgeo_face_reflectance
specified 3D faces will be drawn with face reflectance properties
:3dgeo_face_transparency
specifies 3D faces will be drawn with face transparency
:3dgeo_edge_color - specifies 3D edges will be drawn with edge color
:3dgeo_hidden - specifies 3D hidden edges
:3dgeo_hidden_dimmed - specifies 3D hidden edges will be drawn with
dimmed edge color
:3dgeo_label - specifies 3D labeling
:3dgeo_mixed - specifies 3D that mixed settings attached are used to
control the appearance of 3D geometry
:3dgeo_part_reflectance
specifies 3D faces will be drawn with part reflectance properties
:3dgeo_part_transparency
specifies 3D faces will be drawn with part transparency
:3dgeo_shaded - specifies 3D shaded geometry
:3dgeo_vertices - specifies 3D vertices
:3dgeo_wire - specifies 3D wire edges
:clip_planes - specifies model clip plane feedback
:coord_system - specifies coordinate systems
:docu_planes - specifies docu planes
:feature_pts - specifies feature points
:workplane_sets_match_lines - specifies workplane set match lines
:workplanes - specifies workplanes
:workplanes_border - specifies workplane borders
:workplanes_hidden - specifies hidden workplanes
:workplanes_label - specifies workplane labeling
:workplanes_local_axis - specifies workplanes local axis
:workplanes_2dgeo - specifies a workplane's 2D geometry
:workplanes_2dconstruction - specifies a workplane's 2D construction
:workplanes_2dgeo_label - specifies a workplane's 2D labeling
:workplanes_2dgeo_vertices - specifies a workplane's 2D vertices
:layouts - specifies layouts
:layout_view_border - specifies layout borders
:layout_view_label - specifies layout view labels

Return value:
:on - if the show option is turned on
:off - if it is turned off

Function Index Top of Page

SD-INQ-VP-DRAWLIST-LOCKED-P  [function]

(sd-inq-vp-drawlist-locked-p vport)
Parameters:
vport {STRING} - the name of the viewport to inquire

Return value:
t - if the drawlist of vport is locked
nil - if it is not locked

Function Index Top of Page

SD-INQ-VP-DRAWLIST-OBJECTS  [function]

(sd-inq-vp-drawlist-objects vport)
Parameters:
vport {STRING} - the name of the viewport to inquire

Return value:
objects {list of SEL_ITEMs}
the list of objects that are currently visible in the viewport.

Function Index Top of Page

SD-INQ-VP-DRAWLIST-MEMBER-P  [function]

(sd-inq-vp-drawlist-member-p vport obj)
Parameters:
vport {STRING} - the name of the viewport to inquire
obj {SEL_ITEM} - the object to inquire if it is visible in the viewport

Return value:
t - if obj is visible in the drawlist
nil - if it is not

Function Index Top of Page

SD-INQ-VP-MODEL-CLIPPING-ENABLED-P  [function]

(sd-inq-vp-model-clipping-enabled-p vport)
Description:
Determines whether model clipping is enabled for the specified viewport.

Parameters:
vport {STRING} - the name of the viewport to inquire

Return value:
t - if model clipping is enabled
nil - if model clipping is disabled

Function Index Top of Page

SD-GET-LAST-VP-PICK  [function]

(sd-get-last-vp-pick)
Description:
Use this function ONLY in accelerator functions like button down, button up or other key accelerator functions which are related to viewports as defined in corp_keys.lsp.
As an example: While holding the SHIFT and CTRL buttons down and you pick a 2D edge, you want to catch to its center automatically. To do this the following code is defined in corp_keys.lsp:
  (defun ShiftControlButton1 (&rest args)
    (declare (ignore args))
    (oli:sd-put-buffer "set_catch_parameters :next_catch")
    (oli:sd-put-buffer "set_catch_parameters :center")
    (oli:sd-put-buffer (oli:sd-get-last-vp-pick)))
This function returns the pick only in such cases where a LISP function is executed while the mouse pointer was pressed, released or hovered over a viewport (mouse callback functions while the mouse was over a viewport). In all other cases the return value of this function is undefined.
You can call this function also from commands which are called from a viewport context menu. I.e. the right-click in the viewport will be returned as viewport pick by this function.

Parameters:

Return value:
vp-pick {gpntwc} - the viewport pick
[Integration Kit Contents] [Integration Kit What's New] [Integration Kit Function Index] [More Documentation] [PTC]
© 2023 Parametric Technology GmbH
(a subsidiary of PTC Inc.), All Rights Reserved