Skip to main content
View as Markdown

IPCB_Model interface

The 3D model of a component body (IPCB_ComponentBody), one of an extruded shape, a cylinder, a sphere or a generic model.

public interface IPCB_Model : IPCB_ModelProperties_Base

Namespace: PCB · Assembly: Altium.SDK.Interfaces

Inherits: IPCB_ModelProperties_Base

Remarks​

A model is created by one of the component body's model factory methods, such as IPCB_ComponentBody.ModelFactory_FromFilename or IPCB_ComponentBody.ModelFactory_CreateExtruded, and assigned to the body with IPCB_ComponentBody.Model.

Properties​

PropertyTypeAccessDescription
Embedboolget; setWhether the model data is embedded in the document.
ItemGUIDstringget; setThe GUID of the server item that the model is linked to.
ItemRevisionGUIDstringget; setThe GUID of the server item revision that the model is linked to.
ModelSourceTModelSourceget; setWhere the model comes from, a file (TModelSource.eModelSource_File) or a server (TModelSource.eModelsource_Vault).
ModelTypeT3DModelTypeget; setThe kind of model, extruded, generic, cylinder or sphere.
OriginCoordPointget; setThe origin of the model, in internal units (10,000 per mil).
Rotationdoubleget; setThe rotation of the model, in degrees.
VaultGUIDstringget; setThe GUID of the server (vault) that the model was taken from.

Embed​

Whether the model data is embedded in the document.

bool GetEmbed();
void SetEmbed(bool argValue);

Type: bool · Access: read/write

For cylinder and sphere models, assigning a value has no effect.

ItemGUID​

The GUID of the server item that the model is linked to.

string GetItemGUID();
void SetItemGUID(string argValue);

Type: string · Access: read/write

ItemRevisionGUID​

The GUID of the server item revision that the model is linked to.

string GetItemRevisionGUID();
void SetItemRevisionGUID(string argValue);

Type: string · Access: read/write

ModelSource​

Where the model comes from, a file (TModelSource.eModelSource_File) or a server (TModelSource.eModelsource_Vault).

TModelSource GetModelSource();
void SetModelSource(TModelSource argValue);

Type: TModelSource · Access: read/write

The accessors are extension methods of IPCB_ModelHelper (using PCB;).

ModelType​

The kind of model, extruded, generic, cylinder or sphere.

T3DModelType GetState_ModelType();
void SetState_ModelType(T3DModelType argValue);

Type: T3DModelType · Access: read/write

The accessors are extension methods of IPCB_ModelHelper (using PCB;).

See also: T3DModelType

Origin​

The origin of the model, in internal units (10,000 per mil).

CoordPoint GetOrigin();
void SetOrigin(CoordPoint argValue);

Type: CoordPoint · Access: read/write

The accessors are extension methods of IPCB_ModelHelper (using PCB;).

Rotation​

The rotation of the model, in degrees.

double GetRotation();
void SetRotation(double argNewValue);

Type: double · Access: read/write

Assigning Rotation changes only this angle; SetState sets the rotations about the three axes and the offset along the Z axis.

VaultGUID​

The GUID of the server (vault) that the model was taken from.

string GetVaultGUID();
void SetVaultGUID(string argValue);

Type: string · Access: read/write

Methods​

MethodReturnsDescription
AddTovoidAdds the model's geometry to the given 3D view, with the given transformation and name.
AddToAssemblyvoidAdds the model's geometry to the given assembly of a 3D view, with the given transformation and name.
AddToAssembly2voidAdds the model's geometry to the given assembly of a 3D view, with the given transformation, name and colour.
ExportToStepvoidWrites the model's 3D geometry to a STEP file.
ForceCheck_IsStaleboolChecks again whether the file the model data was loaded from has changed, and returns the result.
GetChecksumuintReturns the checksum of the model data.
GetDataHashstringReturns the checksum of the model data as a decimal string.
GetDataSizelongReturns the size of the model data.
GetFileNamestringReturns the name of the file the model data was loaded from.
GetStatevoidReturns the model's rotation about the X, Y and Z axes and its offset along the Z axis.
I_ReplicateIPCB_ModelReturns a copy of the model, of the same model type.
I_ReplicateToGenericIPCB_ModelReturns a copy of the model as a generic model (T3DModelType.e3DModelType_Generic).
IsEmptyboolReturns whether the model has no model data.
IsStaleboolReturns whether the file the model data was loaded from is known to have changed.
SetStatevoidSets the model's rotation about the X, Y and Z axes and its offset along the Z axis.

AddTo​

Adds the model's geometry to the given 3D view, with the given transformation and name.

void AddTo(IOccWrapper argViewWrapper, IPCB3D_Transformation argITransformation, string argName);
void AddTo(object argViewWrapper, object argITransformation, string argName);
ParameterTypePassing
argViewWrapperIOccWrappervalue
argITransformationIPCB3D_Transformationvalue
argNamestringvalue

Returns: nothing (void)

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

AddToAssembly​

Adds the model's geometry to the given assembly of a 3D view, with the given transformation and name.

void AddToAssembly(IOccWrapper argViewWrapper, int argssemblyIndex, IPCB3D_Transformation argITransformation, string argName);
void AddToAssembly(object argViewWrapper, int argssemblyIndex, object argITransformation, string argName);
ParameterTypePassing
argViewWrapperIOccWrappervalue
argssemblyIndexintvalue
argITransformationIPCB3D_Transformationvalue
argNamestringvalue

Returns: nothing (void)

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

AddToAssembly2​

Adds the model's geometry to the given assembly of a 3D view, with the given transformation, name and colour.

void AddToAssembly2(IOccWrapper argViewWrapper, int argssemblyIndex, IPCB3D_Transformation argITransformation, string argName, uint argColor);
void AddToAssembly2(object argViewWrapper, int argssemblyIndex, object argITransformation, string argName, uint argColor);
ParameterTypePassingDescription
argViewWrapperIOccWrappervalue
argssemblyIndexintvalue
argITransformationIPCB3D_Transformationvalue
argNamestringvalue
argColoruintvalueThe colour applied to the added geometry.

Returns: nothing (void)

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

ExportToStep​

Writes the model's 3D geometry to a STEP file.

void ExportToStep(string argFileName);
ParameterTypePassingDescription
argFileNamestringvalueThe path of the STEP file to write. When it is an empty string, nothing is written.

Returns: nothing (void)

ForceCheck_IsStale​

Checks again whether the file the model data was loaded from has changed, and returns the result.

bool ForceCheck_IsStale();

Returns: bool

The file named by GetFileName is read and its checksum is compared with that of the model data. A model found stale stays stale; otherwise the method returns false when the file cannot be opened or its path is relative. Returns true for a model without model data. IsStale returns the stored result without reading the file.

GetChecksum​

Returns the checksum of the model data.

uint GetChecksum();

Returns: uint

Returns 0 for a model without model data.

GetDataHash​

Returns the checksum of the model data as a decimal string.

string GetDataHash(string argHashType);
ParameterTypePassingDescription
argHashTypestringvalueMust be an empty string; any other value raises an error, because named hash algorithms are not supported.

Returns: string

Returns an empty string for a model without model data.

GetDataSize​

Returns the size of the model data.

long GetDataSize();

Returns: long

Returns 0 for a model without model data.

GetFileName​

Returns the name of the file the model data was loaded from.

string GetFileName();

Returns: string

Returns an empty string for a model without model data.

GetState​

Returns the model's rotation about the X, Y and Z axes and its offset along the Z axis.

void GetState(out double argRotX, out double argRotY, out double argRotZ, out int argDz);
ParameterTypePassingDescription
argRotXdoubleoutReceives the rotation about the X axis, in degrees.
argRotYdoubleoutReceives the rotation about the Y axis, in degrees.
argRotZdoubleoutReceives the rotation about the Z axis, in degrees.
argDzintoutReceives the offset along the Z axis, in internal units (10,000 per mil).

Returns: nothing (void)

All four values are 0 for a model without model data.

I_Replicate​

Returns a copy of the model, of the same model type.

IPCB_Model I_Replicate();

Returns: IPCB_Model

Extension method of IPCB_ModelHelper (using PCB;).

I_ReplicateToGeneric​

Returns a copy of the model as a generic model (T3DModelType.e3DModelType_Generic).

IPCB_Model I_ReplicateToGeneric();

Returns: IPCB_Model

Extension method of IPCB_ModelHelper (using PCB;).

Embed of the copy is true. The SDK examples use it to replace a model that is not generic, such as an extruded one, by assigning the copy to the body's IPCB_ComponentBody.Model.

IsEmpty​

Returns whether the model has no model data.

bool IsEmpty();

Returns: bool

IsStale​

Returns whether the file the model data was loaded from is known to have changed.

bool IsStale();

Returns: bool

The method returns the stored result and does not read the file; ForceCheck_IsStale checks the file again. Returns false for a model without model data.

SetState​

Sets the model's rotation about the X, Y and Z axes and its offset along the Z axis.

void SetState(double argRotX, double argRotY, double argRotZ, int argDz);
ParameterTypePassingDescription
argRotXdoublevalueThe rotation about the X axis, in degrees.
argRotYdoublevalueThe rotation about the Y axis, in degrees.
argRotZdoublevalueThe rotation about the Z axis, in degrees.
argDzintvalueThe offset along the Z axis, in internal units (10,000 per mil).

Returns: nothing (void)

Does nothing for a model without model data. An angle outside the range 0 to 360 is brought into the range -180 to 180 by whole turns. The SDK examples call it on a new model before assigning the model to the body with IPCB_ComponentBody.Model.

Examples: Extension_CreatePCBLib

Returned by​

IPCB_ComponentBody.Model, IPCB_ComponentBody.ModelFactory_Create, IPCB_ComponentBody.ModelFactory_CreateCylinder, IPCB_ComponentBody.ModelFactory_CreateExtruded, IPCB_ComponentBody.ModelFactory_CreateSphere, IPCB_ComponentBody.ModelFactory_FromFilename, IPCB_ComponentBody.ModelFactory_FromVault

Accepted by​

IPCB_ComponentBody.ModelFactory_Destroy, IPCB_ComponentBody.ModelFactory_Replace

Examples​

Used in the SDK examples: Extension_CreatePCBLib.