CATComponentFamily (no NLS) Methods

A component family is an object that lets you generate and manage, in an easy and friendly manner, a set of physical parts or assemblies references, all derived from a generic parametric definition altered for each element using a table of values.

This page discusses:

CATComponentsFamilyExtensionOnElement.GetComponentFamily

The GetComponentFamily method on CATComponentsFamilyExtensionOnElement type allows you to get the component family of a resolved model. Resolved models of family items are of the CATComponentsFamilyExtensionOnElement type which is an extension of the VPMReference Type.

Table 1. Attributes
Name Input/Output Required? Type Comment
oFamily Out Yes Component Family Component Family of resolved model.

Signature

CATComponentsFamilyExtensionOnElement.GetComponentFamily() : ComponentFamily

ReturnType

ComponentFamily

Example

//Search for FamilyItemResolvedModel  in database
let results(List)
let currentResult(PLMQueryResult)
let myQuery (PLMQuery)
let resolvedModel(VPMReference)

//Create FamilyItemResolvedModel search query based on V_Name search
myQuery = CreatePLMQuery("VPMReference")
myQuery->AddCriterion("V_Name","FamilyItemResolvedModel")
results = myQuery->RunQuery()

//We check whether exist a unique FamilyItemResolvedModel.
if (results.Size() <> 1)
	exit

currentResult = results[1]
set resolvedModel = currentResult->LoadResult()

if(resolvedModel == NULL)
	exit

//get resolved model extension 
let itemResolvedModel(CATComponentsFamilyExtensionOnElement)
set itemResolvedModel = resolvedModel

//Gets the family
if(itemResolvedModel<>NULL)
{
	let myFamily(ComponentFamily)
	myFamily = itemResolvedModel.GetComponentFamily()
	if(myFamily <> NULL)
	{
		//Process family
	}
}

ComponentFamily.ClassifyObjects()

The ClassifyObjects method allows you to classify objects by Class, Chapter, or Catalog (only if it contains one chapter).

Signature

ComponentFamily.ClassifyObjects(iContainerObject : PLMQueryResult, iItemsToClassify : List [, iClassifyOnlyResolvedModels : Boolean, iEmptyObjectIfPresent : Boolean, iColumnNames : List, iClassificationAttributeNames : List, iAutoMap : Boolean])

Arguments

Name Input/Output Required? Type Comment
iContainerObject In Yes PLMQueryResult
  • PLMQueryResult of container object.
  • Container object can be Chapter or Class.
iItemsToClassify In Yes List
  • List of items to resolve.
  • This is a list of family items.
iClassifyOnlyResolvedModels In No Boolean
  • Classifies resolved models only.
  • False by default.
iEmptyObjectIfPresent In No Boolean
  • Specifies to empty class/chapter if contained. objects.
  • False by default.
iColumnNames In No List
  • List of characteristics column.
  • For class classification: column names to be mapped with classification attribute.
  • For chapter classification: Keywords to be added on chapter.
iClassificationAttributeNames In No List
  • List of Classification Attributes to be associated to characterstic columns. One-to-one mapping is done with iColumnNames.
  • For catalog, it is ignored.
iAutoMap In No Boolean
  • Adds all the characteristic columns as keywords on chapter.
  • For Class, it binds valid classification attributes with the characteristic column.

Classification in Classes with Classification Attribute Mapping

//Gets the family items from family
let results(List)
let currentResult(PLMQueryResult)
let myQuery (PLMQuery)
let myFamily (ComponentFamily)

myQuery = CreatePLMQuery("CATComponentsFamilyExplicit")
myQuery->AddCriterion("V_Name","BLCOmponentFamily")
results = myQuery->RunQuery()

currentResult = results[1]
set myFamily = currentResult->LoadResult()
if(myFamily == NULL)
	exit

//Gets the family items from family
let fmlItems(list)
fmlItems = myFamily.GetFamilyItems()

let fmlItemsToClassify(list)
fmlItemsToClassify.Append(fmlItems[5])
fmlItemsToClassify.Append(fmlItems[6])

//Classify only resoved models
let classifyOnlyResolvedModels(boolean)
classifyOnlyResolvedModels = False

//Empty objects if it is already presnt
let emptyObjectsIfPresent(boolean)
emptyObjectsIfPresent = False

//Classification Attributes and Design table columns list as empty.
//These lists will be taken from Business Rule
let ClassificationAtrributeName(list)
let columnNamesToMap(List)

//Get the class in which we want to classify
let classSearchresults(List)
let classPLMResult(PLMQueryResult)
let classSearchQuery (PLMQuery)

//query for search of General Class named MyClass in database
classSearchQuery = CreatePLMQuery("General Class")
classSearchQuery->AddCriterion("name","AMR17_Class")
classSearchresults = classSearchQuery->RunQuery()
if classSearchresults.Size()<>1
	exit

classPLMResult = classSearchresults[1]
//ClassifyObjects inside class MyClass with classification attribute mapping
myFamily.ClassifyObjects(classPLMResult , fmlItemsToClassify, classifyOnlyResolvedModels, emptyObjectsIfPresent, columnNamesToMap, ClassificationAtrributeName, TRUE )

Classification in Chapter

//Gets the family items from family
let fmlItems(list)
fmlItems = myFamily.GetFamilyItems()

let fmlItemsToClassify(list)
fmlItemsToClassify.Append(fmlItems[5])
fmlItemsToClassify.Append(fmlItems[6])

//Get the Chapter  in which we want to classify 
let chapterSearchresults(List)
let chapterPLMResult(PLMQueryResult)
let chapterSearchQuery (PLMQuery)

//query for search of chapter  MyChapter
chapterSearchQuery = CreatePLMQuery("ENOCLG_ClassReference")
chapterSearchQuery->AddCriterion("PLM_ExternalID","MyChapter")
chapterSearchresults = chapterSearchQuery->RunQuery()
if chapterSearchresults.Size()<>1
	exit

chapterPLMResult = chapterSearchresults[1]
//ClassifyObjects inside chapter
myFamily.ClassifyObjects(chapterPLMResult , fmlItemsToClassify )

ComponentFamily.DefineAttributeMapping()

The DefineAttributeMapping method lets you use attribute mapping defined by using the ComponentFamilyAttributeMapping business rule. You need to save the family after defining the attribute mapping.

Signature

ComponentFamily.DefineAttributeMapping(iAttributeNames : List, iColumnNames : List): void

Arguments

Name Input/Output Required? Type Comment
iAttributeNames In No List List of Attribute Names.
iColumnNames In No List List of mapped Column Names.

DefineAttributeMapping

//Search for My Family component family in database
let results(List)
let currentResult(PLMQueryResult)
let myQuery (PLMQuery)

//query for search of component family in database
myQuery = CreatePLMQuery("CATComponentsFamilyExplicit")
myQuery->AddCriterion("V_Name","My Family")
results = myQuery->RunQuery()

//We check whether exist a unique component family
if (results.Size() <> 1)
	exit

let myFamily (ComponentFamily)
currentResult = results[1]

myFamily = currentResult-> LoadResult(true)

//Maps V_Name attribute with Name column
let attributes(List)
attributes.Append("V_Name" )

let columnNames(List)
ColumnNames.Append("Name" )

//Define Attribute mapping on family
myFamily->DefineAttributeMapping(attributes, columnNames)

//Now family is dirty 
let fmlToSave(list)
fmlToSave.Append(myFamily)
Save(fmlToSave)

ComponentFamily.GetCharacteristics()

The GetCharacteristics method retrieves characteristic column names and their types.

Signature

ComponentFamily.GetCharacteristics(ColumnNames : List, ColumnTypes : List)

Arguments

Name Input/Output Required? Type Comment
ColumnNames Out Yes List List of column names.
ColumnTypes Out Yes List List of column types. It contains an associated list of Type object.

Example

//Get Characteristic Values from family 
let charactColumnNames(list)
let charactColumnTypes(list)
myFamily.GetCharacteristics( charactColumnNames, charactColumnTypes)

//Check the sizes they should be equal
let iNamesSize(integer)
iNamesSize = charactColumnNames.Size()
let iTypesSize(integer)
iTypesSize = charactColumnTypes.Size()
if(iNamesSize <> iTypesSize )
	exit

//Retrieve Characteristic column names
let columnName(string)
let index(integer)
index = 1
for columnName inside charactColumnNames
{
	//retrieve characteristic column type
	let columnType(Type)
	columnType = charactColumnTypes[index]
	index = index +1
	let typename(string)
	typename = columnType.GetAttributeString("UserName")
	
}

ComponentFamily.GetFamilyItems()

The GetFamilyItems method retrieves all Component Family items.

Signature

ComponentFamily.GetFamilyItems() : List

ReturnType

List

Arguments

Name Input/Output Required? Type Comment
FamilyItems Out Yes List List of Family Items. For Family Item type, see ComponentFamilyItem type.

GetFamilyItems

//Gets the family items from family
let fmlItems(list)
fmlItems = myFamily.GetFamilyItems()

//for each family item retrieve Name, index and status
let familyItem(ComponentFamilyItem)
for familyItem inside fmlItems
{
	//Name of the family Item. ReadOnly
	let itemName(string)
	itemName = familyItem.ItemName
	
	//Index of the family item. ReadOnly
	let itemIdex(integer)
	itemIdex = familyItem.ItemIndex
	
	//Status of family item. ReadOnly
	let itemStatus (ComponentFamilyItemStatus)
	itemStatus = familyItem.Status
}

ComponentFamily.RefreshFamilyForTableModifications()

The RefreshFamilyForTableModifications method lets you refresh a family when the table is modified. When the table is modified, you can decide to update the family by creating a revision of resolved models.

Signature

ComponentFamily.RefreshFamilyForTableModifications(iCreateRevisions : Boolean) : List

Arguments

Name Input/Output Required? Type Comment
iCreateRevisions In Yes Boolean
  • Determines if a revision is created.
  • True: Creates revisions.
  • False: Do nothing.
oModifiedItems Out Yes List Returns a list of modified component family items.

ReturnType

List

RefreshFamilyForTableModifications

//Refresh Family for Design table modifications if any
let modifiedItems(list)
modifiedItems = myFamily.RefreshFamilyForTableModifications(True)
Message("Size: #", modifiedItems.Size())
let fmlItem(ComponentFamilyItem)
for fmlItem inside modifiedItems
{
	//Get the status of item
	let status(ComponentFamilyItemStatus)
	status = fmlItem.Status 
}
//Now family is dirty 
let fmlToSave(list)
if myFamily.IsSaveNeeded
{
	fmlToSave.Append(myFamily)
	Save(fmlToSave)
}

ComponentFamily.ResolveItems()

The ResolveItems method resolves items provided in the input and returns reolved models.

Note: There are two preconditions to this method:
  • Family is not dirty.
  • Family is not locked.

Signature

ComponentFamily.ResolveItems(iItemsToResolve : List) : List

Arguments

Name Input/Output Required? Type Comment
iItemsToResolve In Yes List

List of items to resolve.

This is a list of family items.

oResolvedModels Out Yes List

List of resolved models.

This is a list of VPMReference of resolved models.

ReturnType

List

ResolveItems

//Gets the family items from family
let fmlItems(list)
fmlItems = myFamily.GetFamilyItems()

//Resolve List of Family items
let resolvedModels(list)
resolvedModels = myFamily.ResolveItems(fmlItems)

//Resolved models are list of VPMReference
let resolvedModel(VPMReference)
for resolvedModel inside resolvedModels
{
	//Access attributes of resolved  models
	let resolvedmodelV_Name(string)
	resolvedmodelV_Name = resolvedModel.V_Name
}
Note: Item resolution is a blocking behavior. It runs a batch if the connected user is different from the family owner.

ComponentFamilyItem.GetCharacteristicValue()

The GetCharacteristicValue retrieves the characteristic value of an item corresponding to a characteristic column.

Signature

ComponentFamilyItem.GetCharacteristicValue(Name : String) : UndefinedType

Arguments

Name Input/Output Required? Type Comment
Name In Yes String Name of the characteristic column.
Value Out Yes Undefined Type Type of parameter of characteristic column.

ReturnType

UndefinedType

GetCharacteristicValue

let fmlItem(ComponentFamilyItem)
fmlItem = fmlItems[1]

//Retrieve Characteristic column names
let columnName(string)
let index(integer)
index = 1
for columnName inside charactColumnNames
{
	//retrieve characteristic column type
	let columnType(Type)
	columnType = charactColumnTypes[index]
	index = index +1
	let typename(string)
	typename = columnType.GetAttributeString("UserName")
	// Depending upon the characteristic type process the values 
	if(typename == "String")
	{
		let value(string)
		value = fmlItem.GetCharacteristicValue(columnName)
	}
	else if (typename== "Length") 
	{
		let value(Length)
		value = fmlItem.GetCharacteristicValue(columnName)
	}
	
}

ComponentFamilyItem.GetItemModel()

The GetItemModel method gives an item’s model. If the Model is not up-to-date or not solved, it resolves the model and returns it.

Signature

ComponentFamilyItem.GetItemModel(ibResolvedIfNotSolved : Boolean]) : VPMReference

Arguments

Name Input/Output Required? Type Comment
ibResolvedIfNotSolved In No Boolean Resolves items if they are not solved/out of date.
oItemModel Out Yes VPM Reference
  • Returns item’s model.
  • If Item is not solved or up-to-date, it resolves and returns it.

ReturnType

VPMReference

GetItemModel

let fmlItems(list)
fmlItems = myFamily.GetFamilyItems()

//Retrieve 1st item in the list.
let fmlItem(ComponentFamilyItem)
fmlItem = fmlItems[1]

//Component model is always VPM Reference
let itemModel(VPMReference)
itemModel = fmlItem.GetItemModel(True)
if ( itemModel <> NULL)
{
	//Access attributes of item  models
	let itemModelV_Name(string)
	itemModelV_Name = itemModel.V_Name
}
Note: Item resolution is a blocking behavior. It runs a batch if the connected user is different from the family owner.

ComponentFamilyItem.GetNbOfOldModels()

The GetNbOfRevisions method retrieves the number of old resolved models of a component family item.

Note: This may not be PLM revisions.

Signature

ComponentFamilyItem.GetNbOfOldModels() : Integer

Arguments

Name Input/Output Required? Type Comment
iNbOfOldModels Out Yes Integer Number of Old resolved Models of component family item.

ReturnType

Integer

Example

let fmlItems(list)
fmlItems = myFamily.GetFamilyItems()

//Retrieve any item in the list.
let fmlItem(ComponentFamilyItem)
fmlItem = fmlItems[1]

//Returns number of old Revision
let nbOfOldRevisions(integer)
nbOfOldRevisions = fmlItem.GetNbOfOldModels()

ComponentFamilyItem.GetOldModels()

The GetOldModels method retrieves old versions of resolved model. Output object is PLMQueryResult type object. Models are not loaded in memory

Signature

ComponentFamilyItem.GetOldModels() : List

Arguments

Name Input/Output Required? Type Comment
oOldRevisions Out Yes List List of old revision objects. These are PLMQueryResult type objects.

ReturnType

List

Example

//Retrieve any item in the list.
let fmlItem(ComponentFamilyItem)
fmlItem = fmlItems[1]

//Retrieve old vesions
let oldVersions(list)
oldVersions =fmlItem.GetOldModels()

//Process old version object as it is VPMReference
let oldResolvedModelResult(PLMQueryResult)
for oldResolvedModelResult inside oldVersions
{
   //process result 
}

ComponentFamilyItem.WhereClassified()

The WhereClassified method gets where-classified information. It returns a list of PLMQueryResult of objects where items are classified.

Signature

ComponentFamilyItem.WhereClassified() : List

Arguments

Name Input/Output Required? Type Comment
oWhereClassifiedObjects In Yes List
  • List of PLMQueryResult of object(Class/Chapter).
  • This object is not loaded.

ReturnType

List

WhereClassified on Items with Class

//Gets the family items from family
let fmlItems(list)
fmlItems = myFamily.GetFamilyItems()

//Item for which we need to check where classified
let fmlItem(ComponentFamilyItem)
fmlItem = fmlItems[1]

let whereclassified(list)
whereclassified = fmlItem.WhereClassified()

//Get the each result and process it 
let classResult(PLMQueryResult)
//Get the each result and process it 
for classResult inside whereclassified
{
	let classobj(`General Class`)
	set classobj = classResult.LoadResult()
	//Process class object
	if classobj<>NULL
	{
		Message("Class Object with Name : ",classobj.name )
	}
}