
# IModelTypeManager interface

The `IModelTypeManager` interface represents a repository of available model types in Altium Designer. The Implementation files (*.IMP) from the System folder of Altium Designer Installation are collected and processed by this manager.

```csharp
public interface IModelTypeManager
```

**Namespace:** SCH · **Assembly:** Altium.SDK.Interfaces

## Remarks

Each model that can be linked to a schematic component has a model type and model data file(s).

PCB Model has one model data file - footprints (*.PCBLIB)

PCB 3D Model has one model data file -3D models (*.PCB3DLib)

Signal Integrity Model has one model data file - pin model library.

Simulation has 3 model data files - Model File(.MDL), Subcircuit file (.CKT) and SIMetrix Model Library file (*.LB).

This `IModelTypeManager` interface uses [`IModelType`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/IModelType.md) and IModelDataType interfaces to store different model types and their model data types.

Invoke the ModelTypeManager method to fetch the `IModelTypeManager` interface.

## Methods

| Method | Returns | Description |
| --- | --- | --- |
| [ModelDatafileTypeAt](#modeldatafiletypeat) | [IModelDatafileType](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/IModelDatafileType.md) | This method returns the data file types supported by Altium Designer. |
| [ModelDatafileTypeCount](#modeldatafiletypecount) | `int` | This method reports the number of model data file types used by Altium Designer. |
| [ModelDatafileTypeFromKind](#modeldatafiletypefromkind) | [IModelDatafileType](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/IModelDatafileType.md) | This method returns the [`IModelDatafileType`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/IModelDatafileType.md) based on the datafile kind. |
| [ModelTypeAt](#modeltypeat) | [IModelType](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/IModelType.md) | This method returns the indexed model type. |
| [ModelTypeCount](#modeltypecount) | `int` | This method returns the number of models supported by Altium Designer. |
| [ModelTypeFromName](#modeltypefromname) | [IModelType](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/IModelType.md) | This method returns the model type interface based on the model type name. |
| [ModelTypeFromServerName](#modeltypefromservername) | [IModelType](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/IModelType.md) | This method returns the model type interface based on the server name. |

### ModelDatafileTypeAt

This method returns the data file types supported by Altium Designer. First data file type starts at 0. This method is used by the ModelDataFileTypes property.

```csharp
IModelDatafileType ModelDatafileTypeAt(int argnIndex);
```

| Parameter | Type | Passing |
| --- | --- | --- |
| `argnIndex` | `int` | value |

**Returns:** [IModelDatafileType](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/IModelDatafileType.md)

Extension method of `IModelTypeManagerHelper` (`using SCH;`).

This property returns the data file types supported by Altium Designer. First data file type starts at 0. This property is supported by the ModelDataFileTypeAt method.

**See also:** [IModelTypeManager.ModelDatafileTypeCount](#modeldatafiletypecount), [IModelDatafileType](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/IModelDatafileType.md)

### ModelDatafileTypeCount

This method reports the number of model data file types used by Altium Designer. Since there are four models supported and Simulation model has 3 types while the other 3 models has one type each making 6 in total.

```csharp
int ModelDatafileTypeCount();
```

**Returns:** `int`

**Example:** Show the number of model data file types.

```csharp
using SCH;

IModelTypeManager modelTypeMan = EDP.Utils.LoadModelTypeManager();
if (modelTypeMan == null)
    return;
DXP.Utils.ShowInfo(modelTypeMan.ModelDatafileTypeCount().ToString(), "Model data file types");
```

### ModelDatafileTypeFromKind

This method returns the [`IModelDatafileType`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/IModelDatafileType.md) based on the datafile kind. The datafile kinds for:

```csharp
IModelDatafileType ModelDatafileTypeFromKind(string argKind);
```

| Parameter | Type | Passing |
| --- | --- | --- |
| `argKind` | `string` | value |

**Returns:** [IModelDatafileType](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/IModelDatafileType.md)

Extension method of `IModelTypeManagerHelper` (`using SCH;`).

**Example:** Show the description of the data file type of SI pin model libraries.

```csharp
using SCH;

IModelTypeManager modelTypeMan = EDP.Utils.LoadModelTypeManager();
if (modelTypeMan == null)
    return;
DXP.Utils.ShowMessage(modelTypeMan.ModelDatafileTypeFromKind("SIPinModelLibrary").Description());
```

### ModelTypeAt

This method returns the indexed model type. First model type starts at 0. This method is used by the ModelTypes property.

```csharp
IModelType ModelTypeAt(int argnIndex);
```

| Parameter | Type | Passing |
| --- | --- | --- |
| `argnIndex` | `int` | value |

**Returns:** [IModelType](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/IModelType.md)

Extension method of `IModelTypeManagerHelper` (`using SCH;`).

This method returns the indexed model type. First model type starts at 0. This property is supported by the `ModelTypeAt` method.

**Example:** Show the name of the first model type.

```csharp
using SCH;

IModelTypeManager modelTypeMan = EDP.Utils.LoadModelTypeManager();
if (modelTypeMan == null)
    return;
DXP.Utils.ShowMessage(modelTypeMan.ModelTypeAt(0).Name());
```

**See also:** [IModelTypeManager.ModelTypeCount](#modeltypecount), [IModelType](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/IModelType.md)

**Examples:** [Extension_TestCS](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Extension_TestCS/Source%20Code/Commands.cs#L30)

### ModelTypeCount

This method returns the number of models supported by Altium Designer. The available models are PCBLIB, SI, SIM and PCB3DLIB types.

```csharp
int ModelTypeCount();
```

**Returns:** `int`

**Example:** Show the names of all model types.

```csharp
using SCH;

IModelTypeManager modelTypeMan = EDP.Utils.LoadModelTypeManager();
if (modelTypeMan == null)
    return;
for (int i = 0; i < modelTypeMan.ModelTypeCount(); i++)
    DXP.Utils.ShowMessage(modelTypeMan.ModelTypeAt(i).Name());
```

### ModelTypeFromName

This method returns the model type interface based on the model type name. The names can be:

```csharp
IModelType ModelTypeFromName(string argName);
```

| Parameter | Type | Passing |
| --- | --- | --- |
| `argName` | `string` | value |

**Returns:** [IModelType](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/IModelType.md)

Extension method of `IModelTypeManagerHelper` (`using SCH;`).

PCB3DLIB

PCBLIB

SI

SIM

**Example:** Show the description of a model type found by its name.

```csharp
using SCH;

IModelTypeManager aModelTypeManager = EDP.Utils.LoadModelTypeManager();
if (aModelTypeManager == null)
    return;
//IModelType aModelType = aModelTypeManager.ModelTypeFromName("PCBLIB");
//IModelType aModelType = aModelTypeManager.ModelTypeFromName("PCB3DLib");
//IModelType aModelType = aModelTypeManager.ModelTypeFromName("SI");
IModelType aModelType = aModelTypeManager.ModelTypeFromName("SIM");
if (aModelType != null)
    DXP.Utils.ShowMessage(aModelType.Description());
```

### ModelTypeFromServerName

This method returns the model type interface based on the server name. The Server names can be:

```csharp
IModelType ModelTypeFromServerName(string argName);
```

| Parameter | Type | Passing |
| --- | --- | --- |
| `argName` | `string` | value |

**Returns:** [IModelType](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/IModelType.md)

Extension method of `IModelTypeManagerHelper` (`using SCH;`).

PCB3D

PCB

Sim

SignalIntegrity

**Example:** Show the description of the model type of the simulation server.

```csharp
using SCH;

IModelTypeManager modelTypeMan = EDP.Utils.LoadModelTypeManager();
if (modelTypeMan == null)
    return;
IModelType modelType = modelTypeMan.ModelTypeFromServerName("SIM");
DXP.Utils.ShowMessage(modelType.Description());
```

## Returned by

[Utils.LoadModelTypeManager](https://altiumdeveloper.github.io/ad-sdk-docs/reference/edp/Utils.md#loadmodeltypemanager)

## Examples

Used in the SDK examples: [Extension_TestCS](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Extension_TestCS/Source%20Code/Commands.cs#L29).
