Mechanical APIs support all available actions for the condensed part worksheet.
Getting the Condensed Part Worksheet Object
To get the condensed part worksheet object, execute these commands:
cp = DataModel.GetObjectsByType(DataModelObjectCategory.CondensedPart)[0] cpws = cp.Interfaces
Because the index is 0, this sample code gets the first condensed part and stores a variable of the CondensedPartInterfaces object that can be used to modify the data in the worksheet.
Adding New Interfaces to the Condensed Part Worksheet
The CondensedPartInterfaces
object has these methods:
Add()
Clear()
RemoveAt()
Indexer
You can use the Add()
method to add CondensedPartInterface, which is the object for each element in the list
and controls the data of a single row in the worksheet.
For example, to add CondensedPartInterface
to the
worksheet:
cpws.Add() cpws[0].Type = CondensedPartInterfaceType.General ns = DataMode.GetObjectsByType(DataModelObjectCategory.NamedSelection)[0] cpws[0].NamedSelection = ns cpws.Add() cpws[1].Type = CondensedPartInterfaceType.General rp= DataMode.GetObjectsByType(DataModelObjectCategory.RemotePoint)[0] cpws[1].NamedSelection = rp