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
| Property | Type | Access | Description |
|---|---|---|---|
| Embed | bool | get; set | Whether the model data is embedded in the document. |
| ItemGUID | string | get; set | The GUID of the server item that the model is linked to. |
| ItemRevisionGUID | string | get; set | The GUID of the server item revision that the model is linked to. |
| ModelSource | TModelSource | get; set | Where the model comes from, a file (TModelSource.eModelSource_File) or a server (TModelSource.eModelsource_Vault). |
| ModelType | T3DModelType | get; set | The kind of model, extruded, generic, cylinder or sphere. |
| Origin | CoordPoint | get; set | The origin of the model, in internal units (10,000 per mil). |
| Rotation | double | get; set | The rotation of the model, in degrees. |
| VaultGUID | string | get; set | The 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
| Method | Returns | Description |
|---|---|---|
| AddTo | void | Adds the model's geometry to the given 3D view, with the given transformation and name. |
| AddToAssembly | void | Adds the model's geometry to the given assembly of a 3D view, with the given transformation and name. |
| AddToAssembly2 | void | Adds the model's geometry to the given assembly of a 3D view, with the given transformation, name and colour. |
| ExportToStep | void | Writes the model's 3D geometry to a STEP file. |
| ForceCheck_IsStale | bool | Checks again whether the file the model data was loaded from has changed, and returns the result. |
| GetChecksum | uint | Returns the checksum of the model data. |
| GetDataHash | string | Returns the checksum of the model data as a decimal string. |
| GetDataSize | long | Returns the size of the model data. |
| GetFileName | string | Returns the name of the file the model data was loaded from. |
| GetState | void | Returns the model's rotation about the X, Y and Z axes and its offset along the Z axis. |
| I_Replicate | IPCB_Model | Returns a copy of the model, of the same model type. |
| I_ReplicateToGeneric | IPCB_Model | Returns a copy of the model as a generic model (T3DModelType.e3DModelType_Generic). |
| IsEmpty | bool | Returns whether the model has no model data. |
| IsStale | bool | Returns whether the file the model data was loaded from is known to have changed. |
| SetState | void | Sets 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);
| Parameter | Type | Passing |
|---|---|---|
argViewWrapper | IOccWrapper | value |
argITransformation | IPCB3D_Transformation | value |
argName | string | value |
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);
| Parameter | Type | Passing |
|---|---|---|
argViewWrapper | IOccWrapper | value |
argssemblyIndex | int | value |
argITransformation | IPCB3D_Transformation | value |
argName | string | value |
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);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argViewWrapper | IOccWrapper | value | |
argssemblyIndex | int | value | |
argITransformation | IPCB3D_Transformation | value | |
argName | string | value | |
argColor | uint | value | The 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);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argFileName | string | value | The 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);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argHashType | string | value | Must 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);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argRotX | double | out | Receives the rotation about the X axis, in degrees. |
argRotY | double | out | Receives the rotation about the Y axis, in degrees. |
argRotZ | double | out | Receives the rotation about the Z axis, in degrees. |
argDz | int | out | Receives 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);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argRotX | double | value | The rotation about the X axis, in degrees. |
argRotY | double | value | The rotation about the Y axis, in degrees. |
argRotZ | double | value | The rotation about the Z axis, in degrees. |
argDz | int | value | The 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.