Skip to main content
View as Markdown

IComponentInfo interface

The IComponentInfo interface is an item within the ILibCompInfoReader interface. This IComponentInfo interface represents a schematic symbol in a specified schematic library file with a SchLib extension.

public interface IComponentInfo

Namespace: SCH · Assembly: Altium.SDK.Interfaces

Derived: IComponentFullInfo

Remarks​

The steps required to load a schematic library and its components.

  1. Create an object and pass in the filename of a schematic library file. This object is represented by the ILibCompInfoReader interface by ISch_ServerInterface.CreateLibCompInfoReader.

  2. Invoke the ILibCompInfoReader.ReadAllComponentInfo method to load the library and its components.

  3. Invoke the ILibCompInfoReader.NumComponentInfos method to obtain the number of components for this library

  4. Obtain the indexed ComponentInfos method. This ComponentInfos method returns the indexed IComponentInfo interface.

The IComponentInfo interface is extracted from the ILibCompInfoReader.ComponentInfos method.

Example​

List the name, alias, part count, description and offset of each component in a schematic library.

using System.Collections.Generic;
using System.IO;
using DXP;
using SCH;

ISch_ServerInterface schServer = SCH.GlobalVars.SchServer;
ISch_Document currentLib = schServer?.GetCurrentSchDocument();
if (currentLib == null)
return;
string fileName = currentLib.GetState_DocumentName();
ILibCompInfoReader aLibCompReader = schServer.CreateLibCompInfoReader(fileName);
aLibCompReader.ReadAllComponentInfo();
var reportInfo = new List<string>();

// Obtain the number of components in the specified schematic library.
int compNum = aLibCompReader.NumComponentInfos();
// Go through each component obtained by the library component reader.
for (int j = 0; j < compNum; j++)
{
reportInfo.Add(fileName);
IComponentInfo compInfo = aLibCompReader.GetState_ComponentInfo(j);
reportInfo.Add(" Name : " + compInfo.GetState_CompName());
reportInfo.Add(" Alias Name : " + compInfo.GetState_AliasName());
reportInfo.Add(" Part Count : " + compInfo.GetState_PartCount());
reportInfo.Add(" Description : " + compInfo.GetState_Description());
reportInfo.Add(" Offset : " + compInfo.GetState_Offset());
reportInfo.Add("");
}

string reportPath = Path.Combine(Path.GetTempPath(), "SchLibCompReport.txt");
File.WriteAllLines(reportPath, reportInfo);
IClient client = DXP.GlobalVars.Client;
IServerDocument reportDocument = client.OpenDocument("Text", reportPath);
if (reportDocument != null)
client.ShowDocument(reportDocument);

Properties​

PropertyTypeAccessDescription
AliasNamestringgetThis property returns the alias name for this component.
CompNamestringgetThis property returns the name string for this component from the IComponentInfo object interface.
DescriptionstringgetThis property returns the description string for this component from the IComponentInfo object interface.
OffsetintgetThis property returns the offset as a number – each part of a component whole has an offset to denote its place within the component.
PartCountintgetThis method obtains the number of parts (multiple types of the same component type as an example).

AliasName​

This property returns the alias name for this component. Ie a component can be referred to by one of its multiple names.

string GetState_AliasName();

Type: string · Access: read-only

CompName​

This property returns the name string for this component from the IComponentInfo object interface.

string GetState_CompName();

Type: string · Access: read-only

Description​

This property returns the description string for this component from the IComponentInfo object interface.

string GetState_Description();

Type: string · Access: read-only

Offset​

This property returns the offset as a number – each part of a component whole has an offset to denote its place within the component.

int GetState_Offset();

Type: int · Access: read-only

PartCount​

This method obtains the number of parts (multiple types of the same component type as an example). For example an Integrated circuit may have multiple smaller modules, such as a 74LS00 has multiple OR gates.

int GetState_PartCount();

Type: int · Access: read-only

Methods​

MethodReturnsDescription
GetPartNamestring

GetPartName​

No description yet.

string GetPartName(int argPartNumber);
ParameterTypePassing
argPartNumberintvalue

Returns: string

Returned by​

ILibCompInfoReader.ComponentInfo