Generative Functions

This topic describes the Generative Functions.

Note: Make sure that you have the Engineering Templates reuse license to use the functions listed below. The functions CreateOrModifyTemplate, CreateOrModifyDatum, and EndModifyTemplate are specific to Knowledge Patterns. They create respectively templates instance objects and datums objects.

This page discusses:

CreateOrModifyDatum

Method used to create or modify a datum (only used by the Knowledge Pattern Feature).

Signature

CreateOrModifyDatum(datumType: String, destination: Feature, patternList: List, indexInPatternList: Integer) : UndefinedType

Arguments

Name Input / Output Required? Type Comment
datumType In Yes String Indicates the datum type: Point, Line, Curve, Circle, Surface, Plane, Volume.
destination In Yes Feature Indicates the destination feature (PartBody, ...).
patternList In Yes List Indicates the pattern list.
indexInPatternList In Yes Integer Indicates the index number in the pattern list.
Note: You can handle attributes using the Type view (if the type was properly generated and referenced in the Knowledge Environment tab) or using the SetAttributeObject function.

ReturnType

UndefinedType

Example

Note: To view an example, import the Sample_extra.3dxml file located in win_b64\startup\Knowledgeware\PKT Samples\Sample 1 in the installation folder.

CreateOrModifyTemplate

Method used to instantiate a user feature. You can access and modify the inputs of this user feature with the type attributes (xxx.input name or xxx. Output name) and the published name (only used by the Knowledge Pattern Feature).

Signature

CreateOrModifyTemplate(templateId (ARM): String, destination: Feature, patternList: List, indexInPatternList: Integer) : UndefinedType

Arguments

Name Input / Output Required? Type Comment
templateId (ARM) In Yes String Indicates the name of the feature.
  • If the templates are stored in the ARM table, the first part of the argument is the ARM path. The second part is the name of the user feature.
  • If the template that you want to instantiate is contained in the current document, the name of the user feature.
destination In Yes Feature Indicates the destination feature (PartBody, ...).
patternList In Yes List Indicates the pattern list.
indexInPatternList In Yes Integer Indicates the index number in the pattern list. The function usually waits for contiguous indexes from 1 to n. 0 index is accepted but has the meaning of systematically appending a created object at the end of the list, so a 0 index is not to be used with non-null indexes. If an object is removed from the list before the end of the pattern, or is replaced by another one at its index, it is deleted at the end of the pattern execution.

ReturnType

UndefinedType

Example

In the example below, the template used is a typed user feature.

udf = CreateOrModifyTemplate("PktARMcatalog2|BoxUDF", PartBody, Boxes, i)
udf = CreateOrModifyTemplate("UserFeature1", `Geometrical Set.1` , Boxes, i)
Note: To view an example, import the Sample_extra.3dxml file located in win_b64\startup\Knowledgeware\PKT Samples\Sample 1 in the installation folder.

EndModifyTemplate

The function is used to trigger the update of the instantiated Object after modifying its inputs.

Signature

EndModifyTemplate(template: Feature)

Arguments

Name Input / Output Required? Type Comment
template In Yes Feature Object returned by the CreateOrModifyTemplate function. The EndModifyTemplate function can only be used together with the CreateOrModifyTemplate and the InstantiateTemplate ones.
Note: .Name Attribute access does not work before you call the EndModifyTemplate function. When trying to do so, an error message appears.
Note: To view an example, import the Sample_extra.3dxml file located in win_b64\startup\Knowledgeware\PKT Samples\Sample 1 in the installation folder.

InstantiateTemplate

Function used to instantiate any type of template. This method is available in the Actions editor and in Know-how Apps Components. The input of this method is a link to a resource table that can contain any type of templates (power copies, user features, and engineering templates); the second argument is the destination in the part or the product. You can value the inputs using Setattributeobject, modify the parameters values using Setattributexxx, and access the user feature outputs using GetattributeObject. After using InstantiateTemplate, you must use EndModifyTemplate .

Notes:
  • This method returns an object representing the template that is not the template itself.
  • The expected setup data name is the internal one.
  • When instantiating a user feature using InstantiateTemplate or CreateOrModifyTemplate, the modification of the attributes works properly only if it is called after EndModifyTemplate (If it is not called after EndModifyTemplate, an error message appears.) The attributes are the following:
    • Feature: Name, Owner, UserInfoComment, PrimaryType, NamedURLs, Children.
    • Visible: Show, Color, Layer, Pick
    • Geometric Feature: Activity, Error, IsRoot, IsLeaf, IsDatum
  • When used to instantiate an engineering template, the InstantiateTemplate function result can be used to get the created instances or duplicated references using the CreatedInstances and CreatedReferences attributes (see Example 3 below.)
  • When instantiating an engineering template, you can specify inputs that are out of the destination context indicated in the InstantiateTemplate function using the RootContext attribute. This attribute can be specified on the instantiation object to specify a common root between the instantiation destination and the components containing the inputs.
  • When instantiating an engineering template, you can get a handle on the objects created by the template, especially in a multiroot context. The CreatedInstances and CreatedReferences attributes are available on the instantiation object to retrieve the objects created by the template.
  • InstantiateTemplate starts the instantiation of a template such as a UDF, PowerCopy, Engineering Template, or Know How Apps Logic Template from a local resource table or setup data.

Signature

InstantiateTemplate(templateId (Resource): String, destination: Feature, instantiationMode: TemplateInstantiationOptionsType) : UndefinedType

Arguments

Name Input / Output Required? Type Comment
templateId (Resource) In Yes String -
destination In Yes Feature -
instantiationMode In No TemplateInstantiationType -

ReturnType

UndefinedType

Example 1

let S(Surface)
let temp (Feature)
temp= InstantiateTemplate ("ARM", destination)
temp.SetAttributeObject("Input",...)
temp.SetAttributeObject("Input",...)
EndModifyTemplate(temp)

Example 2

myTemplate = CreateOrModifyTemplate(...)
myTemplate.PointA = x
myTemplate.PointB = y
myTemplate.Radius = z
EndModifyTemplate(myTemplate)
myTemplate.Name = "MyTemplateInstance"

Example 3

let tmp(Feature)
let listOfInstances(List)
let ListOfReferences(List)
tmp = InstantiateTemplate("MyPLMTemplate”,destination)
[…]
EndModifyTemplate(tmp) /* End of PLM Template Instantiation */
listOfInstances = tmp->GetAttributeObject("CreatedInstances")
listOfReferences = tmp->GetAttributeObject("CreatedReferences")

Example 4

This code instantiates a template that is located in the resource table as instantiationMode. The template is saved with the Duplicate components with new evolution algorithm option and the first instantiation is performed with this option.

let templateInstance(TemplateInstance)
let destinationOfInstantiation(Feature)

let lPLMIDs(List)
let productSearchresults(List)
let productPLMResult(PLMQueryResult)
let productSearchQuery (PLMQuery)

//** List of items to be revised. This is searched using PLMQuery.
//** The item to be searched (prd-39480499-00018316 in current case) 
//** must be instantiated previously using Evolution option.
//** If not, such items will not be considered for revisioning.
//** In such cases, instantiation will be done as usual. Revisioning will not be done.

productSearchQuery = CreatePLMQuery("VPMReference")
productSearchQuery->AddCriterion("PLM_ExternalID","prd-39480499-00018316")
productSearchresults = productSearchQuery->RunQuery()
if productSearchresults.Size()<>1
exit

productPLMResult = productSearchresults[1]
lPLMIDs.Append(productPLMResult)

let partSearchresults(List)
let partPLMResult(PLMQueryResult)
let partSearchQuery (PLMQuery)

partSearchQuery = CreatePLMQuery("VPMReference")
partSearchQuery->AddCriterion("PLM_ExternalID","prd-39480499-00018318")
partSearchresults = partSearchQuery->RunQuery()
if partSearchresults.Size()<>1
exit

partPLMResult = partSearchresults[1]
lPLMIDs.Append(partPLMResult)

let instMode(TemplateInstantiationOptionsType)
instMode = new("TemplateInstantiationOptionsType","PartNode",NULL)
instMode.InsideInstantiationMode = 0
instMode.ItemsForRevision = lPLMIDs

destinationOfInstantiation = GetEditorRoots("VPMReference")->GetItem(1)
templateInstance = InstantiateTemplate("Templ1",destinationOfInstantiation, instMode)
if templateInstance <> NULL
{
Message("Template Instantiated OK")
}

EndModifyTemplate(templateInstance)

Example 5

This code creates a revision of a generic model. Items to be revised are searched using PLMQuery.

let templateInstance(TemplateInstance)
let destinationOfInstantiation(Feature)

let lPLMIDs(List)
let productSearchresults(List)
let productPLMResult(PLMQueryResult)
let productSearchQuery (PLMQuery)

//** List of items to be revised. This is searched using PLMQuery.
//** The item to be searched (prd-39480499-00018316 in current case) 
//** must be instantiated previously using Evolution option.
//** If not, such items will not be considered for revisioning.
//** In such cases, instantiation will be done as usual. Revisioning will not be done.

productSearchQuery = CreatePLMQuery("VPMReference")
productSearchQuery->AddCriterion("PLM_ExternalID","prd-39480499-00018316")
productSearchresults = productSearchQuery->RunQuery()
if productSearchresults.Size()<>1
	exit

productPLMResult = productSearchresults[1]
lPLMIDs.Append(productPLMResult)

let partSearchresults(List)
let partPLMResult(PLMQueryResult)
let partSearchQuery (PLMQuery)

partSearchQuery = CreatePLMQuery("VPMReference")
partSearchQuery->AddCriterion("PLM_ExternalID","prd-39480499-00018318")
partSearchresults = partSearchQuery->RunQuery()
if partSearchresults.Size()<>1
	exit

partPLMResult = partSearchresults[1]
lPLMIDs.Append(partPLMResult)

let instMode(TemplateInstantiationOptionsType)
instMode = new("TemplateInstantiationOptionsType","PartNode",NULL)
instMode.InsideInstantiationMode = 0
instMode.ItemsForRevision = lPLMIDs

destinationOfInstantiation = GetEditorRoots("VPMReference")->GetItem(1)
templateInstance = InstantiateTemplate("Templ1",destinationOfInstantiation, instMode)
if templateInstance <> NULL
{
	Message("Template Instantiated OK")
}

EndModifyTemplate(templateInstance)

Example 6

This code instantiates a template using different loading modes. This template is saved with Loading mode while instantiation option and the template can be instantiated by using ForceEditMode,ForceVisuMode , and ForcePLMMode attribute of the EKL instantiate template method. Following example shows the template instantiation using various loading modes:

let templateInstance(Feature)
let destinationOfInstantiation(VPMReference)
//**ForceEditModeAtrribute is applied on TemplateInstantiationOptionsType to get edit mode

let instMode(TemplateInstantiationOptionsType)
instMode = new("TemplateInstantiationOptionsType","PartNode",NULL)
inMode.InsideInstantiationMode = 0
//instMode.ForceVisuMode=True
//instMode.ForcePLMMode=True
instMode.ForceEditMode=True
templateInstance = InstantiateTemplate("Temp1",destinationOfInstantiation,instMode)

if templateInstance <> NULL
{
         EndModifyTemplate(templateInstance)
}

IsPatternInstanceLocked

Method used to specify if an instance is locked (only used by the Knowledge Pattern Feature).

Signature

IsPatternInstanceLocked(patternInstance: Feature) : Boolean

Arguments

Name Input / Output Required? Type Comment
patternInstance In Yes Feature If the answer is true, the instance is locked. If the answer is false, the instance is not locked.

ReturnType

Boolean

LockPatternInstance

The method used to lock the instance instantiated by the CreateOrModifyTemplate or CreateOrModifyDatum functions hence avoiding the modification of this instance. A new affectation or an attribute modification does not modify the instance (only used by the Knowledge Pattern Feature).

Signature

LockPatternInstance(patternInstance: Feature, doLock: Boolean)

Arguments

Name Input / Output Required? Type Comment
patternInstance In Yes Feature Indicates the pattern.
doLock In Yes Boolean If set to true, the instance is locked. If set to false, the instance is not locked.

ReplaceInstance

Lets you replace an instance by another one when editing a structure.

Signature

ReplaceInstance(iToReplace : PLMEntity, iReplacingRef : PLMEntity) : PLMEntity

Arguments

Name Input / Output Required? Type Comment
iToReplace In Yes PLMEntity Takes an instance (iToReplace) and replaces it with an instance of iReplacingRef which is a Reference. The returned object is the created instance. ReplaceInstance should reroute all possible links from the original instance to the replacing one, especially links that can be resolved such as links on publications (if the original publications match the replacing ones in terms of name and type.)
Note: Replacing instances was already possible by using ManageInstance. But ManageInstance relies on an ARM/PRM path where ReplaceInstance works with any instance available in session. The equivalent functionality is available interactively by using the Replace menu.
iReplacingRef In Yes PLMEntity

ReturnType

PLMEntity

PLMEntity.CreateConstraint()

Method used to create a constraint for a given product.

Note: To view an example, import the CreateCabinFromExcelFile.3dxml file located in win_b64\startup\Knowledgeware\EKL Samples\Sample2 in the installation folder.

Signature

PLMEntity.CreateConstraint(destination: PLMEntity, name: String, type: String [, element: ObjectType, ..]) : UndefinedType

Arguments

Name Input / Output Required? Type Comment
destination In Yes PLMEntity -
name In Yes String Indicates the name of the created constraint. If a constraint with the same name already exists, it is replaced by the new one. If the constraint name is missing, the default constraint name is used instead.
type In Yes String Indicates the Assembly Constraint type. For example, an angle.
element In No ObjectType
  • The object on which the constraint is created. It is retrieved using a path string created using the CreatePathString method.
  • In the context of Know-how apps, the object passed can be a KWEpointer.
Note: List of available constraints:
Input Type Returned Object Type Valid Inputs Types
Angle MRXAngle Line, Line
Line, Plane
Plane, Plane
Hinge MRXHinge Plane, Plane, Line
Coincidence MRXCoincidence Line, Line
Line, Plane
Plane, Plane
Point, Cone
Point, Curve
Point, Cylinder
Point, Line
Point, Plane
Point, Point
Point, Sphere
Point, Surface
Contact MRXContact Circle, Cone
Circle, Sphere
Cone, Cone
Cylinder, Cylinder
Plane, Cylinder
Plane, Plane
Plane, Sphere
Sphere, Cone
Sphere, Sphere
Distance MRXDistance Line, Line
Line, Plane
Plane, Plane
Point, Line
Point, Plane
Point, Point
Fix MRXFix AxisSystem
VPMInstance
FixTransfo MRXFixTransfo AxisSystem
VPMInstance
FixTogether MRXFixTogether AxisSystem, AxisSystem
VPMInstance, AxisSystem
VPMInstance, VPMInstance
FixTogetherTransfo MRXFixTogetherTransfo AxisSystem, AxisSystem
VPMInstance, AxisSystem
VPMInstance, VPMInstance
Length MRXLength Point, Curve
Parallelism PRXParallelism Line, Line
Line, Plane
Plane, Plane
Perpendicularity MRXPerpendicularity Line, Line
Line, Plane
Plane, Plane
Projection MRXProjection AxisSystem, Surface, Point
Roll MRXRoll Curve, Curve
Slide MRXSlide Curve, Curve
Symmetry MRXSymmetry VPMInstance, VPMInstance, Plane
Line, Line, Plane
Plane, Plane, Plane
Point, Point, Plane
Tangency MRXTangency Plane, Surface

ReturnType

UndefinedType

PLMEntity.CreatePublication()

The method used to publish either an object or a publication for a given product.

Signature

PLMEntity.CreatePublication(destination: PLMEntity, instance: VPMInstance, published element: ObjectType, name: String) : String

Arguments

Name Input / Output Required? Type Comment
destination In Yes PLMEntity Indicates the product to which the created publications belong.
instance In Yes VPMInstance Indicates the product instance to which the published element belongs.
published element In Yes ObjectType -
name In Yes String Indicates the name of the new Publication (if a publication with the same name exists, it is replaced by the new one and if the publication name is missing, the pointed element name is used instead.)

ReturnType

String

Example

product1.1 -> createpublication(product1.1\part2.1,part2\partbody\
plane.2,"plane")

PLMEntity.DeletePublication()

Signature

PLMEntity.DeletePublication(publisher: PLMEntity, pubname: String)

Arguments

Name Input / Output Required? Type Comment
publisher In Yes PLMEntity -
pubname In Yes String -

PLMEntity.ListPublications()

Lets you get the list of publications created on the object on which it is called. The list contains strings that correspond to the publication names.

Signature

PLMEntity.ListPublications() : List

ReturnType

List

Example

  1. Create a knowledge action and make "iPrd : VPMReference" an input of this action.
  2. Enter the following script:
    Let lPubs(List)
    lPubs = iPrd->ListPublications()
    if lPubs.Size() == 1 AND lPubs[1] == "MyPoint"
    {
    	iPrd->CreatePublication(NULL,iPrd->Find("Point","x.Name==\"MyPoint2\"",TRUE), "PubCreatedDuringTheAction")
    	lPubs = iPrd->ListPublications()
    	if lPubs.Size() == 2
    	{
    		Message("OK")
    	}
    }
    
  3. Execute the action on the product containing the publication.
  4. Check that it displays "OK" and that a new publication was created under the product.

DatabaseObjectType.RenamePublication()

Signature

DatabaseObjectType.RenamePublication(pubname: string, newpubname: String, automaticRelink: Boolean): VoidType

Arguments

Name Input / Output Required? Type Comment
pubname In Yes String Name of the existing publication to be renamed.
newpubname In Yes String New name to be assigned to the existing publication.
automaticRelink In No Boolean Optional Argument.

Default Value = FALSE .

Boolean variable specifies whether automatic linking should be done.

Return Value

None (VoidType)

Example

// Case I 
let myRef(VPMReference)
[...]

let automaticRelink(Boolean)
automaticRelink = TRUE

myRef->RenamePublication( "pubName" , "newpubName"   , automaticRelink)


// Case ll
let myRef(VPMReference)
[...]

//  let automaticRelink(Boolean)
//  Third argument is an optional argument
//   If nothing passed the default Value is   FALSE

myRef->RenamePublication( "pubName" , "newpubName")

DatabaseObjectType.ModifyPublication()

Signature

DatabaseObjectType.ModifyPublication(instance: physical product instance, published element: Object type, pubname: string): VoidType

Arguments

Name Input / Output Required? Type Comment
instance In Yes VPMInstance An instance can be given as input in order to solve ambiguity on multi instantiated context, if NULL any instance path available will be chosen.

It indicates the product instance to which the published element belongs.

Published element In Yes ObjectType The feature to publish can be either directly a feature or a KWEPointer (in Know How apps contexts).
pubname In Yes String Existing publication name.

Return Value

None (VoidType)

Example

// Retrive myRef,  instanceContainingThePoint,  pointToPublish
let myRef(VPMReference)
let instanceContainingThePoint(VPMInstance)
let pointToPublish(Point)
[...]

// "PointPublication" is name of existing publication belonging to myRef

myRef ->  ModifyPublication (  instanceContainingThePoint  , pointToPublish  ,  "PointPublication" ) 

PLMEntity.CreatePathString()

The method used to identify an object in the tree in the form of a string starting with the root of the path and ending with the final element (an object or a publication) for a given assembly.

Note: The result of this method can be used in the following functions or methods:
  • CreateConstraint
  • Access
  • SetMaterialCore
  • CenterGraph
  • AddToSelection

Signature

PLMEntity.CreatePathString(root: PLMEntity, instance: VPMInstance, element: ObjectType) : String

Arguments

Name Input / Output Required? Type Comment
root In Yes PLMEntity Indicates the beginning (root) of the path.
instance In Yes VPMInstance Indicates the product instance to go through to reach the final element of the path.
element In Yes ObjectType Indicates the final element of the path (this particular element can be either an Object or a Publication Name)

ReturnType

String

Example 1



CreatePathString(I.2, P1)
Which corresponds to the following path: I.2/ShapeProd.1/PartBody/P1.

Example 2

pathPubPlane=Root -> CreatePathString(Product1.1, "Plane")

PLMEntity.ManageInstance()

The method used to return the created or replaced product instance. The Product or Part reference document must be either directly linked by an ARM table description or a part family element.

PLMEntity.ManageInstance(product: PLMEntity, resource (catalog, chapter, product, 3D Shape): String, queryExpression: String, instanceName: String) : PLMEntity

Arguments

Name Input / Output Required? Type Comment
product In Yes PLMEntity -
resource (catalog, chapter, product, 3D Shape) In Yes String

Note: chapterName is not required because resource tables can directly reference catalog chapters.

queryExpression In Yes String Filter allowing to obtain one element to instantiate it. Its behavior depends on what is referenced in the resources table:
  • A product reference: the product is instantiated. The queryExpression is useless and not used in this case.
  • A 3D shape representation: the 3D shape is instantiated. The queryExpression is useless and not used in this case.
  • A catalog or a chapter: the queryExpression is used to filter the catalog or chapter. It must return only one catalog item (otherwise, an evaluation error is raised.) This item has to refer to either a product reference or a 3D shape representation or a component family item. In those cases, the object is instantiated.

  • A Library or a class: the queryExpresson is used to filter the library or class. It has to return only one classified item (otherwise, an evaluation error occurs.) This item must refer to either a product reference or a 3D shape representation, or a component family item. In those cases, the object is instantiated.

    A query expression is written in User Query Language (UQL). UQL queries are used on Classification Attributes assigned to class. Classification attributes need to be indexed before its use.

    Some examples for UQL queries are:

instanceName In Yes String The ManageInstance method either creates or replaces a product instance. This argument is used to retrieve the instance, if any. It is also used to rename the created instance.

ReturnType

PLMEntity

Example 1

let newInstance (Product)
...
/* Creates or replaces the instance under Product1 of name "Instance of MyPart" 
This instance is the instance of the part pointed by the catalog description MyPart 
in the catalog ARM. */
newInstance = Product1  -> ManageInstance("MyPart", "","", "Instance of MyPart)

Example 2

let newInstance (Product)
...
/* Creates or replaces the instance under Product1 of name "Instance of Bolt part family item"
This instance is a part family instance, found in family ISO_4014_GRADES_A_B_HEXAGON_HEAD_BOLT in the
catalog pointed by the resource name in the resource table */
set newInstance = Product1  -> ManageInstance("Bolt","ISO_4014_GRADES_A_B_HEXAGON_HEAD_BOLT", "PartNumber == 
\"ISO 4014 BOLT M2x16 STEEL GRADE A 
HEXAGON HEAD\"","Instance of Bolt part family item")

Note: Remember that in this case, the \" code is used to specify a string within a string.

Example 3

// Declare VPMReferences 
let fatherRef(VPMReference)
let createdInstance(VPMInstance)

// Assign current product to one VPMreference 
fatherRef = `Assembly A.1`

let queryStr(string)
// Create query using indexed attribute. This is the case when product is associated with indexed attribute.
//We have indexed PadConfig as interger type classification attribute 
queryStr = '[PadConfig]:5'
// ResourceLibrary is Library item added in resource table
set createdInstance = fatherRef->ManageInstance("ResourceLibrary",queryStr,"RectInstance1")
if createdInstance <> NULL
{
	Message("ManageInstance successful. Instance Created.")
}

//The query should be written without units, just using dimensions in MKS.

Example 4

// Declare VPMReferences 
let fatherRef(VPMReference)
let createdInstance(VPMInstance)

// Assign current product to one VPMreference 
fatherRef = `Assembly A.1`

let queryStr(string)
// Create query using indexed attribute. This is the case when component family items are associated with indexed attribute.
queryStr = '[PadLength]:0.02'
// ResourceLibrary is Library item added in resource table
set createdInstance = fatherRef->ManageInstance("ResourceLibrary",queryStr,"RectInstance1")
if createdInstance <> NULL
{
	Message("ManageInstance successful. Instance Created.")
}

//The query should be written without units, just using dimensions in MKS.

PLMEntity.RemoveInstance()

This method is used to remove the product instance whose name is given as an argument. This method only works for a physical product.

Signature

PLMEntity.RemoveInstance(product: PLMEntity, instanceName: String) : PLMEntity

Arguments

Name Input / Output Required? Type Comment
product In Yes PLMEntity -
instanceName In Yes String -

ReturnType

PLMEntity

Example

product1.removeinstance("instance of MyPart")

The example above shows how to remove the instance created in the above example 1 to illustrate the manageInstance function.

DatabaseObjectType.GetPhysicalId()

This function retrieves the Physical ID or Object ID of database object types for use in automation scenarios.

Signature

DatabaseObjectType.GetPhysicalId() : String

ReturnType

String PhysicalID of DatabaseObjectType in String format

Example

//Retrieve list of root objects of current editor
Let roots(List)
Let rootOfEditor(VPMReference)
Let PhysicalID(String)	

roots = GetEditorRoots("VPMReference")

//Select first root object from list  and get PhysicalID of object
rootOfEditor = roots[1]
PhysicalID = rootOfEditor->GetPhysicalId()
if( PhysicalID<>NULL)
{
	Message("Physical ID of PLMEntity TestProduct is =  #",  PhysicalID)
}
else
{
	Message("ERROR !! Select Valid PLMEntity")
}

VPMInstance.CreateContextualConstraint()

Method used to create a contextual constraint that is to say you can create a constraint in a Product that references data located outside this Product.

Signature

VPMInstance.CreateContextualConstraint(destination: VPMInstance, context: PLMEntity, name: String, type: String [, element: ObjectType, ..]) : UndefinedType

Arguments

Name Input / Output Required? Type Comment
destination In Yes VPMInstance -
context In Yes PLMEntity -
name In Yes String -
type In Yes String -
element In No ObjectType -


This constraint is not contextual, it is created at Instance1 level and only references the items located below Instance1.


This constraint is a contextual one and it is created below SubInstance2. It references external items contained in SubInstance1.

ReturnType

UndefinedType

Important:
  • The first argument, which is a contextual constraint, must be an instance that contains every instance referenced by the constraint (see picture 2.)
  • The paths indicated must start at the instance context.