CreateOrModifyDatum
Method used to create or modify a datum (only used by the Knowledge Pattern Feature).
SignatureCreateOrModifyDatum(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.
Exampleudf = 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.
CreateOrModifyTemplate
Method used to instantiate a user feature. You can access and modify the inputs of this user feature by using the type attributes (xxx.input name or xxx. output name) and the published name (only used by the Knowledge Pattern Feature).
SignatureCreateOrModifyTemplate(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 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 created object at the end of the list, so 0 index should not be used in conjunction 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. |
Exampleudf = 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
Function used to trigger the update of the instantiated Object after modifying its inputs.
SignatureEndModifyTemplate(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, the following 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 the
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 . The InstantiateTemplate method
allows to template entries and parameters: Once done, it is necessary to use
EndModifyTemplate because if it is not used, it will not
work. Note:
Remember that:
- This method returns an object
representing the template but which 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.
- Visualizable: Show, Color,
Layer, Pick
- GeometricalFeature:
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 set inputs that are out of the destination context
indicated in the
InstantiateTemplate function using the
RootContext attribute. This attribute can be set 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 multi-root context. The
CreatedInstances
and CreatedReferences attributes are available on the
instantiation object to retrieve the objects created by the template.
SignatureInstantiateTemplate(templateId (ARM): String, destination: Feature) : UndefinedType
Arguments
Name | Input / Output | Required? | Type | Comment |
templateId (ARM) | In | Yes | String | - |
destination | In | Yes | Feature | - |
Example 1let S(Surface)
let temp (Feature)
temp= InstantiateTemplate ("ARM", destination)
temp.SetAttributeObject("Input",...)
temp.SetAttributeObject("Input",...)
EndModifyTemplate(temp)
Example 2myTemplate = CreateOrModifyTemplate(...)
myTemplate.PointA = x
myTemplate.PointB = y
myTemplate.Radius = z
EndModifyTemplate(myTemplate)
myTemplate.Name = "MyTemplateInstance" Example 3let 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")
IsPatternInstanceLocked
Method used to specify if an instance is locked (only used by the Knowledge Pattern Feature).
SignatureIsPatternInstanceLocked(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. |
LockPatternInstance
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).
SignatureLockPatternInstance(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.
SignatureReplaceInstance(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 easily 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 |
PLMEntity.CreateConstraint()
Method used to create a constraint for a given product.
SignaturePLMEntity.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 | - |
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 |
PLMEntity.CreatePublication()
Method used to publish either an object or a publication for a given product.
SignaturePLMEntity.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 belongs |
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) |
Exampleproduct1.1 -> createpublication(product1.1\part2.1,part2\partbody\
plane.2,"plane")
PLMEntity.DeletePublication()
SignaturePLMEntity.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.
SignaturePLMEntity.ListPublications() : List
Example- Create a knowledge action and make "iPrd : VPMReference" an input of this action.
- 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")
}
}
- Execute the action on the product containing the publication.
- Check that it displays "OK" and that a new publication was created under the product.
PLMEntity.CreatePathString()
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
SignaturePLMEntity.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) |
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()
Method used to return the created or replaced product instance. The Product or Part reference document has to be either directly linked by an ARM table description or a part family element.
SignaturePLMEntity.ManageInstance(product: PLMEntity, resource (catalog, chapter, library, class, 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 | Resource name to be used. Resources can be catalog, chapter, library, class, product, or 3D
shape. |
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 has to return only one catalog item (otherwise, an evaluation error is raised). This item has to refer either a product reference or a 3D shape representation or a component family item. In those cases, the object is instantiated.
-
A library or class: A query expression is written in
User Query Language (UQL). The query Expression is
used to filter the library or class. It has to
return only one classified item (otherwise, an
evaluation error occurs). 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.
|
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. |
Example 1let 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 2let 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 ARM description in the catalog ARM */
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 that \" is used to specify a string within a string.
Example 3: Instantiation of Product/Part Classified in Library/Class
// 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: Instantiation of Component family item classified in Library/Class
// 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.
UQL Queries
[<Classification Attribute>]:<Attribute value>
'[PadConfig]:5'
[<Classification Attribute>]:<Attribute value> AND [<Classification Attribute>]:<Attribute value>
[<Classification Attribute>]:<Attribute value> AND [<Classification Attribute>]><Attribute value>
‘[PadConfig]:5 AND [PadLength]>0.02’
PLMEntity.RemoveInstance()
Method used to return the name of the product instance to remove.
SignaturePLMEntity.RemoveInstance(product: PLMEntity, instanceName: String) : PLMEntity
Arguments
Name | Input / Output | Required? | Type | Comment |
product | In | Yes | PLMEntity | - |
instanceName | In | Yes | String | - |
Exampleproduct1.removeinstance("instance of MyPart") The example above shows how to remove the instance created in the above example 1 to illustrate the manageInstance function.
VPMInstance.CreateContextualConstraint()
Method used to create a contextual constraint that is to say you can create a constraint in a Product which references data located outside this Product.
SignatureVPMInstance.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, it is created below SubInstance2 and references external items contained in SubInstance1. |
|