TemplateManager Class

class NXOpen.PartFamily.TemplateManager

Bases: NXOpen.TransientObject

This class serves as the manager for all the part family related operations.

All operations that create, edit or delete part family objects are done through this class. Use the method Part.NewPartFamilyTemplateManager() to create new instance of this class.

New in version NX9.0.0.

Properties

Property Description
Importable Returns or sets the importable flag value
SaveDirectory Returns or sets the save directory path value

Methods

Method Description
AddAssertedMassToChosenAttributes Adds new attribute of type asserted mass to chosen attributes list of a part family
AddInstanceDefinition Creates a new family member definition with the supplied name and places it just under previous family member definition.
AddInstanceDefinitionUsingMemberIdentifier Creates a new family member definition with the supplied member identifier places it just under previous family member definition.
AddOptionalCreationNonKeyAttrsToChosenAttrs Add all optional creation non key attributes to chosen list at the end or after a selected attribute from chosen attribute list.
AddToChosenAttributes Adds new attributes to chosen attributes list of a part family
CreateMemberIdentifier Creates a member identifier for a part family member from the key attributes and value pair.
CreatePartFamily Creates a part family associated with the owning part
CutAttributes Cut selected attributes of a part family.
DeleteInstanceDefinition Delete the family member definition from template manager
DeletePartFamily Deletes a part family associated with the manager/owning part
DeletePartFamilyAttribute Deletes a given part family attribute
Dispose Free resources associated with the instance.
EditPartFamily Edits a part family associated with the manager/owning part
EstablishFamilyInstance Creates a part family member if it doesn’t exist on disk.
GetAllKeyAttrs Obtains all key attributes (required and optional) required to construct the MFK ID.
GetChosenAttributes Returns the attributes on the template manager These might include the attributes which have not yet been committed onto the core object and have only been created by this instance of the manager.
GetInfoMessages Obtains the list of messages that may have been encountered in any workflow.
GetInstanceDefinition Get the family member definition already present in family
GetInstanceDefinitionUsingMemberIdentifier Obtains the family member definition already present in family A non zero return code implies familyMemberDefinition is NULL
GetPartFamilyAttribute Get the part family attribute from part family template
GetPartFamilyTemplate Get the part family template This method may return NULL if there is no template associated with the templatemanager
GetSelectableAttributes The list of attribute names of a given type in the owning part These can be used to create part family attributes
MoveDownAttributes Move down the specified attributes of a part family by the moveDownCount.
MoveUpAttributes Move up the specified attributes of a part family by the moveUpCount.
PasteAttributes Paste the cut attributes of a part family.
RefreshDefaultAttrs Repopulates required attributes in chosen list so that it updates as per the teamcenter customizations, if it has changed since last saved template.
ReorderInstanceDefinition Reorder (relocate) familyMemberDefinition just after the previousFamilyMemberDefn
SaveFamilyAndApplyValues Save part family and apply the values of chosen family member definition to the template part, It returns failure codes through errorCode.
SaveFamilyAndCreateMembers Save part family and create the family members supplied through input array.
SaveFamilyAndFixOrphanMembers Save part family and fix the orphan family members supplied through input array.
SaveFamilyAndUpdateMembers Save part family and update the family members supplied through input array.
SavePartFamily Save the changes in template manager to core part family

Property Detail

Importable

TemplateManager.Importable

Returns or sets the importable flag value

-------------------------------------

Getter Method

Signature Importable

Returns:
Return type:bool

New in version NX9.0.0.

License requirements: solid_modeling (“SOLIDS MODELING”)

-------------------------------------

Setter Method

Signature Importable

Parameters:isImportable (bool) –

New in version NX9.0.0.

License requirements: solid_modeling (“SOLIDS MODELING”)

SaveDirectory

TemplateManager.SaveDirectory

Returns or sets the save directory path value

-------------------------------------

Getter Method

Signature SaveDirectory

Returns:
Return type:str

New in version NX9.0.0.

License requirements: solid_modeling (“SOLIDS MODELING”)

-------------------------------------

Setter Method

Signature SaveDirectory

Parameters:saveDirectory (str) –

New in version NX9.0.0.

License requirements: solid_modeling (“SOLIDS MODELING”)

Method Detail

AddAssertedMassToChosenAttributes

TemplateManager.AddAssertedMassToChosenAttributes

Adds new attribute of type asserted mass to chosen attributes list of a part family

Signature AddAssertedMassToChosenAttributes(attrToAdd, indexAddAt)

Parameters:
  • attrToAdd (str) –
  • indexAddAt (int) –

New in version NX9.0.0.

License requirements: adv_assemblies (“ADVANCED ASSEMBLIES”), solid_modeling (“SOLIDS MODELING”)

AddInstanceDefinition

TemplateManager.AddInstanceDefinition

Creates a new family member definition with the supplied name and places it just under previous family member definition.

If the part family is importable, then the otherNameEntry is a mandatory input. Depending on whether we are in managed mode or native, familyMemberDefn name may be os_part_name or db_part_name, and otherNameEntry may be db_part_name or os_part_name. In case of non-importable part family otherName Entry may be empty.

Signature AddInstanceDefinition(familyMemberDefnName, previousFamilyMemberDefn, otherNameEntry)

Parameters:
Returns:

Return type:

NXOpen.PartFamily.InstanceDefinition

New in version NX9.0.0.

License requirements: solid_modeling (“SOLIDS MODELING”)

AddInstanceDefinitionUsingMemberIdentifier

TemplateManager.AddInstanceDefinitionUsingMemberIdentifier

Creates a new family member definition with the supplied member identifier places it just under previous family member definition.

If the part family is importable, then the otherNameEntry is a mandatory input. Depending on whether we are in managed mode or native, otherNameEntry may be db_part_name or os_part_name. In case of non-importable part family otherNameEntry may be empty.

Signature AddInstanceDefinitionUsingMemberIdentifier(familyMemberIdentifier, previousFamilyMemberDefn, otherNameEntry)

Parameters:
Returns:

Return type:

NXOpen.PartFamily.InstanceDefinition

New in version NX10.0.0.

License requirements: solid_modeling (“SOLIDS MODELING”)

AddOptionalCreationNonKeyAttrsToChosenAttrs

TemplateManager.AddOptionalCreationNonKeyAttrsToChosenAttrs

Add all optional creation non key attributes to chosen list at the end or after a selected attribute from chosen attribute list.

To add all optional creation attributes at the end, pass pasteAfter as NULL. If an optional attribute is already present in chosen attribute list, it does not add it again. Outputs an array of the optional attributes that were actually added to chosen list

Signature AddOptionalCreationNonKeyAttrsToChosenAttrs(pasteAfter)

Parameters:pasteAfter (NXOpen.PartFamily.FamilyAttribute) –
Returns:
Return type:list of NXOpen.PartFamily.FamilyAttribute

New in version NX10.0.0.

License requirements: solid_modeling (“SOLIDS MODELING”)

AddToChosenAttributes

TemplateManager.AddToChosenAttributes

Adds new attributes to chosen attributes list of a part family

Signature AddToChosenAttributes(attrsToAdd, attrsTypes, indexAddAt)

Parameters:

New in version NX9.0.0.

License requirements: solid_modeling (“SOLIDS MODELING”)

CreateMemberIdentifier

TemplateManager.CreateMemberIdentifier

Creates a member identifier for a part family member from the key attributes and value pair.

In native mode the itemType is NULL In managed mode, the value of itemType could be NULL in which case Template’s item type will be used while creating the MemberIdentifier

Signature CreateMemberIdentifier(keyAttrs, attrValues, itemType)

Parameters:
Returns:

Return type:

NXOpen.PartFamily.MemberIdentifier

New in version NX10.0.0.

License requirements: solid_modeling (“SOLIDS MODELING”)

CreatePartFamily

TemplateManager.CreatePartFamily

Creates a part family associated with the owning part

Signature CreatePartFamily()

Returns:
Return type:NXOpen.PartFamily.Template

New in version NX9.0.0.

License requirements: solid_modeling (“SOLIDS MODELING”)

CutAttributes

TemplateManager.CutAttributes

Cut selected attributes of a part family.

These will be pasted during paste operation. If previously cut attributes are present then they will be lost because the new ones will overwrite them.

Signature CutAttributes(cutAttrs)

Parameters:cutAttrs (list of NXOpen.PartFamily.FamilyAttribute) –

New in version NX9.0.0.

License requirements: solid_modeling (“SOLIDS MODELING”)

DeleteInstanceDefinition

TemplateManager.DeleteInstanceDefinition

Delete the family member definition from template manager

Signature DeleteInstanceDefinition(familyMemberDefinition)

Parameters:familyMemberDefinition (NXOpen.PartFamily.InstanceDefinition) –

New in version NX9.0.0.

License requirements: solid_modeling (“SOLIDS MODELING”)

DeletePartFamily

TemplateManager.DeletePartFamily

Deletes a part family associated with the manager/owning part

Signature DeletePartFamily()

New in version NX9.0.0.

License requirements: solid_modeling (“SOLIDS MODELING”)

DeletePartFamilyAttribute

TemplateManager.DeletePartFamilyAttribute

Deletes a given part family attribute

Signature DeletePartFamilyAttribute(partFamilyAttribute)

Parameters:partFamilyAttribute (NXOpen.PartFamily.FamilyAttribute) –

New in version NX9.0.0.

License requirements: solid_modeling (“SOLIDS MODELING”)

Dispose

TemplateManager.Dispose

Free resources associated with the instance.

After this method is called, it is illegal to use the object. In .NET, this method is automatically called when the object is deleted by the garbage collector

Signature Dispose()

New in version NX9.0.0.

License requirements: None.

EditPartFamily

TemplateManager.EditPartFamily

Edits a part family associated with the manager/owning part

Signature EditPartFamily()

New in version NX9.0.0.

License requirements: solid_modeling (“SOLIDS MODELING”)

EstablishFamilyInstance

TemplateManager.EstablishFamilyInstance

Creates a part family member if it doesn’t exist on disk.

Signature EstablishFamilyInstance(memberName)

Parameters:memberName (str) –
Returns:
Return type:str

New in version NX9.0.0.

License requirements: solid_modeling (“SOLIDS MODELING”)

GetAllKeyAttrs

TemplateManager.GetAllKeyAttrs

Obtains all key attributes (required and optional) required to construct the MFK ID.

These would be used to create the unique member identifier.

Signature GetAllKeyAttrs()

Returns:
Return type:list of NXOpen.PartFamily.FamilyAttribute

New in version NX10.0.0.

License requirements: solid_modeling (“SOLIDS MODELING”)

GetChosenAttributes

TemplateManager.GetChosenAttributes

Returns the attributes on the template manager These might include the attributes which have not yet been committed onto the core object and have only been created by this instance of the manager.

“Use Template.GetAttributes() to get the committed attributes”

Signature GetChosenAttributes()

Returns:
Return type:list of NXOpen.PartFamily.FamilyAttribute

New in version NX9.0.0.

License requirements: solid_modeling (“SOLIDS MODELING”)

GetInfoMessages

TemplateManager.GetInfoMessages

Obtains the list of messages that may have been encountered in any workflow.

This is a generic routine to get all information (Error/Warning/Info) that are deemed useful to user. Contains error messages encountered during save like material issues, interpart expression issues, invalid member names. In addition, if there were locked attributes (i.e. attributes whose value cannot be updated), this also would contain the names of such attributes.

Signature GetInfoMessages()

Returns:
Return type:list of str

New in version NX10.0.0.

License requirements: solid_modeling (“SOLIDS MODELING”)

GetInstanceDefinition

TemplateManager.GetInstanceDefinition

Get the family member definition already present in family

Signature GetInstanceDefinition(familyMemberDefnName)

Parameters:familyMemberDefnName (str) –
Returns:
Return type:NXOpen.PartFamily.InstanceDefinition

New in version NX9.0.0.

License requirements: solid_modeling (“SOLIDS MODELING”)

GetInstanceDefinitionUsingMemberIdentifier

TemplateManager.GetInstanceDefinitionUsingMemberIdentifier

Obtains the family member definition already present in family A non zero return code implies familyMemberDefinition is NULL

Signature GetInstanceDefinitionUsingMemberIdentifier(familyMemberIdentifier)

Parameters:familyMemberIdentifier (NXOpen.PartFamily.MemberIdentifier) –
Returns:
Return type:NXOpen.PartFamily.InstanceDefinition

New in version NX10.0.0.

License requirements: solid_modeling (“SOLIDS MODELING”)

GetPartFamilyAttribute

TemplateManager.GetPartFamilyAttribute

Get the part family attribute from part family template

Signature GetPartFamilyAttribute(attrType, attrName)

Parameters:
Returns:

Return type:

NXOpen.PartFamily.FamilyAttribute

New in version NX9.0.0.

License requirements: solid_modeling (“SOLIDS MODELING”)

GetPartFamilyTemplate

TemplateManager.GetPartFamilyTemplate

Get the part family template This method may return NULL if there is no template associated with the templatemanager

Signature GetPartFamilyTemplate()

Returns:
Return type:NXOpen.PartFamily.Template

New in version NX9.0.0.

License requirements: solid_modeling (“SOLIDS MODELING”)

GetSelectableAttributes

TemplateManager.GetSelectableAttributes

The list of attribute names of a given type in the owning part These can be used to create part family attributes

Signature GetSelectableAttributes(attrType)

Parameters:attrType (NXOpen.PartFamily.FamilyAttributeAttrType) –
Returns:
Return type:list of str

New in version NX9.0.0.

License requirements: solid_modeling (“SOLIDS MODELING”)

MoveDownAttributes

TemplateManager.MoveDownAttributes

Move down the specified attributes of a part family by the moveDownCount.

If the attributes cannot be moved down by the specified count, this method will execute the partial move and return the count that the attributes are actually moved down by.

Signature MoveDownAttributes(moveDownAttrs, moveDownCount)

Parameters:
Returns:

Return type:

int

New in version NX9.0.0.

License requirements: solid_modeling (“SOLIDS MODELING”)

MoveUpAttributes

TemplateManager.MoveUpAttributes

Move up the specified attributes of a part family by the moveUpCount.

If the attributes cannot be moved up by the specified count, this method will execute the partial move and return the count that the attributes are actually moved up by.

Signature MoveUpAttributes(moveUpAttrs, moveUpCount)

Parameters:
Returns:

Return type:

int

New in version NX9.0.0.

License requirements: solid_modeling (“SOLIDS MODELING”)

PasteAttributes

TemplateManager.PasteAttributes

Paste the cut attributes of a part family.

The pasteAfter attribute must be present in chosen attributes list for this operation to succeed.

Signature PasteAttributes(pasteAfter)

Parameters:pasteAfter (NXOpen.PartFamily.FamilyAttribute) –

New in version NX9.0.0.

License requirements: solid_modeling (“SOLIDS MODELING”)

RefreshDefaultAttrs

TemplateManager.RefreshDefaultAttrs

Repopulates required attributes in chosen list so that it updates as per the teamcenter customizations, if it has changed since last saved template.

Signature RefreshDefaultAttrs()

New in version NX10.0.0.

License requirements: solid_modeling (“SOLIDS MODELING”)

ReorderInstanceDefinition

TemplateManager.ReorderInstanceDefinition

Reorder (relocate) familyMemberDefinition just after the previousFamilyMemberDefn

Signature ReorderInstanceDefinition(familyMemberDefinition, previousFamilyMemberDefn)

Parameters:

New in version NX9.0.0.

License requirements: solid_modeling (“SOLIDS MODELING”)

SaveFamilyAndApplyValues

TemplateManager.SaveFamilyAndApplyValues

Save part family and apply the values of chosen family member definition to the template part, It returns failure codes through errorCode.

Signature SaveFamilyAndApplyValues(familyMemberDefinition)

Parameters:familyMemberDefinition (NXOpen.PartFamily.InstanceDefinition) –
Returns:
Return type:int

New in version NX9.0.0.

License requirements: solid_modeling (“SOLIDS MODELING”)

SaveFamilyAndCreateMembers

TemplateManager.SaveFamilyAndCreateMembers

Save part family and create the family members supplied through input array.

It returns success and failure codes via errorCodes array.

Signature SaveFamilyAndCreateMembers(instDefsToCreate)

Parameters:instDefsToCreate (list of NXOpen.PartFamily.InstanceDefinition) –
Returns:
Return type:list of int

New in version NX9.0.0.

License requirements: solid_modeling (“SOLIDS MODELING”)

SaveFamilyAndFixOrphanMembers

TemplateManager.SaveFamilyAndFixOrphanMembers

Save part family and fix the orphan family members supplied through input array.

The orphan member that is fixed would also be updated to the latest configuration. It returns success and failure codes via errorCodes array. If errorCodes contains error about locked attributes, use PartFamily.TemplateManager.GetInfoMessages() to query the names of those locked attributes.

Signature SaveFamilyAndFixOrphanMembers(forceUpdate, instDefsToFix)

Parameters:
Returns:

Return type:

list of int

New in version NX11.0.0.

License requirements: solid_modeling (“SOLIDS MODELING”)

SaveFamilyAndUpdateMembers

TemplateManager.SaveFamilyAndUpdateMembers

Save part family and update the family members supplied through input array.

It returns success and failure codes via errorCodes array. If errorCodes contains error about locked attributes, use PartFamily.TemplateManager.GetInfoMessages() to query the names of those locked attributes.

Signature SaveFamilyAndUpdateMembers(forceUpdate, instDefsToUpdate)

Parameters:
Returns:

Return type:

list of int

New in version NX9.0.0.

License requirements: solid_modeling (“SOLIDS MODELING”)

SavePartFamily

TemplateManager.SavePartFamily

Save the changes in template manager to core part family

Signature SavePartFamily()

New in version NX9.0.0.

License requirements: solid_modeling (“SOLIDS MODELING”)