IPCB_GraphicalView interface
The graphical view of a PCB document: its 2D or 3D camera, its size, the conversion between screen and board coordinates, and rendering of the view into a device context.
public interface IPCB_GraphicalView
Namespace: PCB · Assembly: Altium.SDK.Interfaces
Remarks
Get the main graphical view of a board from IPCB_Board.MainGraphicalView. Some members depend on the graphics engine that draws the view: where an engine does not support a member, the member returns false or a fixed value and has no effect.
Properties
| Property | Type | Access | Description |
|---|---|---|---|
| AspectRatio | float | get | The aspect ratio of the view; always 1. |
| Camera | double | set | Sets the camera of the view, given the point it looks at, its orientation and its zoom. |
| CameraFov | float | set | Sets the field of view of the camera, in degrees. |
| CameraUpVector | float | set | Sets the up direction of the camera. |
| FoldingRate | float | get; set | The folding rate of a rigid-flex board in the view. |
| TemporaryWindow | int | set | Makes the view draw into a temporary window of the given client size, for example to render it at a size that differs from the view's window. |
| ViewMode | TPCBViewMode | get; set | The mode of the view, TPCBViewMode.vmGeneralPCB for normal editing or TPCBViewMode.vmEditBoardOutline while the board outline is being edited. |
| ViewPortMils | int | set | Sets the size of the board area that the view shows, keeping the center of the view. |
AspectRatio
The aspect ratio of the view; always 1.
float GetState_AspectRatio();
Type: float · Access: read-only
Camera
Sets the camera of the view, given the point it looks at, its orientation and its zoom.
bool SetState_Camera(float argLookAtX, float argLookAtY, float argLookAtZ, float argQuatX, float argQuatY, float argQuatZ, float argQuatW, double argZoom);
Type: double · Access: write-only · Index: argLookAtX (float): The X coordinate of the point the camera looks at., argLookAtY (float): The Y coordinate of the point the camera looks at., argLookAtZ (float): The Z coordinate of the point the camera looks at., argQuatX (float): The X component of the quaternion that gives the orientation of the camera., argQuatY (float): The Y component of the quaternion that gives the orientation of the camera., argQuatZ (float): The Z component of the quaternion that gives the orientation of the camera., argQuatW (float): The W component of the quaternion that gives the orientation of the camera.
The assigned value is the zoom of the camera. Read the current camera with GetState_Camera.
CameraFov
Sets the field of view of the camera, in degrees.
bool SetState_CameraFov(float argFov);
Type: float · Access: write-only
Read the current field of view with GetState_CameraFov.
CameraUpVector
Sets the up direction of the camera.
bool SetState_CameraUpVector(float argUpX, float argUpY, float argUpZ);
Type: float · Access: write-only · Index: argUpX (float): The X component of the up direction., argUpY (float): The Y component of the up direction.
The assigned value is the Z component of the direction. Depending on the graphics engine of the view, setting it has no effect; GetState_CameraUpVector then always returns (0, 1, 0).
FoldingRate
The folding rate of a rigid-flex board in the view.
float GetState_FoldingRate();
void SetState_FoldingRate(float argValue);
Type: float · Access: read/write
Depending on the graphics engine of the view, assigning it has no effect and it reads 0. It also reads 0 when the board has no bending lines to fold.
TemporaryWindow
Makes the view draw into a temporary window of the given client size, for example to render it at a size that differs from the view's window.
bool SetState_TemporaryWindow(int argWidth, int argHeight);
Type: int · Access: write-only · Index: argWidth (int): The client width of the temporary window, in pixels.
The assigned value is the client height of the temporary window, in pixels. Nothing happens when the width or the height is 0, or when the size equals the size of the view's window. Close the temporary window with CloseState_TemporaryWindow.
ViewMode
The mode of the view, TPCBViewMode.vmGeneralPCB for normal editing or TPCBViewMode.vmEditBoardOutline while the board outline is being edited.
TPCBViewMode GetState_ViewMode();
void SetState_ViewMode(TPCBViewMode argValue);
Type: TPCBViewMode · Access: read/write
The accessors are extension methods of IPCB_GraphicalViewHelper (using PCB;).
A new view is in TPCBViewMode.vmGeneralPCB.
ViewPortMils
Sets the size of the board area that the view shows, keeping the center of the view.
bool SetState_ViewPortMils(int argWidth, int argHeight);
Type: int · Access: write-only · Index: argWidth (int): The width of the area to show.
The assigned value is the height of the area to show. Despite the name, the size is in internal units (10,000 per mil). It has an effect only in 2D, and depending on the graphics engine of the view it has no effect at all.
Methods
| Method | Returns | Description |
|---|---|---|
| ClientToPCBLocation | void | Converts a point of the view's client area, in pixels, to a board location in internal units (10,000 per mil). |
| CloseState_TemporaryWindow | void | Closes the temporary window set with TemporaryWindow, so that the view draws into its own window again. |
| GetExtents_Camera | bool | Computes the camera position, zoom and size that frame the board in the view. |
| GetExtents_CameraIncludeComponents | bool | Computes the camera position, zoom and size that frame the board and the 3D models of its components. |
| GetState_Camera | bool | Gets the camera of the view, as the point it looks at, its orientation and its zoom. |
| GetState_CameraFov | bool | Gets the field of view of the camera, in degrees. |
| GetState_CameraUpVector | bool | Gets the up direction of the camera. |
| GetState_ViewPortMils | bool | Gets the size of the board area that the view shows. |
| GetState_WindowSize | bool | Gets the size of the view's client area, in pixels. |
| HasPausedProcess | bool | Whether an interactive process in the view is paused. |
| HasRunningProcess | bool | Whether an interactive editing process is running in the view. |
| InRoutingProcess | bool | Always returns false. |
| Is3D | bool | Whether the view shows the board in 3D, that is, whether its active view configuration is a 3D configuration. |
| PCBLocationToClient | void | Converts a board location in internal units (10,000 per mil) to a point of the view's client area, in pixels. |
| RenderToDC | void | Renders the view into a device context. |
| RenderToDCTransparent | void | Renders the view into a device context, with a transparent or an opaque background. |
| SetIs3D | void | |
| ZoomBoard | void | Zooms the view to fit the board and redraws it. |
ClientToPCBLocation
Converts a point of the view's client area, in pixels, to a board location in internal units (10,000 per mil).
void ClientToPCBLocation(int argx, int argy, out int argPX, out int argPY);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argx | int | value | The X coordinate of the point in the client area, in pixels. |
argy | int | value | The Y coordinate of the point in the client area, in pixels. |
argPX | int | out | Returns the X coordinate of the board location, in internal units (10,000 per mil). |
argPY | int | out | Returns the Y coordinate of the board location, in internal units (10,000 per mil). |
Returns: nothing (void)
CloseState_TemporaryWindow
Closes the temporary window set with TemporaryWindow, so that the view draws into its own window again.
void CloseState_TemporaryWindow();
Returns: nothing (void)
Does nothing when no temporary window is open.
GetExtents_Camera
Computes the camera position, zoom and size that frame the board in the view.
bool GetExtents_Camera(out float argLookAtX, out float argLookAtY, out float argLookAtZ, out double argZoom, out int argWidth, out int argHeight, bool argBoardFlipped);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argLookAtX | float | out | Returns the X coordinate of the center of the framed area. |
argLookAtY | float | out | Returns the Y coordinate of the center of the framed area. |
argLookAtZ | float | out | Returns the height of the board surface that the camera looks at. |
argZoom | double | out | Returns the zoom that fits the framed area into the view. |
argWidth | int | out | Returns the width of the framed area, in internal units (10,000 per mil). |
argHeight | int | out | Returns the height of the framed area, in internal units (10,000 per mil). |
argBoardFlipped | bool | value | Pass true to frame the board from its bottom side (argLookAtZ is then the bottom surface). |
Returns: bool
The framed area is the rectangle of the board outline. Returns true when the values were computed. Depending on the graphics engine of the view, returns false without computing them.
GetExtents_CameraIncludeComponents
Computes the camera position, zoom and size that frame the board and the 3D models of its components.
bool GetExtents_CameraIncludeComponents(out float argLookAtX, out float argLookAtY, out float argLookAtZ, out double argZoom, out int argWidth, out int argHeight, bool argBoardFlipped);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argLookAtX | float | out | Returns the X coordinate of the center of the framed area. |
argLookAtY | float | out | Returns the Y coordinate of the center of the framed area. |
argLookAtZ | float | out | Returns the height that the camera looks at. |
argZoom | double | out | Returns the zoom that fits the framed area into the view. |
argWidth | int | out | Returns the width of the framed area, in internal units (10,000 per mil). |
argHeight | int | out | Returns the height of the framed area, in internal units (10,000 per mil). |
argBoardFlipped | bool | value | Pass true to frame the board from its bottom side. |
Returns: bool
The framed area is the rectangle of the board outline, extended to include the 3D models on the board. Returns true when the values were computed; returns false when the view has no board.
GetState_Camera
Gets the camera of the view, as the point it looks at, its orientation and its zoom.
bool GetState_Camera(out float argLookAtX, out float argLookAtY, out float argLookAtZ, out float argQuatX, out float argQuatY, out float argQuatZ, out float argQuatW, out double argZoom);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argLookAtX | float | out | Returns the X coordinate of the point the camera looks at. |
argLookAtY | float | out | Returns the Y coordinate of the point the camera looks at. |
argLookAtZ | float | out | Returns the Z coordinate of the point the camera looks at. |
argQuatX | float | out | Returns the X component of the quaternion that gives the orientation of the camera. |
argQuatY | float | out | Returns the Y component of the quaternion that gives the orientation of the camera. |
argQuatZ | float | out | Returns the Z component of the quaternion that gives the orientation of the camera. |
argQuatW | float | out | Returns the W component of the quaternion that gives the orientation of the camera. |
argZoom | double | out | Returns the zoom of the camera. |
Returns: bool
Returns true. Set the camera with Camera.
GetState_CameraFov
Gets the field of view of the camera, in degrees.
bool GetState_CameraFov(out float argFov);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argFov | float | out | Returns the field of view in degrees. |
Returns: bool
Returns true.
GetState_CameraUpVector
Gets the up direction of the camera.
bool GetState_CameraUpVector(out float argUpX, out float argUpY, out float argUpZ);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argUpX | float | out | Returns the X component of the up direction. |
argUpY | float | out | Returns the Y component of the up direction. |
argUpZ | float | out | Returns the Z component of the up direction. |
Returns: bool
Returns true.
GetState_ViewPortMils
Gets the size of the board area that the view shows.
bool GetState_ViewPortMils(out int argWidth, out int argHeight);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argWidth | int | out | Returns the width of the shown area. |
argHeight | int | out | Returns the height of the shown area. |
Returns: bool
Despite the name, the size is in internal units (10,000 per mil). Returns true when the size was returned. Depending on the graphics engine of the view, returns false without returning a size.
GetState_WindowSize
Gets the size of the view's client area, in pixels.
bool GetState_WindowSize(out int argWidth, out int argHeight);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argWidth | int | out | Returns the width in pixels. |
argHeight | int | out | Returns the height in pixels. |
Returns: bool
Returns false when the width or the height is 0.
HasPausedProcess
Whether an interactive process in the view is paused.
bool HasPausedProcess();
Returns: bool
HasRunningProcess
Whether an interactive editing process is running in the view.
bool HasRunningProcess();
Returns: bool
InRoutingProcess
Always returns false.
bool InRoutingProcess();
Returns: bool
Is3D
Whether the view shows the board in 3D, that is, whether its active view configuration is a 3D configuration.
bool Is3D();
Returns: bool
PCBLocationToClient
Converts a board location in internal units (10,000 per mil) to a point of the view's client area, in pixels.
void PCBLocationToClient(int argx, int argy, out int argPX, out int argPY);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argx | int | value | The X coordinate of the board location, in internal units (10,000 per mil). |
argy | int | value | The Y coordinate of the board location, in internal units (10,000 per mil). |
argPX | int | out | Returns the X coordinate of the point in the client area, in pixels. |
argPY | int | out | Returns the Y coordinate of the point in the client area, in pixels. |
Returns: nothing (void)
RenderToDC
Renders the view into a device context.
void RenderToDC(UIntPtr argDC, int argResX, int argResY, Rect argDestRect, Rect argSrcRect);
void RenderToDC(object argDC, int argResX, int argResY, IRect argDestRect, IRect argSrcRect);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argDC | UIntPtr | value | |
argResX | int | value | The width, in pixels, of the image that is rendered. |
argResY | int | value | The height, in pixels, of the image that is rendered. |
argDestRect | Rect | value | |
argSrcRect | Rect | value |
Returns: nothing (void)
The first overload is an extension method of IPCB_GraphicalViewHelper (using PCB;) with typed parameters; the second is declared by the interface.
The same as RenderToDCTransparent with an opaque background.
RenderToDCTransparent
Renders the view into a device context, with a transparent or an opaque background.
void RenderToDCTransparent(UIntPtr argDC, int argResX, int argResY, Rect argDestRect, Rect argSrcRect, bool argTransparent);
void RenderToDCTransparent(object argDC, int argResX, int argResY, IRect argDestRect, IRect argSrcRect, bool argTransparent);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argDC | UIntPtr | value | |
argResX | int | value | The width, in pixels, of the image that is rendered. |
argResY | int | value | The height, in pixels, of the image that is rendered. |
argDestRect | Rect | value | |
argSrcRect | Rect | value | |
argTransparent | bool | value | True to blend the rendered image into the device context using its transparency, false to copy it. |
Returns: nothing (void)
The first overload is an extension method of IPCB_GraphicalViewHelper (using PCB;) with typed parameters; the second is declared by the interface.
SetIs3D
No description yet.
void SetIs3D(bool argValue);
| Parameter | Type | Passing |
|---|---|---|
argValue | bool | value |
Returns: nothing (void)
ZoomBoard
Zooms the view to fit the board and redraws it.
void ZoomBoard();
Returns: nothing (void)
Fits the rectangle of the board outline. Does nothing when the view has no board.