ISch_BasicContainer interface
The ISch_BasicContainer interface represents as a parent object or a child object for a schematic object in Altium Designer.
public interface ISch_BasicContainer
Namespace: SCH · Assembly: Altium.SDK.Interfaces
Derived: IOpenBus_PinGroup, ISch_ConnectivityStorage, ISch_GraphicalObject, ISch_Implementation, ISch_MapDefiner
Remarks
A sheet symbol object for example is a parent object, and its child objects are sheet entries, thus to fetch the sheet entries, you would create an iterator for the sheet symbol and iterate for sheet entry objects.
A schematic document is a parent object as well thus you also create an iterator for this document and iterate for objects on this document.
ISch_BasicContainer is the ancestor interface object for schematic object interfaces.
ISch_BasicContainer is the ancestor interface object for ISch_MapDefiner and ISch_Implementation interfaces.
ISch_Document is inherited from ISch_BasicContainer and is a container for storing design objects and in turn each design object is inherited from the ISch_BasicContainer interface.
ISch_Iterator fetches design objects which are inherited from the ISch_BasicContainer interface.
Properties
| Property | Type | Access | Description |
|---|---|---|---|
| DescriptionString | string | get | This method returns you the description string for this object. |
| Handle | string | get | |
| IdentifierString | string | get | This method returns you the identifier string. |
| ObjectId | TObjectId | get | The ObjectID property determines what object type the object in question is. |
| OwnerSchDocument | ISch_Document | get | This property returns the ISch_Document interface that the object is associated with. |
| SchBasicContainer | ISch_BasicContainer | get | This property represents the container within the parent object (such as a document, component or sheet symbol). |
| SchParameterByName | ISch_Parameter | get | |
| Text | string | get; set | The Text property represents the text information for the directive objects and the error marker objects. |
| UniqueId | string | get; set | The UniqueID property sets the new ID for the component. |
| WiringDiagramOriginUniqueId | string | get |
DescriptionString
This method returns you the description string for this object.
string GetState_DescriptionString();
Type: string · Access: read-only
Handle
No description yet.
string GetState_Handle();
Type: string · Access: read-only
IdentifierString
This method returns you the identifier string.
string GetState_IdentifierString();
Type: string · Access: read-only
ObjectId
The ObjectID property determines what object type the object in question is. For example when iterating for objects on a schematic document, you would want to modify all objects but update the port objects' locations only, thus you check for the object's ObjectId and if it is a ePort type, then take action.
TObjectId GetState_ObjectId();
Type: TObjectId · Access: read-only
The accessors are extension methods of ISch_BasicContainerHelper (using SCH;).
Example: Color wires red and fill ports green, depending on the object type.
using SCH;
ISch_ServerInterface schServer = SCH.GlobalVars.SchServer;
ISch_Document document = schServer?.GetCurrentSchDocument();
if (document == null)
return;
ISch_RobotManager robotManager = schServer.GetState_RobotManager();
ISch_Iterator iterator = document.SchIterator_Create();
try
{
ISch_BasicContainer anObject = iterator.FirstSchObject();
while (anObject != null)
{
robotManager.SendMessage(anObject, SCHConstant.BroadCast, SCHConstant.SCHMBeginModify, SCHConstant.NoEventData);
switch (anObject.GetState_ObjectId())
{
case TObjectId.eWire:
((ISch_GraphicalObject)anObject).SetState_Color(0x0000FF); // red, in BGR format
break;
case TObjectId.ePort:
((ISch_GraphicalObject)anObject).SetState_AreaColor(0x00FF00); // green, in BGR format
break;
}
robotManager.SendMessage(anObject, SCHConstant.BroadCast, SCHConstant.SCHMEndModify, SCHConstant.NoEventData);
anObject = iterator.NextSchObject();
}
}
finally
{
document.SchIterator_Destroy(ref iterator);
}
See also: TObjectId
Examples: Ciiva
OwnerSchDocument
This property returns the ISch_Document interface that the object is associated with. It is also said that the document owns the object when the Object has a valid OwnerDocument property.
ISch_Document GetState_OwnerSchDocument();
Type: ISch_Document · Access: read-only
The accessors are extension methods of ISch_BasicContainerHelper (using SCH;).
See also: ISch_Document, ISch_GraphicalObject
SchBasicContainer
This property represents the container within the parent object (such as a document, component or sheet symbol). If the container is empty it implies that this object itself is a standalone or child object.
ISch_BasicContainer GetState_SchBasicContainer();
Type: ISch_BasicContainer · Access: read-only
The accessors are extension methods of ISch_BasicContainerHelper (using SCH;).
Examples: Extension_ModifySchWireColor
SchParameterByName
No description yet.
ISch_Parameter GetState_SchParameterByName(string argName);
Type: ISch_Parameter · Access: read-only · Index: argName (string)
The accessors are extension methods of ISch_BasicContainerHelper (using SCH;).
Text
The Text property represents the text information for the directive objects and the error marker objects.
string GetState_Text();
void SetState_Text(string argValue);
Type: string · Access: read/write
The Text property of the ISch_Label represents the actual text string entered by the user.
See also: ISch_Directive, ISch_ErrorMarker, ISch_Label, ISch_TextFrame
Examples: Ciiva
UniqueId
The UniqueID property sets the new ID for the component. All parameters, sheet symbols, ports, pins, components, openbus links, openbus ports and openbus components have Unique IDs. Unique IDs are used to maintain design synchronization in design projects.
string GetState_UniqueId();
void SetState_UniqueId(string argValue);
Type: string · Access: read/write
The Unique ID (UID) is an system generated value that uniquely identifies this current component. It is used for linking to a PCB document and for project management. Enter a new UID value or click the Reset button to generate a new UID for this design object from the Change Properties dialog. You can also globally reset UIDs of components and sheet symbols from the Schematic Editor's Tools » Convert » Reset Component Unique IDs menu.
The UniqueID property sets the new ID for the parameter. All parameters, sheet symbols, ports, pins, components, openbus links, openbus ports and openbus components have Unique IDs. Unique IDs are used to maintain design synchronization in design projects.
The Unique ID (UID) is an system generated value that uniquely identifies this current parameter. It is used for linking to a PCB document and for project management. Enter a new UID value or click the Reset button to generate a new UID for this design object from the Change Properties dialog. You can also globally reset UIDs of components and sheet symbols from the Schematic Editor's Tools » Convert » Reset Component Unique IDs menu.
The UniqueID property sets the new ID for the pin. All parameters, sheet symbols, ports, pins, components, openbus links, openbus ports and openbus components have Unique IDs. Unique IDs are used to maintain design synchronization in design projects.
The Unique ID (UID) is an system generated value that uniquely identifies this current sheet symbol. It is used for linking to a PCB document and for project management. Enter a new UID value or click the Reset button to generate a new UID for this design object from the Change Properties dialog. You can also globally reset UIDs of components and sheet symbols from the Schematic Editor's Tools » Convert » Reset Component Unique IDs menu.
The UniqueID property sets the new ID for the port. All parameters, sheet symbols, ports, pins, components, openbus links, openbus ports and openbus components have Unique IDs. Unique IDs are used to maintain design synchronization in design projects.
The Unique ID (UID) is an system generated value that uniquely identifies this current port. It is used for linking to a PCB document and for project management. Enter a new UID value or click the Reset button to generate a new UID for this design object from the Change Properties dialog. You can also globally reset UIDs of components and sheet symbols from the Schematic Editor's Tools » Convert » Reset Component Unique IDs menu.
The SetState_UniqueID property sets the new ID for the sheet symbol. All parameters, sheet symbols, ports, pins, components, openbus links, openbus ports and openbus components have Unique IDs. Unique IDs are used to maintain design synchronization in design projects.
See also: ISch_Component, ISch_Parameter, ISch_Pin, ISch_Port, ISch_SheetSymbol
WiringDiagramOriginUniqueId
No description yet.
string GetState_WiringDiagramOriginUniqueId();
Type: string · Access: read-only
Methods
| Method | Returns | Description |
|---|---|---|
| AddAndPositionSchObject | void | The AddSchObject method adds and positions a child object into the parent object that the AddSchObject is associated with. |
| AddSchObject | void | The AddSchObject method adds a child object into the parent object that the AddSchObject is associated with. |
| CopyTo | void | |
| DeleteAll | void | The DeleteAll method removes the contained objects from the container of ISch_BasicContainer type. |
| ExportToParameters | string | |
| FreeAllContainedObjects | void | The FreeAllContainedObjects method removes the contained objects from the container of ISch_BasicContainer type and the container ends up clean. |
| Import_FromUser | bool | The Import_FromUser method invokes the Properties dialog for the object. |
| RemoveSchObject | void | The RemoveSchObject method removes the Schematic object from the database associated with the document or the parent object but it is not removed from memory. |
| Replicate | ISch_BasicContainer | This methods makes another copy of this object but with an unique object address (a new memory location) but with same attributes as this object. |
| SchIterator_Create | ISch_Iterator | The SchIterator_Create method creates an iterator for the parent object (such as the document, component or the sheet symbol) and with this iterator, you have the ability to iterate the child objects… |
| SchIterator_Destroy | void | The SchIterator_Destroy method destroys the iterator from the parent object (such as the document, component or the sheet symbol). |
| Setstate_Default | void | This method sets the default unit system for this object. |
AddAndPositionSchObject
The AddSchObject method adds and positions a child object into the parent object that the AddSchObject is associated with. For example adding sheet entries in a sheet symbol, you would use this method.
void AddAndPositionSchObject(ISch_BasicContainer argObject);
void AddAndPositionSchObject(object argObject);
| Parameter | Type | Passing |
|---|---|---|
argObject | ISch_BasicContainer | value |
Returns: nothing (void)
The first overload is an extension method of ISch_BasicContainerHelper (using SCH;) with typed parameters; the second is declared by the interface.
See also: ISch_BasicContainer.AddSchObject
AddSchObject
The AddSchObject method adds a child object into the parent object that the AddSchObject is associated with.
void AddSchObject(ISch_BasicContainer argObject);
void AddSchObject(object argObject);
| Parameter | Type | Passing |
|---|---|---|
argObject | ISch_BasicContainer | value |
Returns: nothing (void)
The first overload is an extension method of ISch_BasicContainerHelper (using SCH;) with typed parameters; the second is declared by the interface.
Examples: Extension_CreateSchComponent
CopyTo
No description yet.
void CopyTo(ISch_BasicContainer argContainer);
void CopyTo(object argContainer);
| Parameter | Type | Passing |
|---|---|---|
argContainer | ISch_BasicContainer | value |
Returns: nothing (void)
The first overload is an extension method of ISch_BasicContainerHelper (using SCH;) with typed parameters; the second is declared by the interface.
DeleteAll
The DeleteAll method removes the contained objects from the container of ISch_BasicContainer type. For example, if you just want to get a list of contained objects, and make small changes to them and then move them to a new container. In this case, you do not want to free and recreate all the contained objects, so you use the DeleteAll method. To have a clean container, you need to call the FreeAllContainedObjects method instead.
void DeleteAll();
Returns: nothing (void)
See also: ISch_BasicContainer.FreeAllContainedObjects
ExportToParameters
No description yet.
string ExportToParameters();
Returns: string
FreeAllContainedObjects
The FreeAllContainedObjects method removes the contained objects from the container of ISch_BasicContainer type and the container ends up clean. To have container that can be reused with the same elements in another container, you need to call the DeleteAll method instead.
void FreeAllContainedObjects();
Returns: nothing (void)
See also: ISch_BasicContainer.DeleteAll
Import_FromUser
The Import_FromUser method invokes the Properties dialog for the object. This is equivalent to when you double click on an object on the schematic document and the Object Properties dialog appears. This method returns a true value when the User clicks okay otherwise a false value is returned.
bool Import_FromUser();
Returns: bool
An example of using this method is to pop up the Properties dialog programmatically so that the user can modify the object and then the extension or the server code can do more processing.
RemoveSchObject
The RemoveSchObject method removes the Schematic object from the database associated with the document or the parent object but it is not removed from memory. Therefore an Undo action will be able to restore this object only if ISch_RobotManager.SendMessage is invoked.
void RemoveSchObject(ISch_BasicContainer argObject);
void RemoveSchObject(object argObject);
| Parameter | Type | Passing |
|---|---|---|
argObject | ISch_BasicContainer | value |
Returns: nothing (void)
The first overload is an extension method of ISch_BasicContainerHelper (using SCH;) with typed parameters; the second is declared by the interface.
Example: Remove all ports from the current schematic sheet, with undo support.
using DXP;
using SCH;
ISch_ServerInterface schServer = SCH.GlobalVars.SchServer;
ISch_Document currentSheet = schServer?.GetCurrentSchDocument();
if (currentSheet == null)
return;
IProcessControl processControl = DXP.GlobalVars.Client.GetProcessControl();
ISch_RobotManager robotManager = schServer.GetState_RobotManager();
// Initialize the robots in the schematic editor.
processControl.PreProcess(currentSheet, "");
// Set up the iterator to look for port objects only.
ISch_Iterator iterator = currentSheet.SchIterator_Create();
if (iterator == null)
return;
iterator.AddFilter_ObjectSet(new SCH.TObjectSet { TObjectId.ePort });
try
{
ISch_BasicContainer port = iterator.FirstSchObject();
while (port != null)
{
ISch_BasicContainer oldPort = port;
port = iterator.NextSchObject();
currentSheet.RemoveSchObject(oldPort);
robotManager.SendMessage(currentSheet, SCHConstant.BroadCast, SCHConstant.SCHMPrimitiveRegistration, oldPort);
}
}
finally
{
currentSheet.SchIterator_Destroy(ref iterator);
}
// Clean up the robots in the schematic editor.
processControl.PostProcess(currentSheet, "");
Replicate
This methods makes another copy of this object but with an unique object address (a new memory location) but with same attributes as this object.
ISch_BasicContainer Replicate();
Returns: ISch_BasicContainer
Extension method of ISch_BasicContainerHelper (using SCH;).
SchIterator_Create
The SchIterator_Create method creates an iterator for the parent object (such as the document, component or the sheet symbol) and with this iterator, you have the ability to iterate the child objects within, such as pins of a component. Once you have finished using the iterator, invoke the SchIterator_Destroy method to free the iterator from memory.
ISch_Iterator SchIterator_Create();
Returns: ISch_Iterator
Extension method of ISch_BasicContainerHelper (using SCH;).
Example: Collect the names of the sheet entries of every sheet symbol on the current sheet.
using SCH;
ISch_Document currentSheet = SCH.GlobalVars.SchServer?.GetCurrentSchDocument();
if (currentSheet == null)
return;
string entriesNames = "";
ISch_Iterator parentIterator = currentSheet.SchIterator_Create();
parentIterator.AddFilter_ObjectSet(new SCH.TObjectSet { TObjectId.eSheetSymbol });
try
{
for (var sheetSymbol = parentIterator.FirstSchObject() as ISch_SheetSymbol; sheetSymbol != null;
sheetSymbol = parentIterator.NextSchObject() as ISch_SheetSymbol)
{
// Look for sheet entries (child objects) within the sheet symbol.
ISch_Iterator childIterator = sheetSymbol.SchIterator_Create();
if (childIterator == null)
continue;
childIterator.AddFilter_ObjectSet(new SCH.TObjectSet { TObjectId.eSheetEntry });
try
{
for (var sheetEntry = childIterator.FirstSchObject() as ISch_SheetEntry; sheetEntry != null;
sheetEntry = childIterator.NextSchObject() as ISch_SheetEntry)
{
entriesNames = sheetEntry.GetState_Name() + "\r" + entriesNames;
}
}
finally
{
sheetSymbol.SchIterator_Destroy(ref childIterator);
}
}
}
finally
{
currentSheet.SchIterator_Destroy(ref parentIterator);
}
See also: ISch_Iterator, ISch_BasicContainer.SchIterator_Destroy
Examples: Ciiva, Extension_ModifySchWireColor
SchIterator_Destroy
The SchIterator_Destroy method destroys the iterator from the parent object (such as the document, component or the sheet symbol). This iterator once created with the SchIterator_Create method, has the ability to iterate the child objects within, such as pins of a component.
void SchIterator_Destroy(ref ISch_Iterator argIterator);
void SchIterator_Destroy(ref object argIterator);
| Parameter | Type | Passing |
|---|---|---|
argIterator | ISch_Iterator | ref |
Returns: nothing (void)
The first overload is an extension method of ISch_BasicContainerHelper (using SCH;) with typed parameters; the second is declared by the interface.
Examples: Ciiva
Setstate_Default
This method sets the default unit system for this object.
void Setstate_Default(TUnitSystem argUnit);
void Setstate_Default(int argUnit);
| Parameter | Type | Passing |
|---|---|---|
argUnit | TUnitSystem | value |
Returns: nothing (void)
The first overload is an extension method of ISch_BasicContainerHelper (using SCH;) with typed parameters; the second is declared by the interface.
See also: TUnitSystem
Returned by
IOpenBus_Component.GetContainer_InternalPins, ISch_HarnessWireData.ConnectedCable, ISch_HarnessWireData.ConnectedTwist, ISch_HarnessWireData.EndVertex1ConnectedSchObject, ISch_HarnessWireData.EndVertex2ConnectedSchObject, ISch_Iterator.FirstSchObject, ISch_Iterator.NextSchObject, ISch_ServerInterface.SchObjectFactory, ISch_ServerInterface.SchObjectFactoryBySettings
Accepted by
ISch_Document.ObjectReferenceZone, ISch_Document.RegisterSchObjectInContainer, ISch_Document.UnRegisterSchObjectFromContainer, ISch_RobotManager.SendMessage, ISch_ServerInterface.DestroySchObject, ISch_ServerInterface.ReportSchObjectsDifferences
Examples
Used in the SDK examples: Ciiva, Extension_ModifySchWireColor.