Skip to main content
View as Markdown

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​

PropertyTypeAccessDescription
AspectRatiofloatgetThe aspect ratio of the view; always 1.
CameradoublesetSets the camera of the view, given the point it looks at, its orientation and its zoom.
CameraFovfloatsetSets the field of view of the camera, in degrees.
CameraUpVectorfloatsetSets the up direction of the camera.
FoldingRatefloatget; setThe folding rate of a rigid-flex board in the view.
TemporaryWindowintsetMakes 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.
ViewModeTPCBViewModeget; setThe mode of the view, TPCBViewMode.vmGeneralPCB for normal editing or TPCBViewMode.vmEditBoardOutline while the board outline is being edited.
ViewPortMilsintsetSets 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​

MethodReturnsDescription
ClientToPCBLocationvoidConverts a point of the view's client area, in pixels, to a board location in internal units (10,000 per mil).
CloseState_TemporaryWindowvoidCloses the temporary window set with TemporaryWindow, so that the view draws into its own window again.
GetExtents_CameraboolComputes the camera position, zoom and size that frame the board in the view.
GetExtents_CameraIncludeComponentsboolComputes the camera position, zoom and size that frame the board and the 3D models of its components.
GetState_CameraboolGets the camera of the view, as the point it looks at, its orientation and its zoom.
GetState_CameraFovboolGets the field of view of the camera, in degrees.
GetState_CameraUpVectorboolGets the up direction of the camera.
GetState_ViewPortMilsboolGets the size of the board area that the view shows.
GetState_WindowSizeboolGets the size of the view's client area, in pixels.
HasPausedProcessboolWhether an interactive process in the view is paused.
HasRunningProcessboolWhether an interactive editing process is running in the view.
InRoutingProcessboolAlways returns false.
Is3DboolWhether the view shows the board in 3D, that is, whether its active view configuration is a 3D configuration.
PCBLocationToClientvoidConverts a board location in internal units (10,000 per mil) to a point of the view's client area, in pixels.
RenderToDCvoidRenders the view into a device context.
RenderToDCTransparentvoidRenders the view into a device context, with a transparent or an opaque background.
SetIs3Dvoid
ZoomBoardvoidZooms 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);
ParameterTypePassingDescription
argxintvalueThe X coordinate of the point in the client area, in pixels.
argyintvalueThe Y coordinate of the point in the client area, in pixels.
argPXintoutReturns the X coordinate of the board location, in internal units (10,000 per mil).
argPYintoutReturns 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);
ParameterTypePassingDescription
argLookAtXfloatoutReturns the X coordinate of the center of the framed area.
argLookAtYfloatoutReturns the Y coordinate of the center of the framed area.
argLookAtZfloatoutReturns the height of the board surface that the camera looks at.
argZoomdoubleoutReturns the zoom that fits the framed area into the view.
argWidthintoutReturns the width of the framed area, in internal units (10,000 per mil).
argHeightintoutReturns the height of the framed area, in internal units (10,000 per mil).
argBoardFlippedboolvaluePass 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);
ParameterTypePassingDescription
argLookAtXfloatoutReturns the X coordinate of the center of the framed area.
argLookAtYfloatoutReturns the Y coordinate of the center of the framed area.
argLookAtZfloatoutReturns the height that the camera looks at.
argZoomdoubleoutReturns the zoom that fits the framed area into the view.
argWidthintoutReturns the width of the framed area, in internal units (10,000 per mil).
argHeightintoutReturns the height of the framed area, in internal units (10,000 per mil).
argBoardFlippedboolvaluePass 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);
ParameterTypePassingDescription
argLookAtXfloatoutReturns the X coordinate of the point the camera looks at.
argLookAtYfloatoutReturns the Y coordinate of the point the camera looks at.
argLookAtZfloatoutReturns the Z coordinate of the point the camera looks at.
argQuatXfloatoutReturns the X component of the quaternion that gives the orientation of the camera.
argQuatYfloatoutReturns the Y component of the quaternion that gives the orientation of the camera.
argQuatZfloatoutReturns the Z component of the quaternion that gives the orientation of the camera.
argQuatWfloatoutReturns the W component of the quaternion that gives the orientation of the camera.
argZoomdoubleoutReturns 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);
ParameterTypePassingDescription
argFovfloatoutReturns 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);
ParameterTypePassingDescription
argUpXfloatoutReturns the X component of the up direction.
argUpYfloatoutReturns the Y component of the up direction.
argUpZfloatoutReturns 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);
ParameterTypePassingDescription
argWidthintoutReturns the width of the shown area.
argHeightintoutReturns 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);
ParameterTypePassingDescription
argWidthintoutReturns the width in pixels.
argHeightintoutReturns 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);
ParameterTypePassingDescription
argxintvalueThe X coordinate of the board location, in internal units (10,000 per mil).
argyintvalueThe Y coordinate of the board location, in internal units (10,000 per mil).
argPXintoutReturns the X coordinate of the point in the client area, in pixels.
argPYintoutReturns 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);
ParameterTypePassingDescription
argDCUIntPtrvalue
argResXintvalueThe width, in pixels, of the image that is rendered.
argResYintvalueThe height, in pixels, of the image that is rendered.
argDestRectRectvalue
argSrcRectRectvalue

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);
ParameterTypePassingDescription
argDCUIntPtrvalue
argResXintvalueThe width, in pixels, of the image that is rendered.
argResYintvalueThe height, in pixels, of the image that is rendered.
argDestRectRectvalue
argSrcRectRectvalue
argTransparentboolvalueTrue 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);
ParameterTypePassing
argValueboolvalue

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.

Returned by​

IPCB_Board.MainGraphicalView