Skip to main content
View as Markdown

IPCB_ComponentPainterView interface

A preview panel that displays a single PCB component (footprint) in 2D or 3D.

public interface IPCB_ComponentPainterView

Namespace: PCB · Assembly: Altium.SDK.Interfaces

Remarks​

IPCB_ServerInterface.CreateComponentPainter creates a new preview. The preview draws the component on a board of its own (GetDummyBoard), not on an open PCB document.

The preview uses one of two views. The DirectX view shows the component in 3D (or in 2D after SetDirectXMode); it is used only when DirectX can be used. Otherwise the preview uses a standard 2D view. A button on the panel lets the user switch between 2D and 3D.

SetCamera, SetCameraAngle, SetViewRect, SetVisibleLayer, SetAllLayersVisibilityState, KeyDown, RefreshView and ClearGraphicalObjects act on the DirectX view only and do nothing in the standard 2D view. SetVariantOption acts on the standard 2D view only.

Methods​

MethodReturnsDescription
ClearGraphicalObjectsvoidRemoves all graphical objects from the DirectX view of the preview.
ConfigViewvoidConfigures the preview from a string of named parameters.
GetDummyBoardIPCB_BoardReturns the board on which the preview places the component it displays.
KeyDownvoidPasses a key press to the DirectX view of the preview, so that a host form can forward keyboard input to it.
RefreshViewvoidRedraws the DirectX view of the preview.
SetAllLayersVisibilityStatevoidShows or hides all layers in the DirectX view of the preview.
SetCameravoidAims the camera of the DirectX view at a rectangle of the preview's board.
SetCameraAnglevoidSets the camera of the DirectX view from a point to look at, a rotation and a zoom factor.
SetComponentByHandlevoidDisplays a placed component in the preview.
SetComponentByHandle_1voidDisplays a library component (footprint) in the preview.
SetComponentByPathvoidLoads a footprint from a library file and displays it in the preview.
SetDirectXModevoidSwitches the preview to the DirectX view in 2D.
SetVariantOptionvoidApplies a variant option to the component displayed in the standard 2D view.
SetViewRectvoidCenters the DirectX view of the preview on a rectangle of the preview's board and resets the camera rotation.
SetVisibleLayervoidShows or hides a layer in the DirectX view of the preview.

ClearGraphicalObjects​

Removes all graphical objects from the DirectX view of the preview.

void ClearGraphicalObjects();

Returns: nothing (void)

ConfigView​

Configures the preview from a string of named parameters.

void ConfigView(string argParameters);
ParameterTypePassingDescription
argParametersstringvalueThe parameters, as name and value pairs.

Returns: nothing (void)

2DOnly=True switches the preview to the standard 2D view and hides the 2D/3D button; 3DOnly=True switches it to the DirectX view, when DirectX can be used, and hides the button. A value of False shows the button again without switching. When 2DOnly is given, 3DOnly is ignored. In the DirectX view, CameraYaw, CameraPitch and CameraRoll set the camera rotation, in degrees; angles that are not given keep their current values.

GetDummyBoard​

Returns the board on which the preview places the component it displays.

IPCB_Board GetDummyBoard();

Returns: IPCB_Board

Extension method of IPCB_ComponentPainterViewHelper (using PCB;).

The board belongs to the preview; it is not an open PCB document.

KeyDown​

Passes a key press to the DirectX view of the preview, so that a host form can forward keyboard input to it.

void KeyDown(ref ushort argKey, TShiftStateSet argShift);
void KeyDown(ref ushort argKey, ITransportSet argShift);
ParameterTypePassingDescription
argKeyushortrefThe key that was pressed; the preview can change it.
argShiftTShiftStateSetvalueThe state of the modifier keys.

Returns: nothing (void)

The first overload is an extension method of IPCB_ComponentPainterViewHelper (using PCB;) with typed parameters; the second is declared by the interface.

RefreshView​

Redraws the DirectX view of the preview.

void RefreshView();

Returns: nothing (void)

SetAllLayersVisibilityState​

Shows or hides all layers in the DirectX view of the preview.

void SetAllLayersVisibilityState(bool argVisible);
ParameterTypePassingDescription
argVisibleboolvalueTrue to show all layers, false to hide them.

Returns: nothing (void)

SetCamera​

Aims the camera of the DirectX view at a rectangle of the preview's board.

void SetCamera(int argLowX, int argLowY, int argHighX, int argHighY);
ParameterTypePassingDescription
argLowXintvalueThe left edge of the rectangle, in internal units (10,000 per mil).
argLowYintvalueThe bottom edge of the rectangle, in internal units (10,000 per mil).
argHighXintvalueThe right edge of the rectangle, in internal units (10,000 per mil).
argHighYintvalueThe top edge of the rectangle, in internal units (10,000 per mil).

Returns: nothing (void)

SetCameraAngle​

Sets the camera of the DirectX view from a point to look at, a rotation and a zoom factor.

void SetCameraAngle(double argLookAtX, double argLookAtY, double argLookAtZ, double argRotationX, double argRotationY, double argRotationZ, double argRotationW, double argZoomMultiplier);
ParameterTypePassingDescription
argLookAtXdoublevalueThe X coordinate of the point the camera looks at.
argLookAtYdoublevalueThe Y coordinate of the point the camera looks at.
argLookAtZdoublevalueThe Z coordinate of the point the camera looks at.
argRotationXdoublevalueThe X component of the camera rotation, a quaternion.
argRotationYdoublevalueThe Y component of the camera rotation, a quaternion.
argRotationZdoublevalueThe Z component of the camera rotation, a quaternion.
argRotationWdoublevalueThe W component of the camera rotation, a quaternion.
argZoomMultiplierdoublevalueThe zoom factor.

Returns: nothing (void)

SetComponentByHandle​

Displays a placed component in the preview.

void SetComponentByHandle(IPCB_Component argComponent);
void SetComponentByHandle(object argComponent);
ParameterTypePassingDescription
argComponentIPCB_ComponentvalueThe component to display.

Returns: nothing (void)

The first overload is an extension method of IPCB_ComponentPainterViewHelper (using PCB;) with typed parameters; the second is declared by the interface.

The preview displays copies of the component's primitives and of its designator, placed on the preview's own board; the component itself is not changed. The copies replace the component displayed before.

SetComponentByHandle_1​

Displays a library component (footprint) in the preview.

void SetComponentByHandle_1(IPCB_LibComponent argComponent);
void SetComponentByHandle_1(object argComponent);
ParameterTypePassingDescription
argComponentIPCB_LibComponentvalueThe footprint to display.

Returns: nothing (void)

The first overload is an extension method of IPCB_ComponentPainterViewHelper (using PCB;) with typed parameters; the second is declared by the interface.

The preview displays a copy of the footprint, which replaces the component displayed before; the footprint itself is not changed. Passing null does nothing.

SetComponentByPath​

Loads a footprint from a library file and displays it in the preview.

void SetComponentByPath(string argPattern, string argLibraryPath);
ParameterTypePassingDescription
argPatternstringvalueThe name of the footprint in the library.
argLibraryPathstringvalueThe path of the library file that contains the footprint.

Returns: nothing (void)

The footprint replaces the component displayed before.

SetDirectXMode​

Switches the preview to the DirectX view in 2D.

void SetDirectXMode();

Returns: nothing (void)

The preview recreates its view and hides and disables the 2D/3D button. When DirectX cannot be used, the preview keeps the standard 2D view.

SetVariantOption​

Applies a variant option to the component displayed in the standard 2D view.

void SetVariantOption(IVariantOption argVariantOption);
void SetVariantOption(object argVariantOption);
ParameterTypePassingDescription
argVariantOptionIVariantOptionvalueThe variant option to apply.

Returns: nothing (void)

The first overload is an extension method of IPCB_ComponentPainterViewHelper (using PCB;) with typed parameters; the second is declared by the interface.

The standard 2D view draws the component with the variant option's PCB display settings, such as the struck-through designator, the cross or mesh graphics and the variant text. The DirectX view ignores the variant option.

SetViewRect​

Centers the DirectX view of the preview on a rectangle of the preview's board and resets the camera rotation.

void SetViewRect(int argLowX, int argLowY, int argHighX, int argHighY);
ParameterTypePassingDescription
argLowXintvalueThe left edge of the rectangle, in internal units (10,000 per mil).
argLowYintvalueThe bottom edge of the rectangle, in internal units (10,000 per mil).
argHighXintvalueThe right edge of the rectangle, in internal units (10,000 per mil).
argHighYintvalueThe top edge of the rectangle, in internal units (10,000 per mil).

Returns: nothing (void)

SetVisibleLayer​

Shows or hides a layer in the DirectX view of the preview.

void SetVisibleLayer(V7_LayerBase argLayer, bool argbState);
void SetVisibleLayer(IV7_Layer argLayer, bool argbState);
ParameterTypePassingDescription
argLayerV7_LayerBasevalueThe layer.
argbStateboolvalueTrue to show the layer, false to hide it.

Returns: nothing (void)

The first overload is an extension method of IPCB_ComponentPainterViewHelper (using PCB;) with typed parameters; the second is declared by the interface.

Returned by​

IPCB_ServerInterface.CreateComponentPainter