Generative Functions  

CreateOrModifyTemplate CreateOrModifyDatum EndModifyTemplate
GenerateScript InstantiateTemplate IsPatternInstanceLocked
LockPatternInstance CreatePathString CreatePublication
CreateConstraint ManageInstance RemoveInstance

 

Make sure that you have the KT1 license to use the functions listed here below.

CreateOrModifyTemplate

This method is only used in the Knowledge Pattern Feature. For more information about this feature, see Product Knowledge Template User's Guide.

Enables you 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.

  • TemplateId: Indicates the name of the feature.
    • If the templates are stored in catalogs, the first part of the argument is the ARM path or the catalog name. 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: Indicates the destination feature (PartBody, ...).
  • PatternList: Indicates the pattern list.
  • IndexInPatternList: Indicates the index number in the pattern list.

Syntax

udf = CreateOrModifyTemplate("PktARMcatalog2|BoxUDF", PartBody, Boxes, i)

udf = CreateOrModifyTemplate("UserFeature1", `Geometrical Set.1` , Boxes, i)

 

EndModifyTemplate

Enables you to launch the update of the instantiated feature after modifying its inputs.

  • Featuree: object returned by the CreateOrModifyTemplate function.
The EndModifyTemplate function can only be used together with the CreateOrModifyTemplate and the InstantiateTemplate ones.

Syntax

EndModifyTemplate(udf)

CreateOrModifyDatum

This method is only used in the Knowledge Pattern Feature. For more information about this feature, see Product Knowledge Template User's Guide.

Enables you to create or modify a datum.

  • datumType: Indicates the datum type: Point, Line, Curve, Circle, Surface, Plane, Volume..
  • Destination: Indicates the destination feature (PartBody, ...).
  • PatternList: Indicates the pattern list.
  • IndexInPatternList: Indicates the index number in the pattern list.

Syntax

 

LockPatternInstance

This method is only used in the Knowledge Pattern Feature. For more information about this feature, see Product Knowledge Template User's Guide.

Enables you 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.

  • patterninstance: Indicates the pattern.
  • doLock: If set to true, the instance is locked. If set to false, the instance is not locked.

IsPatternInstanceLocked

This method is only used in the Knowledge Pattern Feature. For more information about this feature, see Product Knowledge Template User's Guide.

Enables you to specify if an instance is locked.

  • Feature: if set to true, the instance is locked. if set to false, the instance is not locked.

InstantiateTemplate

Enables you to instantiate any type of template. This method is available in the Actions editor and in BKT. The input of this method is an ARM catalog which can contain any type of templates (PowerCopies, User Features and Document Templates) and the second argument being the destination in the Part or the Product.

GenerateScript()  

Enables you to launch a Generative Script from an Expert Rule.

Syntaxx

GenerateScript(E:...script.CATGScript","PartName","Function")

Where

Example

if (pa.Name == pa.Name)
GenerateScript("....script.CATGScript","PartName","Function","PartName2","MyPart")

CreatePathString  

Syntax

CreatePathString(Instance:Product, Element:Feature/String):String

Enables you to generate a path string in order to access either a feature or a publication for a given assembly.

  • Product: Indicates the path of the top root product
  • Instance: Indicates the product instance to which the final element belongs to.
  • Element: Indicates the final element. This element can be either a Feature or a Publication Name.

Example

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

CreatePublication  

Syntax

CreatePublication ((Instance:Product, Element:Feature/String, Name:String)

Enables you to publish either a feature or a publication for a given product.

  • Product: Indicates the Product to which the created publications belongs to.
  • Instance: Indicates the Product Instance to which the published element belongs to.
  • Element: Indicates the final element. This element can be either a Feature or a Publication Name.
  • Name: Indicates the name of the new Publication.
    If a publication with the same name exists, it is replaced by the new one.
    If the publication name is missing, the pointed element name is used instead.

Example

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

 CreateConstraint  

Syntax

Product > CreateConstraint (Type:String, Name:String, element1:String, element2:String, …):Constraint

Enables you to create a constraint for a given product.

  • Product: Indicates the Product to which the created constraint belongs to.
  • Type: Indicates the Assembly Constraint type. For example, an Offset
  • Name: 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.
  • ElementN: Indicates the list of elements to be constrained. The string of an element argument matches the path from the destination to the element i.e. The path string from a Product to an Element.
  • Function:  It returns the created constraint.

List of available constraints

Constraint type

Example

  • Fix

let pathstring1 (String)

let pathstring2 (String)

 

pathstring1 = Root > CreatePathString(Part3.1,Part3\PartBody\Plane.1 )
pathstring2 = Root > CreatePathString(Product1.1\Part2.1 ,Part2\PartBody\Plane.2 )

Root > CreateConstraint("MyFixConstraint","Fix",pathstring1)

 

  • Offset

let pathPubPlane(String)

let ctr(MfLengthConstraint)

 

Product1.1 > CreatePublication(Product1.1\Part2.1 , Part2\PartBody\Plane.2 , "Plane")

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

ctr = Root > CreateConstraint("MyOffsetConstraint","Offset", pathPubPlane, "Part3.1\Part3\PartBody\Plane.1") ctr.MfLength = 50mm

 
  • Coincidence

let pathstring1 (String)

let pathstring2 (String)
 

pathstring1 = Root  > CreatePathString(Part3.1,Part3\PartBody\Plane.1 )

pathstring2 = Root  > CreatePathString(Product1.1\Part2.1 ,Part2\PartBody\Plane.2 )

Root > CreateConstraint("MyCoincidenceConstraint","Coincidence",pathstring1,pathstring2)

 

  • Angle

let pathstring1 (String)

let pathstring2 (String)

 

pathstring1 = Root  > CreatePathString(Part3.1,Part3\PartBody\Plane.1 )

pathstring2 = Root  > CreatePathString(Product1.1\Part2.1 ,Part2\PartBody\Plane.2 )

Root > CreateConstraint("MyAngleConstraint","Angle",pathstring1,pathstring2)

 

  • Planar Angle

let pathstring1 (String)

let pathstring2 (String)

let pathstring3 (String)

 

pathstring1 = Root > CreatePathString(Part3.1,Part3\PartBody\Plane.1   )

pathstring2 = Root > CreatePathString(Product1.1\Part2.1 ,Part2\PartBody\Plane.2  )

pathstring3 = Root > CreatePathString(Product1.1\Part2.1 ,Part2\PartBody\Sketch.2   )

 

Message("# | #",pathstring1, pathstring2, pathstring3)

 

Root > CreateConstraint("MyPlanarAngle","Planarangle",pathstring1, pathstring2, pathstring3)

 

  • Parallelism

let pathstring1 (String)

let pathstring2 (String)

 

pathstring1 = Root  > CreatePathString(Part3.1,Part3\PartBody\Plane.1 )

pathstring2 = Root  > CreatePathString(Product1.1\Part2.1 ,Part2\PartBody\Plane.2 )

Root > CreateConstraint("MyParallelismConstraint","Parallelism",pathstring1,pathstring2)

 

  • Perpendicularity

let pathstring1 (String)

let pathstring2 (String)

 

pathstring1 = Root  > CreatePathString(Part3.1,Part3\PartBody\Plane.1 )

pathstring2 = Root  > CreatePathString(Product1.1\Part2.1 ,Part2\PartBody\Plane.2 ) Root > CreateConstraint("MyPerpendicularityConstraint","Perpendicularity",pathstring1,pathstring2)

 

  • Surface Contact

let pathstring1 (String)

let pathstring2 (String)

 

pathstring1 = Root  > CreatePathString(Product1.1\Part2.1 ,Part3\PartBody\Pad.1 )

pathstring2 = Root  > CreatePathString(Product1.1\Part2.1 ,Part2\PartBody\Pad.1 )

Root > CreateConstraint("MySurfaceContactConstraint","SurfaceContact",pathstring1,pathstring2)

 

  • Line Contact

let pathstring1 (String)

let pathstring2 (String)

 

pathstring1 = Root  > CreatePathString(Product1.1\Part2.1 ,Part3\PartBody\Line.1 )

pathstring2 = Root  > CreatePathString(Product1.1\Part2.1 ,Part2\PartBody\Line.1 )

Root > CreateConstraint("MyLineContactConstraint","LineContact",pathstring1,pathstring2)

 

  • Point Contact

let pathstring1 (String)

let pathstring2 (String)

 

pathstring1 = Root  > CreatePathString(Product1.1\Part2.1 ,Part3\PartBody\Point.1 )

pathstring2 = Root  > CreatePathString(Product1.1\Part2.1 ,Part2\PartBody\Point.1 )

Root > CreateConstraint("MyPointContactConstraint","PointContact",pathstring1,pathstring2)

 

  • Line Annular Contact

let pathstring1 (String)

let pathstring2 (String)

 

pathstring1 = Root  > CreatePathString(Product1.1\Part2.1 ,Part3\PartBody\Line.1 )

pathstring2 = Root  > CreatePathString(Product1.1\Part2.1 ,Part2\PartBody\Line.1 )

Root > CreateConstraint("MyLineAnnularContactConstraint","LineAnnularContact",pathstring1,pathstring2)

 

 ManageInstance

Syntax

Product > ;ManageInstance(arm: String, chapterName : String, query : String, instanceName : String): Product

It returns the created or replaced product instance. The Product or Part reference document has to be either directly linked by a ARM catalog description or a resolved part family element.

  • arm: This argument is an Application Resource Management string. It is composed of two parts separated by "|" (pipe) : “<catalogName>|<value of the keyworld “Logical Name” of a catalog description>”. The catalog description has to reference either a CATPart document or a CATProduct document (case 1), or a catalog document (case 2).
  • chapterName: This argument is only used in case 2. In that case, the ARM resource is a catalog document, and if the chapterName argument is specified, the system looks for the catalog chapter of this name.
  • query: This argument is only used in case 2. in that case, the query is used to retrieve the part family elements that fit this query, either in a specific chapter i.e. the chapterName argument is filled, or in the whole catalog.
  • instanceName: The ManageInstance method either creates or replaces a product instance. This argument is used to retrieve the existing instance, if any. It is also used to rename the created instance.

Example

Case 1:
let newInstance (Product)
...
/* Creates or replace 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("ARM|MyPart", "", "", "Instance of MyPart)
In this case, second and third arguments are useless.

Case 2:
let newInstance (Product)
...
/* Creates or replace 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("ARM|Bolt", "ISO_4014_GRADES_A_B_HEXAGON_HEAD_BOLT", "x.PartNumber == \"ISO 4014 BOLT M2x16 STEEL GRADE A HEXAGON HEAD\"", "Instance of Bolt part family item")
Keep in mind that  \" is used to specify a string within a string

 RemoveInstance

  • instanceName: Indicates the name of the product instance to remove.

Example

It removes the instance created in the example given in Case 1 to illustrate the  ManageInstance function.

product1.removeinstance("instance of MyPart")