Przeglądaj wersję html pliku:

Knowledge Template (ang)


Knowledge Template

Table Of Contents
Overview ...................................................................................................... 1 Product Knowledge Template in a Nutshell ...................................................... 1 Before Reading this Guide ............................................................................ 2 Getting the Most out of this Guide ................................................................. 2 Accessing sample documents ........................................................................ 2 Conventions Used in this Guide ..................................................................... 2 What's New? ................................................................................................. 3 New Functionalities...................................................................................... 3 Getting Started.............................................................................................. 5 Getting Started ........................................................................................... 5 Creating a Power Copy ................................................................................. 5 Basic Tasks ..................................................................................................11 Basic Tasks ...............................................................................................11 Managing Power Copies...............................................................................11 Managing Power Copies ............................................................................11 Saving a Power Copy in a Catalog ..............................................................11 Instantiating Power Copies........................................................................13 Storing a Design Table in a Power Copy ......................................................20 Power Copies: Useful Tips .........................................................................23 To know more about Power Copies.............................................................25 Managing User Features (UDFs) ...................................................................25 Managing User Features (UDFs).................................................................25 Introducing the User Feature Definition Window ...........................................26

iii

knowledgeTemplate Creating a User Feature (UDF)...................................................................31 Creating and Instantiating a NLS User Feature (UDF)....................................33 Saving a User Feature in a Catalog.............................................................38 Instantiating a User Feature ......................................................................41 Assigning a Type to a User Feature ............................................................53 Referencing User Features in Search Operations ..........................................55 To find out more about User Features ... .....................................................60 Managing Part and Assembly Templates ........................................................61 Managing Part and Assembly Templates......................................................61 Introducing the Document Template Definition Window.................................61 Creating a Part Template ..........................................................................64 lnstantiating a Part Template.....................................................................68 Adding an External Document to a Document Template ................................71 Document Templates: Methodology............................................................76 To find out more about Part and Assembly Templates... ................................77 To find out more about the Insert Object dialog box ... ....................................78 Interactive Templates Quick Reference ..........................................................81 User Features .........................................................................................81 Power Copies ..........................................................................................88 Part and Assembly Templates....................................................................90 Advanced Tasks ............................................................................................93 Advanced Tasks .........................................................................................93 Working with Scripting Templates .................................................................93 Working with Scripting Templates ..............................................................93 Creating a Script .....................................................................................94

iv

Table Of Contents Starting from a Script Skeleton..................................................................95 Generating the Result of a Script ...............................................................96 Using the Scripting Language .......................................................................96 Using the Scripting Language ....................................................................96 Script Structure.......................................................................................98 Object Properties.....................................................................................99 Comments............................................................................................ 101 Operators ............................................................................................. 102 Keywords ............................................................................................. 103 Variables .............................................................................................. 112 Limitations ........................................................................................... 113 Generative Script Objects ....................................................................... 113 Using The Get... Commands.................................................................... 114 Specifying a Context................................................................................. 118 Declaring Input Data................................................................................. 119 Reusing Input Data................................................................................... 124 Tips and Tricks......................................................................................... 129 About Generic naming ............................................................................ 129 Message "property does not exist..." ........................................................ 132 Message "feature could not be updated" ................................................... 132 Specifying a File Path (3 methods) ........................................................... 133 The Rectangular Pattern is not Generated ................................................. 134 Importing Sketches: Recommendation ..................................................... 134 Specifying Strings: Recommendation........................................................ 134 Use Cases ............................................................................................... 134

v

knowledgeTemplate Use Cases ............................................................................................ 134 The Tow Hook ....................................................................................... 135 The Ladder ........................................................................................... 140 The Pocket Calculator............................................................................. 141 Reference .................................................................................................. 145 Reference ............................................................................................... 145 Using the Object Browser .......................................................................... 145 Basic Wireframe Package........................................................................... 146 GSMPoint ............................................................................................. 146 GSMLine............................................................................................... 152 GSMPlane............................................................................................. 156 GSMCircle............................................................................................. 161 Part Design Package ................................................................................. 164 Box ..................................................................................................... 165 Chamfer............................................................................................... 165 Cone.................................................................................................... 167 Counterbored Hole................................................................................. 167 Counterdrilled Hole ................................................................................ 168 Countersunk Hole .................................................................................. 169 Cylinder ............................................................................................... 169 Hole .................................................................................................... 170 Pad ..................................................................................................... 171 Shaft ................................................................................................... 172 Shell.................................................................................................... 173 SimpleHole ........................................................................................... 174

vi

Table Of Contents Sphere................................................................................................. 175 Tapered Hole ........................................................................................ 175 Thickness ............................................................................................. 176 ThickSurface ......................................................................................... 176 Torus ................................................................................................... 178 Part Shared Package................................................................................. 178 Fillet Object .......................................................................................... 178 Constant Edge Fillet Object ..................................................................... 179 Pattern ................................................................................................ 180 Standard Package .................................................................................... 182 GSD Shared Package ................................................................................ 182 GSD Package ........................................................................................... 182 GSMAssemble ....................................................................................... 183 GSMCurve ............................................................................................ 183 GSMCurvePar........................................................................................ 184 GSMExtrude.......................................................................................... 185 GSMFillet.............................................................................................. 186 GSMProject........................................................................................... 186 GSMSplit .............................................................................................. 187 GSMSweepSegment ............................................................................... 188 Knowledge Expert Package ........................................................................ 188 KWECheck ............................................................................................ 189 KWERule .............................................................................................. 189 KWERuleBase........................................................................................ 190 KWERuleSet.......................................................................................... 190

vii

knowledgeTemplate Mechanical Modeler Package ...................................................................... 191 BodyFeature ......................................................................................... 191 Workbench Description ................................................................................ 193 Workbench Description ............................................................................. 193 Product Knowledge Template Menu Bar ....................................................... 193 Insert .................................................................................................. 194 Toolbars ................................................................................................. 194 Templates Creation Toolbar..................................................................... 194 Generative Knowledge Toolbar ................................................................ 194 Templates Instantiation Toolbar............................................................... 194 Project Standards ....................................................................................... 197 Customizing for Knowledge Template .......................................................... 197 Customizing.......................................................................................... 197 Knowledge............................................................................................ 197 Language ............................................................................................. 201 Report Generation ................................................................................. 202 Part Infrastructure for Knowledgeware Applications .................................... 205

viii

Overview
This book is intended for the user who needs to become quickly familiar with Product Knowledge Template. This overview provides the following information: • • • • • Product Knowledge Template in a Nutshell Before Reading this Guide Getting the Most out of this Guide Accessing sample documents Conventions Used in this Guide

Product Knowledge Template in a Nutshell
Interactive Creation of intelligent Product Knowledge Templates The encapsulation of feature, part and assembly specifications of any level of allows the capture of the design complexity within Product Knowledge Template methodology defined interactively in CATIA, as well as the reuse across the extended enterprise. Templates can be extracted from existing features, part and assembly designs or created specifically. They can contain not only geometry, but also any associated parameters or relations, including embedded intelligence of design rules, design tables and checks, providing the ability to encapsulate the specifications of sophisticated adaptive features. Editing and maintaining the Product Knowledge Templates The management of captured knowledge is easier thanks to the ability to edit and maintain templates in the same interactive way as modifying any CATIA part design (no programming skills required). This allows the templates to be adapted to the changing requirements of the organization, to accommodate improved methodologies or customer requirements. Storing of Product Knowledge Templates in CATIA Catalogs for re-use Once defined Product Knowledge Templates can be stored in CATIA Catalogs to allow easy access and management for reuse across the extended enterprise. Using scripting templates for a powerful solution CATIA Product Knowledge Templates provides a scripting language enabling full design specification and generation. Using a simple and declarative language, the user can describe - in text format - geometric specifications, transformation and positioning specifications (including assembly constraints), and knowledge specifications. Moreover, in order to make the creation of scripts still simple, powerful Knowledge Templates can be used as any script objects. Product Knowledge Template 2 provides the ability to easily and interactively capture engineering know-how and methodology for highly efficient reuse, helping the organization to share best practices and avoid duplication of effort through inability to reuse existing designs. 1

knowledgeTemplate

Before Reading this Guide
Before reading this guide, you should be familiar with basic Version 5 concepts such as document windows, standard and view toolbars. Therefore, we recommend that you read the Infrastructure User's Guide that describes generic capabilities common to all Version 5 products. It also describes the general layout of V5 and the interoperability between workbenches.

Getting the Most out of this Guide
To get the most of this guide, we suggest that you start performing the step-by-step Getting Started tutorial. Once you have finished, you should move on to the Basic and Advanced Tasks sections. The Workbench Description section, which describes the PKT workbench, and the Customizing section, which explains how to set up the options, will also certainly prove useful.

Accessing sample documents
To perform the scenarios, you will be using sample documents contained in either the online/pktug/samples folder. For more information about this, please refer to Accessing Sample Documents in the Infrastructure User's Guide.

Conventions Used in this Guide
To learn more about the conventions used in this guide, refer to the Conventions section.

2

What's New?
New Functionalities
Instantiating a Power Copy From a Macro This new functionality enables the user to instantiate a Power Copy using a VB macro. Instantiating a User Feature From a Macro This new functionality is a new way for the user to instantiate a User Feature using a VB macro.

3

Getting Started
Getting Started
Creating a Power Copy

Creating a Power Copy

This task shows how to create Power Copy elements, to be reused later. A Power Copy is a set of features (geometric elements, formulas, constraints and so forth) that are grouped in order to be used in a different context, and presenting the ability to be completely redefined when pasted. Before performing the scenario, make sure that the Parameters and Relations options are checked (Tools->Options->Infrastructure->Part Infrastructure>Display). 1. Open the PktCreatePowerCopy.CATPart document. The following image is displayed:

2. From the Start->Knowledgeware menu, access the Product Knowledge Template workbench. 3. Click the Create a PowerCopy icon ( box is displayed. ). The Power Copy Definition dialog

5

knowledgeTemplate

4. Select the elements making up the Power Copy from the specification tree. For the purposes of our scenario, select the following items: o o o o The Parameters The Relations Line.1 (under Geometrical set) The Geometry

The dialog box is automatically filled with information about the selected elements.

6

Getting Started

5. Define the Power Copy as you wish to create it: o The Definition tab lets you assign a name to the Power Copy and presents its components in the 3D viewer. For example, enter "Driver" in the Name: field.

o

The Inputs tab shows you the inputs (elements to select at instantiation) of the Power Copy. You can rename these elements for a clearer definition by selecting them in the viewer and entering a new name in the Name: field. In parentheses you still can read the elements' default name based on its type. For example, select

7

knowledgeTemplate

xy plane and rename it as "Plane1".

o

The Parameters tab lets you define which of the parameter values used in the Power Copy you will be able to modify at instantiation time. This can be a value, or a formula for example. Simply select the parameters and check the Published button. In case of a formula, you can set it to false or true. For example, select Driver_X_Position. Use the Name field to give another name to this element. For example, enter X_Position and publish it.

8

Getting Started

o

The Documents tab shows the complete path and role of Design tables referenced by an element included in the Power Copy. The Icon tab lets you modify the icon identifying the Power Copy in the specifications tree. A subset of icons is available from the Icon choice button. If you click ... the Icon Browser opens, showing all icons loaded on your CATIA session. Click the envelope icon .

o

The Grab screen button lets you capture an image of the Power Copy to be stored with its definition. Click the Grab screen button. You can zoom in or out the image to adjust it. Click the Remove preview button if you do not need this image. 6. Click OK to create the Power Copy. Save your file. Click here to open the created file. Refer to the Quick Reference topic for a comprehensive list of the interactions that can be carried out on Power Copies.

9

Basic Tasks
Basic Tasks

Managing Power Copies
Managing Power Copies

Refer to the Quick Reference topic for a comprehensive list of interactions to be carried out on Power Copies.

Create Power Copies: Select the Insert -> Advanced Replication Tools -> PowerCopy Creation command or click the Create a Power Copy icon ( ), select the elements making up the Power Copy from the specification tree, define a name for the Power Copy and its reference elements then choose an icon for identifying it. Instantiate Power Copies: Select the Insert -> Instantiate From Document command or click the Instantiate from Document icon ( ), select the document or catalog containing the Power Copy, complete the Inputs within the dialog box selecting adequate elements in the geometric area or in the specification tree. Save Power Copies into a Catalog: Select the Power Copy from the specification tree, select the Insert -> Advanced Replication Tools -> PowerCopy Save In Catalog... command, enter the catalog name and click Open. Creating a Power Copy

Saving a Power Copy in a Catalog

This task shows how to store Power Copy elements into a catalog, for later use as described in Creating a Power Copy.

11

knowledgeTemplate

1. Open the PktCreatedPowerCopy.CATPart file. The Power Copy is displayed below the Power Copy node. ) from the standard menu bar in the 2. Click the Save in Catalog icon ( PKT workbench. The 'Catalog save' dialog box is displayed.

3. Click the Create a new catalog option and click the button located on the right-hand side of the Catalog name field. The dialog box which is displayed allows you to specify a .catalog file where to store the created Power Copies. Enter a file name and click Open. 4. Click OK in the Catalog save dialog box. Note that this command is also available from the Part Design and the GSD workbenches. 5. Open the catalog you have just created (File->Open from the standard menu bar). The catalog which is displayed looks like the one below (depending on the name assigned to the catalog):

The left pane displays the Power Copy created within a tree structure. Selecting 3 inputs displays in the right pane the characteristics of the Power Copy. About the Reference tab The Power Copy name as well as the document it originates from is displayed. About the Keywords tab

12

Basic Tasks

The Power Copy name as well as its inputs are displayed. About the Preview tab The icon you have associated to the Power Copy (if any) is displayed. About the Generative Data tab The resolved queries: A resolved query is relevant for parts with design tables only since it aims at storing a filtered view of the design table data.

Using the Catalog Editor
1. From the Start->Infrastructure menu, access the Catalog Editor. 2. Double-click Chapter.1 (default chapter) and click the Add Family icon. The Component Definition Family is displayed. 3. Change the name of the family: Drivers and click OK. 4. Double-click the Drivers family and click the Add Component icon. 5. In the Description Definition dialog box, click the button, go back to the PktCreatePowerCopy.CATPart file and select the Driver Power Copy in the specification tree and click OK. 6. Save your catalog and proceed to the next task: Instantiating a Power Copy. To know more about catalogs, see the CATIA Infrastructure User's Guide. Refer to the Quick Reference topic for a comprehensive list of the interactions that can be carried out on Power Copies.

Instantiating Power Copies
Instantiating a Power Copy
This task shows how to instantiate a Power Copy once it has been created as described in Creating a Power Copy: • • • from a catalog from a document containing a Power Copy and from a selection



The Power Copy reference has links to the selected features. These selected features are the components of the Power Copy reference.

13

knowledgeTemplate



Each instantiation of a Power Copy reference is a copy of each of its components (Copied Features). After an instantiation, there is no link between the copied features and the reference components.



From a Catalog
1. Create an empty .CATPart file. ). The catalog 2. In the standard toolbar, click the Open Catalog icon ( browser is displayed. Select the PktPowercopycatalog.catalog file. To know how to store a Power Copy in a catalog, see Storing a Power Copy in a Catalog. 3. Click the icon. In the dialog box which is displayed, select the catalog which contains the Power Copy that you want to instantiate. Click Open to open the selected catalog. The dialog box which is displayed next enables you to navigate through the chapters and the families of the catalog until you can access the desired Power Copy.



To know more about catalogs, see the CATIA Infrastructure User's Guide. To know more about the Insert Object dialog box, click here.



4. Double-click the 'Driver' object. The Insert Object dialog box is displayed. 5. Click the Use identical name button and click OK. The Power Copy is instantiated.

14

Basic Tasks

6. Click Close in the Catalog Browser when done.

From a Document
1. Open the Pktvehicle.CATPart document. 2. From the Start->Knowledgeware Menu, access the Product Knowledge Template workbench. 3. Click the Instantiate from Document icon ( dialog box is displayed. ). The File Selection

Note that this command is also available from the Part Design and the GSD workbenches. 4. Select the PktCreatedPowerCopy.CATPart file and click Open. The Insert Object dialog box is displayed. • Click the Use identical name button. Click OK when done.



Click here to know more about the Insert Object Dialog box. Note that in some cases, when instantiating a Power Copy, the replacing element does not present the same sub-elements as the replaced element. Therefore you need to clearly indicate in a specific dialog box, the Replace Viewer, how to rebuild the geometry from the replacing element.

The Power Copy is instantiated into the document (see picture below.)

15

knowledgeTemplate

From a Selection
1. Open the PktCreatedPowerCopy.CATPart and the PktVehicle.CATPart files. 2. Tile the window vertically. 3. Expand the Power Copy node in the PktCreatedPowerCopy.CATPart file and click the Driver Power Copy. 4. Go to the PktVehicle.CATPart file and click the Instantiate from Selection icon ( ). The Insert Object dialog box is displayed.

5. Click the Use identical name button. Click OK when done. The Power Copy is instantiated. Refer to the Quick Reference topic for a comprehensive list of the interactions that can be carried out on Power Copies.

Instantiating a Power Copy From a VB Macro

This topic provides you with information about the instantiation of Power Copies using macros.

Until now it was possible to instantiate Power Copies only interactively. It is now possible to instan Power Copies from VB macros. (Note that this method is also a new way to instantiate a User Fea macro. To know more, see Instantiating a User Feature Using a VB Macro.) To instantiate a Power Copy from a VB macro:

16

Basic Tasks

1. Develop your macro in an editor and save it with the CATScript extension. (Read carefully the instructio know how to structure your script.)

2. From the Tools->Macro->Macros... command, access the Macros dialog box in CATIA. Click the Ma libraries... button. 3. In the Macro libraries dialog box, select the Directories option in the Library type scrolling list.

4. In the Open a directory of macros dialog box, select the directory that contains the VB script you've just Click OK when done. Click Close in the Macro libraries dialog box: The macro contained in this directo displayed in the Macros dialog box. 5. Click the Run button. Your macro is launched and your Power Copy is instantiated. Note that: •



• •

The instantiation has to be done entirely from the beginning to the end, following the steps below. The final step of the instantiation cannot be performed unless all the required input correctly valuated. Trying to do so will lead to an error message and the script execution w Moreover, as the duplication of the Power Copy components has already been performed, duplicated components will have to be erased manually. As the instantiation is performed programmatically, there is no possibility to intervene usin interface during the instantiation. Thus, manual reroute and orientation-handling are not p It is also impossible to modify a Design Table associated with the Power Copy. The Repeat mode is unavailable. Nevertheless this can be simulated by inserting a loop ins script. Inputs and published parameters are referenced by name in the methods and not by posit The instantiation is always performed just after the position of the current feature (the Inobject).

From the Instance Factory (A), the instantiation process can be broken down into 3 major steps, step itself being broken down into 5 different steps. • •

Initialization: It is the step where you define which Power Copy is to be instantiated. To pe several instantiations in a loop, the reference document is locked in the CATIA session. It w unlocked in the final step. Instantiation: It is the major step in which data are duplicated. This step can be repeated s times in a loop for example without doing the steps 1 and 3 again. o o Begin of instantiation: All the data are initialized.

Inputs valuation: Each input of the Power Copy has to be valuated with a feature o destination document. Parameter modification: If needed, published parameters can be modified. Instantiation: All the components of the Power Copy are duplicated.

o o o

End of instantiation: After this call, the instantiation is ended, and all the links to th

17

knowledgeTemplate

reference are broken.



Conclusion: This is the last step: The reference document is unlocked and released from th

' Instantiation of a Power Copy Reference called "TwoSurfacicHole" ' TwoSurfacicHole is stored in the CATPart PowerCopyReference.CATPart" ' It has 3 inputs: FirstHole, Support,and SecondHole ' and 2 published parameters: Radius1 and Radius2 '------------------------------------------------------------'-------------------------------------------------------------Catia.SystemService.Print "Retrieve the current part" Dim PartDocumentDest As PartDocument Set PartDocumentDest = CATIA.ActiveDocument Dim PartDest As Part Set PartDest = PartDocumentDest.Part '-------------------------------------------------------------Catia.SystemService.Print "Retrieve the factory of the current part" Dim factory As InstanceFactory (A) Set factory = PartDest.GetCustomerFactory("InstanceFactory") '-------------------------------------------------------------Catia.SystemService.Print "BeginInstanceFactory" (1) factory.BeginInstanceFactory "TwoSurfacicHole", "e:\tmp\PowerCopyReference.CATPart" '-------------------------------------------------------------Catia.SystemService.Print "Begin Instantiation" factory.BeginInstantiate (2) '-------------------------------------------------------------Catia.SystemService.Print "Set Inputs"



Initialization (1): Use the BeginInstan method of the CATIAInstanceFactory int first argument should be the name of the Copy. The second argument is the name document where this reference is stored For example: InstanceFactory.BeginInstanceFactory ( name_of_reference ,

name_



nt ) Instantiation: It is the most important broken down into 5 other steps that mus executed in the following order: o

Begin of instantiation: Use the Be method (2) of the CATIAInstance For example: InstanceFactory.Be

o

Valuation of inputs: Use the PutI (3) of the CATIAInstanceFactory For example: InstanceFactory.Pu input1

, selected_feature

o

Parameter modification: Retrieve parameter using the GetParamet the CATIAInstanceFactory interfa Then, modify its value using the ValuateFromString method of the interface. For example: Set param = InstanceFactory.GetParameter ( published_parameter1

)

param.ValuateFromString ( o

le

Instantiation: Use the Instantiat the CATIAInstanceFactory interfa returned by this method when in Power Copy. For example: Set Instance =

18

Basic Tasks

Dim FirstHole As Object Set FirstHole = PartDest.FindObjectByName("Point.1") Dim Support As Object Set Support = PartDest.FindObjectByName("Extrude.1") Dim SecondHole As Object Set SecondHole = PartDest.FindObjectByName("Point.2") factory.PutInputData "FirstHole", FirstHole (3) factory.PutInputData "Support", Support factory.PutInputData "SecondHole", SecondHole '-------------------------------------------------------------Catia.SystemService.Print "Modify Parameters" Dim param1 As Parameter Set param1 = factory.GetParameter("Radius1") (4) param1.ValuateFromString("25mm") Dim param2 As Parameter Set param2 = factory.GetParameter("Radius2") param2.ValuateFromString("15mm") '-------------------------------------------------------------Catia.SystemService.Print "Instantiate" (5) Dim Instance As ShapeInstance Set Instance = factory.Instantiate '-------------------------------------------------------------Catia.SystemService.Print "End of Instantiation" factory.EndInstantiate (6) '-------------------------------------------------------------Catia.SystemService.Print "Release the reference document" factory.EndInstanceFactory (7) '-------------------------------------------------------------Catia.SystemService.Print "Update" PartDest.Update •

InstanceFactory.Instantiate o

End of instantiation: Use the End method (6) of the CATIAInstance For example: InstanceFactory.En

Conclusion: Use the EndInstanceFactor (7) of the CATIAInstanceFactory interfac For example: InstanceFactory.EndInstan

To perform the scenario described below, you will need the following files:

19

knowledgeTemplate



PktInstantiatePowerCopyVB.CATScript This is the macro. Open this script and edit the path referencing the PowerCopyReference.CATPart file (L



PowerCopyReference.CATPart

This is the file that contains the Power Copy that is instantiated. Note that the inputs of the Power Copy points and an extrude.



PktDestinationPart.CATPart

This is the part that will host the instantiated Power also contains 2 points and an extrude, which are th the Power Copy.

1. Open the PktDestinationPart.CATPart file. Note that this file is made up of an Extrude and of 2 points the inputs of the Power Copy stored in the PowerCopyReference.CATPart file.

2. From the Tools->Macro->Macros... command, access the Macros dialog box in CATIA. Click the M libraries... button.

3. In the Macro libraries dialog box, select the Directories option in the Library type scrolling list. Click the existing library... button.

4. In the Open a directory of macros dialog box, select the directory that contains the PktInstantiatePowerCopyVB.CATScript file that you have just modified. Click OK when done. Click Clos Macro libraries dialog box: The macro contained in this directory is displayed in the Macros dialog box. 5. Click the Run button. Your macro is launched and your Power Copy is instantiated.

Storing a Design Table in a Power Copy
This task shows how to store a design table in a power copy for later use. In this scenario, you want to instantiate the inner and the outer cages of a ball bearing in a different context. To do so, you create a power copy only

20

Basic Tasks

containing the outer and the inner cages of an already existing ball bearing. This scenario is divided into the following steps: • Inserting the Design Table into the CATPart file • • Creating the Power Copy Instantiating the Power Copy containing the Design Table

To perform this scenario, the Product Knowledge Template license is required. To perform this scenario, you will need the following files: • • KwrBallBearing1.CATPart KwrBearingDesignTable.xls

To store a design table in a Power Copy, do not forget to select the parameters pointed by the design table. 1. Open the KwrBallBearing1.CATPart file. The following image is displayed.

Inserting the Design Table into the CATPart file

2. Click the Design Table icon ( ) in the Standard toolbar. The Creation of a Design Table dialog box is displayed. 3. Check the Create a design table from a pre-existing file radio button and click OK. The File Selection dialog box is displayed. 4. Select the KwrBearingDesignTable.xls and click Open. 5. Click Yes when asked for automatic associations and click OK. The Design table is displayed below the Relations node.

21

knowledgeTemplate

Creating the Power Copy

6. From the Start->Knowledgeware menu, access the Product Knowledge Template workbench (if need be) and click the Create a PowerCopy icon. The Power Copy Definition dialog box is displayed. 7. In the Specification tree, select the following items: o o o o o o o o o DesignTable.1 Shaft.1 Shaft.2 Shaft.3 Sketch.1 Sketch.2 Sketch.3 the Material Parameter. Click OK when done. The Power Copy is displayed below the PowerCopy node in the specification tree.

8. Save your file and close it.
Instantiating the Power Copy

9. From the File->New menu, select Part in the List of Types and click OK. 10. If need be, from the Start->Knowledgeware menu, access the Product Knowledge Template workbench and click the Instantiate From Document icon. The File Selection dialog box is displayed.

22

Basic Tasks

11. Select the KwrBallBearing1.CATPart file and click Open. The Insert Object dialog box is displayed. 12. Select the yz plane in the specification tree and click OK. The Design Table is instantiated

Power Copies: Useful Tips

Creating a Power Copy
• As far as possible, minimize the number of elements making up the Power Copy. When defining Power Copies including sketches, use profiles constrained with respect to edges or faces rather than to planes. Additionally, set the option Create geometrical constraints off before sketching. Generally speaking, it is always preferable to use profiles both rigid and mobile. It is preferable to constrain elements with respect to external references such as faces, edges, reference or explicit planes. It is preferable not to use projections nor intersections in your sketch if you want to use your sketch in a Power Copy. Avoid constraints defined with respect to reference planes. Before creating your Power Copies, make sure that your sketch is not overconstrained. Make sure that your sketch is iso-constrained (green color). You can use







• •



23

knowledgeTemplate

non-iso-constrained sketches, but it will be more difficult to understand and control the result after instantiation. • Create sketches on an axis system, in order to better control the Sketch position. Avoid access to sub-elements. Formulas are automatically included if you select all the parameters. For complex design, integrate knowledge rules.

• • •

Managing inputs:



Always rename your inputs to help the end user understand what he needs to select. A formula is automatically included in a Power Copy definition when all its parameters are included. Otherwise, i.e. if at least one parameter is not selected as part of the Power Copy, select the formula to make it part of the definition. If you do so, all the formula parameters that have not been explicitly selected, are considered as inputs of the Power Copy. Note that when including parameters sets containing hidden parameters in a Power Copy, the hidden parameters are automatically instantiated when instantiating the Power Copy. When creating a Power Copy, you may select components that point a relation. If this relation is not activated, it will not be taken into account by the Power Copy. For this relation to be inserted into the Power Copy, you have to activate it.







Preview:



In a Part document, create only one Power Copy reference. It is not a technical restriction, but there are at least two raisons for this: The cost of an instantiation will be smaller if the Part document is smaller. The end user can more easily understand the feature to be instantiated. Put in "show" only the input and the result (to help the end user to understand what he needs to select). Use color to differentiate inputs (put transparency on result for example). Choose a pertinent viewpoint before saving the Part document reference, default viewpoint in preview during instantiation will be the same.



• •

24

Basic Tasks

Catalog:



Do not forget catalog integration if you want to provide several Power Copies.

Instantiating a Power Copy
• • • Always check the orientation for curves and surfaces. If you need to instantiate a Power Copy several times on the same input, rename your inputs and use the "Use identical name" option. Prior to instantiating drafts created with versions before V5R14, we strongly recommend you to open and save the CATPart document containing those drafts in your session. Prior to instantiating a power copy containing a draft created with versions before V5R14, we strongly recommend you to open the CATPart document containing the power copy, edit the draft, update it and then save the CATPart document in your session.



To know more about Power Copies...
Refer to the Quick Reference topic for a comprehensive list of the interactions that can be carried out on Power Copies. The Power Copy command can be accessed by selecting the Insert->Advanced Replications Tools->PowerCopy Creation command from the following workbenches: • • Part Design Generative Shape Design

and by clicking the Create a PowerCopy icon ( workbench.

) from the Product Knowledge Template

A Power Copy is a template that works at the part level. From a collection of features (geometry, literals, formulas, constraints, etc.), you can create your own feature. The result is a Part Design feature or a Shape Design feature that can be reused in the design of another part. The created feature can be saved in a catalog.

Managing User Features (UDFs)
Managing User Features (UDFs)

25

knowledgeTemplate

Refer to the Quick Reference topic for a comprehensive list of interactions to be carried out on User Features. Refer to To know more about User Features. Create User Features: Select the Insert -> UserFeature -> UserFeature Creation ... command or click the Create a UserFeature icon, select the elements making up the User Feature from the specification tree, define a name for the User Feature and its reference elements then choose an icon for identifying it. Instantiate User Features from Document: Select the Insert -> Instantiate From Document command, select the document or catalog containing the User Feature, complete the Inputs within the dialog box selecting adequate elements in the geometric area or from the specification tree. Save User Features into a Catalog: Select the User Feature from the specification tree, select the Insert -> Save in Catalog command, enter the catalog name and click Open.

Introducing the User Feature Definition Window

The Userfeature Definition window is accessed when selecting the Insert->UserFeature>UserFeature Creation... command or when clicking the Creates a UserFeature icon ( Reference file: PktModifyingMainResult.CATPart ).

The Definition tab
• • • • The Definition tab lets you define the User Feature as you wish to create it. The Definition tab lets you assign a name to the User Feature and presents its components in the viewer. The tree structure displayed in the Definition tab under Components differs from the structure of the selected feature. The Body.1 object does not appear as an Assemble.1 child. The components displayed under Inputs of components are the features which are not aggregated to the selected object but are required to build it. These are the inputs that will be requested at instantiation.

The Inputs tab
• The Inputs tab shows you the inputs (elements to be selected at instantiation) of the User Feature. You can rename these elements for a clearer definition by selecting them in the viewer and entering a new name in the Name: field. In parentheses you still can read the elements' default name based on its type. When the Inputs tab is selected, the User

26

Basic Tasks

Feature inputs are indicated by red arrows in the geometry area. To know more, see Renaming an input.

The Parameters tab
• The parameters tab lets you define which of the parameter values used in the User Feature you will be able to modify at instantiation. This can be a value or a formula. Simply select the parameters and check the Published button. Use the Name: field to give another name to this element. To publish parameters, see Publishing parameters.

27

knowledgeTemplate

The Documents tab
• The Documents tab shows the complete path and role of Design tables referenced by an element included in the User Feature. This tab exhibits no document because only design tables belonging to the selected object are displayed. When instantiating or editing the User Feature, you will be able to change the document pointed by the internal design table.

The Icon tab
• The icon tab lets you modify the icon identifying the User Feature in the specifications tree. A subset of icons is available from the Icon choice button. If you click ... the Icon Browser opens, showing all icons loaded on your CATIA session. The Grab screen button allows you to capture an image of the User Feature to be stored with its definition. Click the Grab screen button. You can zoom in or out the image to adjust it. Click the Remove preview button if you do not need this image.

28

Basic Tasks

The Outputs tab
• The Outputs tab provides you with a way to define the result to be carried forward from the User Feature to another document during the instantiation process. To know more, see Modifying the Main Result. Note that the dimension of the secondary outputs should always be inferior to the Main result.

29

knowledgeTemplate

The Type tab
• The Type tab provides you with a way to associate a type with a User Feature. You will be able to use this type in search operations, Expert checks, and in Product Knowledge Template. The User Type name is the one that you indicated in the Definition tab.

Instance Type

Enables you to define the name of the type. The first box should contain a string of at least 3 characters and should be used to enter an identifier/keyword. It is highly recommended not to use special characters in those fields (they are not supported.) The string to be entered in the second box is not limited. The third box contains the generated Instance Type name that will be see as the type. Enables you to access the Manage Type window where you can: - Select the Super Type from which the type you created will inherit. It is possible to select the MechanicalModeler, the GSD and the Part Design packages. - Select the package it will belong to. - Click Create type and Close if you want to use the created type in the current session only. - Click Create type, Save, and Close if you want to use the created type in another session. In this case, a Generative Script file (File field) containing the User Feature definition is created.

Manage Type button

30

Basic Tasks

If you want to reuse the generated type in another Catia session: • save the CATGScript file in the Directory indicated in the Reference Directory for Types field (see Tools->Options->Parameters and Measure>Language tab) check the Load extended language libraries check box and select the package containing the type you created.



Creating a User Feature (UDF)

The scenario below describes in detail how to create a User Feature. A first User Feature has already been created. A new User Feature is now created. Note that datums (features that cannot be calculated) cannot be inputs of User Features. To find out more about the UDF limitations, click here.

31

knowledgeTemplate

1. Open the PktcreateaUDF.CATPart file. Note that this file already contains a UDF located below the KnowledgeTemplates node. 2. From the Start->Knowledgeware menu, access the Product Knowledge Template workbench. ). The UserFeature 3. Click the Create a UserFeature icon ( Definition dialog box is displayed. Replace the default User Feature name with Pad2, then select the Assemble.2 object in the specification tree. The dialog box looks like the one below:

When creating the UDF, the Selected components view shows the components you selected in the geometry and that make up the UDF (see picture above). If, after creating the UDF, you double-click it, the dialog box that is displayed shows the Internal components of the UDF, i.e, the instances of the selected components.

4. Select the Outputs tab. By default, the Assemble.2 object is displayed as the main result. 5. Click OK in the dialog box. The Pad2 User Feature is added to the specification tree.

32

Basic Tasks

6. Save your file. 7. Keep this document open and proceed to Saving a User Feature in a Catalog.

To find out more about the User Feature definition window, see Introducing the Userfeature Definition window. Refer to the Quick Reference topic for a comprehensive list of the interactions that can be carried out on User Features.

Creating and Instantiating a NLS User Feature (UDF)

33

knowledgeTemplate

The scenario below describes how to create a NLS User Feature. The following features can now be displayed in your language at instantiation: • The input role • The parameters (names and string multiple values) The update error message



The output role after the instantiation



In the scenario below, the input role and the parameters are NLS. To create a NLS User Feature: • • • • • Create the User Feature and click the Type tab in the User Feature definition window to create the type associated with the User Feature as well as the associated .CATGScript file. Create the CATNls file (See below). Close CATIA and relaunch it. In CATIA, open the file into which the template will be inserted. Instantiate the User Feature.

The created CATNls file: • • • Should be stored in the installation directory in the resources msgcatalog directory. Should have the following name: CATTypeTypeName.CATNls. If the type name is Wheel, the CATNls name will be: CATTypeWheel.CATNls. Should be structured as follows (Note that the role corresponds to the role assigned to each input in the Inputs tab of the User Feature Definition window): o o o Role1="NlsRole"; Role2="NlsRole"; ... Optionally for an NLS error message: UpdateErrorMessage = "Message";

Please find below the example of a .CATGscript file and its corresponding .CATNLS file. GSDPackage isa Package { CATWheel isa SkinFeature In the .CATGscript opposite, the Point, the Plane, the Configuration, the Distance, and the Radius are the

34

Basic Tasks

Feature

{ NLSName = UserFeature1; Fill = 0 , Type : Feature ; `Main result` = 0 , Type : NLSName :`Main result` ; Point = 0 , Type : Feature ; Plane = 0 , Type : Feature ; Configuration = 0 , Type :

inputs of the User Feature. These inputs will be required when instantiating the User Feature. Note that these inputs can be the roles you assigned to the inputs.

String ; Distance = 0 , Type : LENGTH ; Radius = 0 , Type : LENGTH ; } } The inputs of the .CATGscript file are Point = "Input point"; Plane = "Support"; listed in the opposite cell along with Configuration = "Distance their NLS names: Point = "Input configuration"; Point". Configuration.Item1="Short"; Configuration.Item2="Normal"; Note that: Configuration.Item3="Long"; Distance = "Wheel distance"; • Inputs names should not Radius = "Wheel radius"; contain blank spaces. Fill = "Fill"; • All NLS names are indicated //For the Nls message of update error between quotes "" and are UpdateErrorMessage = " UPDATE separated by ;. ERROR MESSAGE IN ENGLISH" • It is possible to add an error message that will be launched if an update error occurs. • The name of the file is: CATTypeCATWheel.CATNls

35

knowledgeTemplate

1. From the Tools->Options->General menu, click Parameters and Measure, and select the Language tab. Check the Load extended button and select the language libraries option, click the directory that will contain the types file (.CATGScript file). Click OK when done. 2. Open the PktcreateaUDF.CATPart file. Note that this file already contains a User Feature located below the KnowledgeTemplates node. 3. From the Start->Knowledgeware menu, access the Product Knowledge Template workbench. ). The UserFeature Definition 4. Click the Create a UserFeature icon ( dialog box is displayed. Replace the default User Feature name with NLSUDF, then click the Assemble.2 object in the specification tree. The dialog box now looks like the one below:

5. Click the Inputs tab and assign a role to each input: o Click Point.2 in the User Feature Definition window, and enter First_input in the Name field. Click Point.3 in the User Feature Definition window, and enter Second_input in the Name field. Click Extract.1 in the User Feature Definition window, and enter Third_input in the Name field.

o

o

36

Basic Tasks

Note that the role you assign in this tab is the one that will be used to create the .CATNls file (step 9.) 6. Click the Parameters tab and select the `Body.2 OpenBody.1 Circle.2 Circle center radius.1 Radius` parameter. Click Published Name and assign it a name: Cylinder_Radius. 7. Assign a type to the User Feature. o o Click the Type tab. In the Instance Type field, enter UDF and Assembly, and hit the Enter key. Click the Manage type button. In the Manage Type window, click the Create type button. (Click the graphic opposite to enlarge it.) The type is created as well as the associated .CATGScript file which is saved in the directory you previously selected (Step 1.) Click Save and Close when done. Click OK to exit the User Feature definition window.

o o

o o

8. Save your file and Close CATIA. 9. Open a Text Editor and enter the following text to create the .CATNls file: First_input ="Select 1st Point"; Note that Point.2, Point.3, and Second_input ="Select 2nd Extract.1 are the inputs of the User Point"; Feature. Third_input ="Select the Japanese users should use surface"; Japanese characters in this file. Cylinder_Radius="Radius of the UDF"; 10. Save your file under the following name: CATTypeCATWheel.CATNls in the resources\msgcatalog directory. Close the Text Editor. 11. Open CATIA and open the PktForInstantiation.CATPart file. 12. In the PKT workbench, click the Instantiate From Document icon ). The File Selection window is displayed. Select the ( PktcreateaUDF.CATPart file that you have just saved and click Open.

37

knowledgeTemplate

The following image is displayed:

13. Select the first point, the second point, and the surface: The User Feature is instantiated.

To find out more about the User Feature definition window, see Introducing the User Feature Definition window. Refer to the Quick Reference topic for a comprehensive list of the interactions that can be carried out on User Features.

Saving a User Feature in a Catalog

38

Basic Tasks

The task below explains how to store User Features in a catalog. This task is not actually a Product Knowledge Template task, but in the context of the Product Knowledge Template product, you will have to carry it out quite often. You have just created two User Features (Pad1 and Pad2). The main interest of User Features lies in the instantiation process whereby a User Feature stored in a catalog can be reused in a document. The PktcreatedUDF.CATPart document containing both User Features should be open.

Using the Save Object in a Catalog Command
1. Click the Save object in a catalog icon ( ) from the standard menu bar in the PKT workbench. The 'Catalog save' dialog box is displayed. Note that this command is also available from the Part Design and the GSD workbenches. 2. Select the Create a new catalog option and click the button on the right-hand side of the Catalog name field. The dialog box which is displayed allows you to specify a .catalog file where to store the created User Features. Enter a file name and click Open. Then click OK in the Catalog save dialog box. 3. Open the catalog you have just created (File->Open from the standard menu bar). The catalog which is displayed looks like the one below (depending on the name assigned to the catalog):

4. The left pane displays the two User Features created within a tree structure (Pad1 has two inputs while Pad2 has three inputs). Selecting a User Feature (3 inputs for example) displays in the right pane the characteristics of the User Feature. 5. About the Reference tab The User Feature name as well as the document it originates from is displayed. 6. About the Keywords tab The User Feature name as well as its inputs are displayed.

39

knowledgeTemplate

7. About the Preview tab The icon you have associated with the User Feature (if any) is displayed. 8. About the Generative Data tab The resolved queries: A resolved query is relevant for parts with design tables only since it aims at storing a filtered view of the design table data. To find out more about the Catalog Editor, see the Infrastructure User's Guide.

Using the Catalog Editor
1. From the Start->Infrastructure menu, access the Catalog Editor. 2. Double-click Chapter.1 and click the Add Family icon ( Family is displayed. ). The Component Definition

3. Change the name of the family: Pads in this scenario and click OK. 4. Double-click the Pads family and click the Add Component ( 5. In the Description Definition dialog box, click the button, go back the PktCreateaUDF.CATPart file and select the Pad1 User Feature in the specification tree and click OK. 6. Repeat the previous step to insert the Pad2 User Feature into the catalog. ) icon.

7. Save your catalog and proceed to the next task: Instantiating a User Feature. Refer to the Quick Reference topic for a comprehensive list of the interactions that can be carried out on User Features.

40

Basic Tasks

Instantiating a User Feature
Instantiating a User Feature
This section describes the different methods available to instantiate a User Feature.

Instantiating a User Feature From a Catalog, From a Document, From a Selection
The scenario described below shows how to instantiate a User Feature • • • from a catalog from a document containing a User Feature and from a selection

41

knowledgeTemplate

From a Catalog
1. Open the PktForInstantiation.CATPart document. The following screen is displayed.

2. In the standard toolbar, click the

icon. The catalog browser is displayed.

3. Click the icon. In the dialog box which is displayed, select the catalog containing the User Features you want to instantiate. Click Open to open the selected catalog. The dialog box which is displayed next enables you to navigate through the chapters and the families of the catalog until you can access the desired User Feature.

4. Double-click the '3 inputs' object and the 'Pad.2' object. The Insert Object dialog box is displayed.

42

Basic Tasks

To find out more about the Insert Object dialog box, click here. Note that in some cases, when instantiating a User Feature, the replacing element does not present the same sub-elements as the replaced element. Therefore you need to clearly indicate in a specific dialog box, the Replace Viewer, how to rebuild the geometry from the replacing element.

5. To instantiate Pad2 into the document: a. If need be, select Point.2 in the Insert Object dialog box, then select the Point.2 object in the document geometry area or in the specification tree. b. Select Point.3 in the Insert Object dialog box, then select the Point.3 object in the document geometry area or in the specification tree. c. Select Extract.1 in the Insert Object dialog box, then select the face highlighted on the graphic below.

d. Click OK to instantiate the Pad2 User Feature and exit the Insert Object dialog box. The User Feature Pad2 is instantiated into the document. This is what you can see on screen.

43

knowledgeTemplate

From a Document
1. Open the PktForInstantiation.CATPart document. 2. Click the Instantiate an element stored in a document icon ( box is displayed. 4. The Insert Object dialog box is displayed. o In the Reference scrolling list, select the User Feature that you want to instantiate (Pad2 in this scenario). If need be, select Point.2 in the Insert Object dialog box, then select the Point.2 object in the document geometry area or in the specification tree. Select Point.3 in the Insert Object dialog box, then select the Point.3 object in the document geometry area or in the specification tree. Select Extract.1 in the Insert Object dialog box, then select the face highlighted on the figure below. ). The File Selection dialog

3. Select the PktInstantiateUDFfromDocument.CATPart file and click Open.

o

o

o

44

Basic Tasks

3. 5. Click OK when you are done. The User Feature is instantiated. Click here to find out more about the Insert Object Dialog box.

From a Selection
1. Open the PktInstantiateUDFfromDocument.CATPart and the PktForInstantiation.CATPart files. 2. Tile the window vertically. 3. Expand the KnowledgeTemplates node in the PktInstantiateUDFfromDocument.CATPart file and click the Pad2 User Feature. 4. Go to the PktForInstantiation.CATPart file and click the Instantiate from Selection icon ( Insert Object dialog box is displayed. 5. Click the Use identical name button and click the face highlighted in the picture below. ). The

6. Click OK when done. The User Feature is instantiated. Refer to the Quick Reference topic for a comprehensive list of the interactions that can be carried out on User Features.

45

knowledgeTemplate

Instantiating a User Feature From a VB Macro

This topic provides you with instructions concerning the instantiation of User Features from VB Macros. Two different protocols are available to instantiate User Features. • • • Reminder First instantiation protocol Second instantiation protocol

Reminder
To instantiate a User Feature from a VB macro: 1. Develop your macro in an editor and save it with the CATScript extension. (Read carefully the instructions below to know how to structure your script.) 2. From the Tools->Macro->Macros... command, access the Macros dialog box in CATIA. Click the Macro libraries... button. 3. In the Macro libraries dialog box, select the Directories option in the Library type scrolling list. 4. In the Open a directory of macros dialog box, select the directory that contains the VB script you've just created. Click OK when done. Click Close in the Macro libraries dialog box: The macro contained in this directory is displayed in the Macros dialog box. 5. Click the Run button. Your macro is launched and your User Feature is instantiated. Note that: • The instantiation has to be done entirely from the beginning to the end, following the steps indicated below. The final step of the instantiation cannot be performed unless all the required inputs are correctly valuated. Trying to do so will lead to an error message and the script execution will stop. As the instantiation is performed programmatically, there is no possibility to intervene using the interface during the instantiation. Thus, manual reroute and orientation-handling are not possible. It is also impossible to modify a Design Table associated with the User Feature. The Repeat mode is unavailable. Nevertheless this can be simulated by inserting a loop inside the script. Inputs and published parameters are referenced by name in the methods and not by position. The instantiation is always performed just after the position of the current feature (the In-work object).



• •

46

Basic Tasks

First instantiation protocol
The first protocol is dedicated to User Feature instantiation only. It is defined by a single method: AddInstance (To find out more about this method, refer to the Automation documentation). Note that: • • This method is to be used when you want to perform only one instantiation of the reference. As the document containing the reference is released from the session at the end of the instantiation, it is not recommended to use this method if you want to perform several instantiations of the same reference in a loop. To perform a loop, use the second protocol.

The instantiation process can be broken down into the following steps:

'Instantiation of a User Feature Reference "UserFeature2" ' UserFeature2 is stored in the CATPart "e:\UserFeatureStartSweep.CATPart" ' It has ' 2 inputs: Center and Surface ' 2 published parameters: Height and Radius ' 1 output: Direction '----------------------------------------------------------------------------------------------------------------------Catia.SystemService.Print "Retrieve the current part" Dim PartDocumentDest As PartDocument Set PartDocumentDest = CATIA.ActiveDocument Dim PartDest As Part Set PartDest = PartDocumentDest.Part '------------------------------------------------------------Catia.SystemService.Print "Retrieve the User Feature Reference" CATIA.DisplayFileAlerts = False Dim PartDocumentStart As PartDocument Set PartDocumentStart = CATIA.Documents.Read ("e:\UserFeatureStartSweep.CATPart")



Instantiation: The current part is first retrieved then the Part is read. Use the FindObjectByName method to retrieve the inputs. Then the User feature is instantiated using the AddInstance method. Valuation of inputs: Use the FindObjectByName method to retrieve the inputs and the PutInput method to valuate the inputs Parameter modification: Use the ValuateFromString method to modify





47

knowledgeTemplate

Dim PartStart As Part Set PartStart = PartDocumentStart.Part Dim reference As Object Set reference = PartStart.FindObjectByName("UserFeature2") '------------------------------------------------------------Catia.SystemService.Print "Instantiate the reference in the current part" Dim factory As InstanceFactory Set factory = PartDest.GetCustomerFactory("InstanceFactory") Dim instance As ShapeInstance Set instance = factory.AddInstance(reference) '------------------------------------------------------------Catia.SystemService.Print "Set Inputs" Dim Center As Object Set Center = PartDest.FindObjectByName("Point.1") Dim Surface As Object Set Surface = PartDest.FindObjectByName("Surface.1") instance.PutInput "Center", Center instance.PutInput "Surface", Surface '------------------------------------------------------------Catia.SystemService.Print "Modify Parameters" Dim param1 As Parameter Set param1 = instance.GetParameter("Height") param1.ValuateFromString("40mm") Dim param2 As Parameter Set param2 = instance.GetParameter("Radius") param2.ValuateFromString("30mm") '------------------------------------------------------------Catia.SystemService.Print "Update" PartDest.Update •

the parameters. Checking the instantiation: Use the GetInput method to retrieve the valuated inputs.

48

Basic Tasks

'------------------------------------------------------------Catia.SystemService.Print "Retrieves Inputs and Outputs" Dim inputCenter As Object Set inputCenter = instance.GetInput("Center") Dim inputSurface As Object Set inputSurface = instance.GetInput("Surface") Catia.SystemService.Print "Recuperation des outputs" Dim outputDirection As Object Set outputDirection = instance.GetOutput("Direction") '------------------------------------------------------------Catia.SystemService.Print "Close the CATPart containing the reference" PartDocumentStart.Close To perform the scenario described below, you will need the following files: • InstantiateUDFFromVB.CATScript This is the macro. Open this script and edit the path referencing the UserFeatureStartSweep.CATPart file (Line 24).



UserFeatureStartSweep.CATPart This is the file that contains the User Feature that is going to be instantiated. Note that the inputs of the User Feature are a point and an extrude.

49

knowledgeTemplate



PktDestinationPart.CATPart

This is the part that will host the instantiated User Feature. It also contains 2 points (select one of them when instantiating) and an extrude, which are the inputs of the User Feature.

1. Open the PktDestinationPart.CATPart file. Note that this file is made up of a surface and of 2 points. They are the inputs of the User Feature stored in the UserFeatureStartSweep.CATPart file. 2. From the Tools->Macro->Macros... command, access the Macros dialog box in CATIA. Click the Macro libraries... button. 3. In the Macro libraries dialog box, select the Directories option in the Library type scrolling list. Click the Add existing library... button. 4. In the Open a directory of macros dialog box, select the directory that contains the InstantiateUDFFromVB.CATScript file that you have just modified. Click OK when done. Click Close in the Macro libraries dialog box: The macros contained in this directory are displayed in the Macros dialog box. 5. Select InstantiateUDFFromVB.CATScript (if need be) and click the Run button. The macro is launched and the User Feature is instantiated.

Second instantiation protocol

The second protocol is dedicated to User Features and Power Copies instantiation. It is defined by methods that must be called in order. Note that it is recommended to use this protocol to perform several instantiations of the same reference in a loo

50

Basic Tasks

From the Instance Factory (A), the instantiation process can be broken down into 3 major steps, step itself being broken down into 5 different steps. •



Initialization: It is the step where you define which User Feature is to be instantiated. To p several instantiations in a loop, the reference document is locked in the CATIA session. It w unlocked in the final step. This step must be called once at the beginning of the instantiatio whatever the number of instantiations. Instantiation: It is the major step in which the data are copied/instantiated. It is made up different steps that must be called in the order given below. o o Begin of instantiation: All the data are initialized.

Inputs valuation: Each input of the User Feature has to be valuated with a feature o destination document. Parameter modification: If needed, published parameters can be modified. Instantiation: The User Feature is instantiated.

o o o

End of instantiation: After this call, the instantiation is ended, and all the links to th reference are broken.



Conclusion: This is the last step: The reference document is unlocked and released from th

' Instantiation of a User Feature Reference "MyUserFeature2" ' MyUserFeature2 is stored in the CATPart "e:\tmp\UserFeatureStartSweep.CATPart" ' It has ' 2 inputs: Center and Surface ' 2 published parameters: Height and Radius ' 1 output: Direction ------------------------------------------------------------------------------------------------------------------------Catia.SystemService.Print "Retrieve the current part" Dim PartDocumentDest As PartDocument Set PartDocumentDest = CATIA.ActiveDocument Dim PartDest As Part Set PartDest = PartDocumentDest.Part '------------------------------------------------------



Initialization (1): Use the BeginInstan method of the CATIAInstanceFactory int first argument should be the name of the Feature. The second argument is the nam document where this reference is stored For example: InstanceFactory.BeginInstanceFactory ( name_of_reference ,

name_



nt ) Instantiation: It is the most important broken down into 5 other steps that mus executed in the following order. These st called in a loop in order to perform seve instantiations: o

Begin of instantiation: Use the Be method (2) of the CATIAInstance to initialize the data of the refere For example: InstanceFactory.Be

51

knowledgeTemplate

------Catia.SystemService.Print "Retrieve the factory of the current part" Dim factory As InstanceFactory Set factory = PartDest.GetCustomerFactory("InstanceFactory") '------------------------------------------------------------Catia.SystemService.Print "BeginInstanceFactory" factory.BeginInstanceFactory "MyUserFeature2", (1) "e:\tmp\UserFeatureStartSweep.CATPart" '------------------------------------------------------------Catia.SystemService.Print "Begin Instantiation" factory.BeginInstantiate (2) '------------------------------------------------------------Catia.SystemService.Print "Set Inputs" Dim Center As Object Set Center = PartDest.FindObjectByName("Point.1") Dim Surface As Object Set Surface = PartDest.FindObjectByName("Surface.1") factory.PutInputData "Point.1", Center (3) factory.PutInputData "Surface.1", Surface '------------------------------------------------------------Catia.SystemService.Print "Modify Parameters" Dim param1 As Parameter Set param1 = factory.GetParameter("Height") (4) param1.ValuateFromString("40mm") Dim param2 As Parameter Set param2 = factory.GetParameter("Radius") param2.ValuateFromString("30mm") '------------------------------------------------------------Catia.SystemService.Print "Instantiate" Dim Instance As ShapeInstance Set Instance = factory.Instantiate (5) •

o

Valuation of inputs: Use the PutI (3) of the CATIAInstanceFactory value to any input of the referenc For example: InstanceFactory.Pu input1

, selected_feature

o

Parameter modification: Retrieve parameter using the GetParamet the CATIAInstanceFactory interfa modify its value using the Valuat method of the CATIAParameter in For example: Set param = InstanceFactory.GetParameter ( published_parameter1 param.ValuateFromString (

)

le

o

Instantiation: Use the Instantiate the CATIAInstanceFactory interfa created instance when it exists. For example: Set Instance = InstanceFactory.Instantiate

o

End of instantiation: Use the End method (6) of the CATIAInstance to indicate that the instantiation For example: InstanceFactory.En

Conclusion: Use the EndInstanceFactor (7) of the CATIAInstanceFactory interfac the instantiation and clean the InstanceF When performing several instantiations i this step must be called just once at the instantiations. For example: InstanceFactory.EndInstan

52

Basic Tasks

'------------------------------------------------------------Catia.SystemService.Print "End of Instantiation" factory.EndInstantiate (6) '-----------------------------------------------------------Catia.SystemService.Print "Release the reference document" factory.EndInstanceFactory (7) '------------------------------------------------------------Catia.SystemService.Print "Update" PartDest.Update To perform the scenario described below, you will need the following files: •

PktInstantiateUserFeatureVB2.CATScript This is the macro. Open this script and edit the p referencing the UserFeatureStartSweep.CATPart f 25).



UserFeatureStartSweep.CATPart

This is the file that contains the User Feature tha to be instantiated. Note that the inputs of the Use are a point and an extrude.



PktDestinationPart.CATPart

This is the part that will host the instantiated Use It also contains 2 points (select one of them whe instantiating) and an extrude, which are the inpu User Feature.

1. Open the PktDestinationPart.CATPart file. Note that this file is made up of an Extrude and of 2 points be used as inputs of the User Feature stored in the UserFeatureStartSweep.CATPart file.

2. From the Tools->Macro->Macros... command, access the Macros dialog box in CATIA. Click the Ma

53

knowledgeTemplate

libraries... button.

3. In the Macro libraries dialog box, select the Directories option in the Library type scrolling list. Click the existing library... button.

4. In the Open a directory of macros dialog box, select the directory that contains the PktInstantiateUserFeatureVB2.CATScript file that you have just modified. Click OK when done. Click Cl Macro libraries dialog box: The macros contained in this directory are displayed in the Macros dialog

5. Select PktInstantiateUserFeatureVB2.CATScript (if need be) and click the Run button. The macro is lau the User Feature is instantiated.

Assigning a Type to a User Feature

This task explains how to reference User Features like any other existing types. To assign a type to a User Feature: 1. Select a Reference Directory For Types in the Tools->Options->General->Parameters and Measure->Language tab. This directory will contain the created user types (.CATGScript files). This way, user types will be persistent from a CATIA V5 session to another. 2. Declare your type in the Type tab of the User Defined Feature Definition window. We call: o o User Type, the name attributed to the UDF in the Definition tab. Instance Type, the new type you are declaring.

Note that: • • It is recommended to insert a project prefix in the type name: my_project_hole. You can manage your user type by: Storing it in the following CATIA packages: Mechanical Modeler, GSD Package or PartDesign.

o

54

Basic Tasks

o

Assigning it a super type.

• • •

When pushing the button Create Type, the new user type becomes available in the session. User Features can define new types of objects created by you and can therefore be searched for like any other type. They are also available in the Knowledge Expert browser. If you want other users to use the User Feature you created, you will have to provide them with the User Feature, the catalog in which it is stored (if stored in a catalog), and the CATGScript file.

1. Open the Pktudfcreateatype.CATPart document. Pay attention to the Assemble.2 object. This object is the one we are going to use to create a User Feature. 2. Select the Insert->Userfeature->Userfeature Creation... command from the standard menu bar if you are currently working with the Part Design or Generative Shape Design workbenches or click the Create a User Feature icon ( 3. The Userfeature definition window opens. Note that if you want to publish parameters later, you will have to re-generate the CATGScript in the Manage Type window. ) if you are in the PKT workbench.

o o

Note that only the MechanicalModeler, the GSD and the Part Design packages are available here. Part Design is the default package.

a) In the Definition tab, replace the default User Feature name (enter Pad2 as a new name for example) then select the Assemble.2 object in the specification tree. (Click the graphic opposite to enlarge it.)

55

knowledgeTemplate

b) In the Parameters tab, publish the parameter that will be published. o Select `Body.2 Open_body.1 Circle.2

Circle center radius.1 Radius`, click the Published Name check box and change the name of the parameter (Radius for example)

(Click the graphic above to enlarge it.) c) In the Type tab, enter the name of the instance type: Enter the first part of the type in the first box, the second part in the second box and hit the Enter key. Click the Manage Type button. Indicate the Super Type and the Package. Click Create Type, Save, and Close.

(Click the graphic above to enlarge it.) 5. Click OK to exit the User Feature dialog. The Pad2 User Feature is added to the specification tree right below the KnowledgeTemplates node. Click here to display the part containing the generated part and here to open the generated .CATGScript file. Refer to the Quick Reference topic for a comprehensive list of the interactions that can be carried out on User Features.

Referencing User Features in Search Operations

This task explains how to reference User Features like any other existing types and how to perform search operations on these types.

56

Basic Tasks



User Features can define new types of objects you created and can therefore be searched for like any other type. If you want other users to use the type you created, you will have to provide them with the User Feature, the catalog in which it is stored (if stored in a catalog), and the CATGScript file.



Prior to performing this scenario, indicate the reference directory for types (Tools->Options->General->Parameters and Measure->Language tab). 1. Open the Pktudfcreatedtype.CATPart document and access the Product Knowledge Template workbench (if needed). 2. Click the Create a UserFeature icon ( ). The UserFeature Definition dialog box is displayed. Replace the default User Feature name with Pad2, then select the Assemble.2 object in the specification tree. 3. Click the Parameters tab, select the 4th line in the list of available parameters, click the Published Name check box and enter the new name: Radius. 4. Click the Type tab, enter UDF+Pad in the Instance Type field, and hit the Enter key. The Manage type dialog box is displayed. 5. Click the Create type button, Save, Close, and OK to close the UDF dialog box. Your type is now created. 6. Select the Insert->UserFeature->Save In Catalog... command from the standard menu bar or click the Save object in a catalog icon ( 'Catalog save' dialog box is displayed. ). The

7. Select the Create a new catalog option and click the button on the right-hand side of the Catalog name field. The dialog box displayed allows you to specify a .catalog file where to store the created User Features. Enter a file name and click Open. Click OK in the Catalog save dialog box. 10. Open the PktForInstantiation.CATPart document. The following screen is displayed.

57

knowledgeTemplate

11. In the standard toolbar, click the

icon. The catalog browser is displayed.

12. Click the icon. In the dialog box which is displayed, select the catalog which contains the User Features you want to instantiate. Click Open to open the selected catalog. The dialog box displayed next depends on your last interaction on this catalog. Double-click the object displayed in the left pane until you get Pad2 on screen: 13. Double-click the 'Pad2' object. The Insert Object dialog box is displayed.

To find out more about the Insert Object dialog box, click here.

58

Basic Tasks

14. Instantiate Pad2 in the document. a. Select Point.2 in the "Insert Object" dialog box, then select the Point.2 object in the document geometrical area or in the specification tree. b. Select Point.3 in the "Insert Object" dialog box, then select the Point.3 object in the document geometrical area or in the specification tree. c. Select Extract.1 in the "Insert Object" dialog box, then select the face highlighted on the figure below. d. Click OK and Close. Pad2 is instantiated.

59

knowledgeTemplate

15. Select the Edit>Search (CTRL+F) command. The Search window opens. 16. Select the Advanced tab.

17. Select Part Design under Workbench. 18. Select UDFPad (this is the type assigned to the User Feature, see the generated CATGscript) under Type. 19. Select Radius under Attribute. The Attributes' criterium dialog box opens. Enter 20mm in the = field. Click OK.

Note that Pad1 and Pad2 are now considered like any other types and can therefore be searched for. 20. Click Search: the Pad2 instance (Pad2.1) is displayed in the Object found field and is highlighted both in the specification tree and in the geometrical area (click the graphic below to enlarge it.)

60

Basic Tasks

Refer to the Quick Reference topic for a comprehensive list of the interactions that can be carried out on User Features.

To find out more about User Features ...
Refer to the Quick Reference topic for a comprehensive list of the interactions that can be carried out on User Features. The UserFeature command can be accessed by selecting the Insert->UserFeature command from the following workbenches: • • Part Design Generative Shape Design

and by clicking the Create a User Feature icon () from the Product Knowledge Template workbench. A User Feature is a template that works at the part level. From a collection of features (geometry, literals, formulas, constraints, etc.), you can create your own feature. The result is a Part Design feature or a Shape Design feature that can be reused in the design of another part. The created feature can be saved in a catalog. A User Feature: • Allows you to create applicative features • Allows you to hide design specifications and preserve confidentiality (for instance to sub-contractors)

61

knowledgeTemplate User Features (like a line for Drafting or a check for Knowledge Advisor) are open and shareable objects. This capability significantly increases the potential application of User Features since it enables you to: • Find User Features by attributes. • Generate User Features with the Scripting language to simplify the process of creating scripts . • Define expert rules working on User Features with Knowledge Expert (to know more, see the Knowledge Expert User's Guide). • Use User Features in Knowledge Advisor reactions. • Develop CAA functions based on user defined variables.

Managing Part and Assembly Templates
Managing Part and Assembly Templates

Refer to the Quick Reference topic for a comprehensive list of the interactions that can be carried out on document templates. Refer to To know more about Part and Assembly Templates to know more about these features.

Create a Document Template: Select the Insert -> Document Template ) (if in Creation ... command or click the Create Document Template icon ( the PKT workbench), select the elements making up the document template from the specification tree, define a name for the document template and its reference elements then choose an icon for identifying it.

Introducing the Document Template Definition Window

The Document Template Definition window can be accessed by selecting the Insert>Document Template Creation... command from the following workbenches: • • • Product Structure Part Design Assembly Design

62

Basic Tasks

• •

Generative Shape Design Wireframe and Surface Design

You can access the Product Knowledge Template workbench from the Part Design and the Product Structure workbenches.

The Documents tab
The Documents tab shows the complete path and Action of the files referenced in the Template. The Action status can be either: • • Same Document or New Document.

If the document is seen as New Document, it is then duplicated and does not have any link with the original component (equivalent of the New from... command.) If the document is seen as Same Document, a link is maintained with the original file. The modify the Action of the components. button enables you to

The buttons of the External documents sections enable you to select external documents and insert them into the template. It is now possible to associate non-CATIA (ENOVIA LCA, ...) documents with a template. To do so, make sure you have enabled the desired environment in the Document Environments field (Tools->Options->General->Document.) Your documents will be accessible via the Document Chooser.

The Inputs tab
The Inputs tab enables you to define the reference elements making up the Template by selecting them in the geometry or in the specification tree.

The Accept instantiation even if not all inputs are filled option enables users to determine if the template can be instantiated

63

knowledgeTemplate

even if not all inputs are valuated. If all inputs are not valuated, old inputs will be kept and isolated at instantiation. This option can be useful if there is more than one way to position the template in context, if you want all these combinations to be available but you want to use only one of them at the same time. To see an example, see Creating a Part Template and lnstantiating a Part Template. For a clearer definition, you can select these items in the viewer and enter a new name in the Role field. The Role field enables you to select one of the items displayed in the window and to rename it. It is used at instantiation through the Use identical name button in the Insert object window. The Type column indicates if the input is manual or automatic. The inputs are considered as • Manual if they are added manually • Automatic if they are external references that point an object defined outside the template.

The Published Parameters tab
The Published Parameters tab enables you to define which parameter value used in the Template you will be able to modify when instantiating it. The Edit List... button enables you to access the list of parameters, and to select those you want to publish. These parameters are displayed in the Part Numbers viewer. The Auto modify part numbers with suffix check box, if checked, automatically modifies the part numbers at instantiation if the part numbers already exist. • Note that if you want to manage the way part numbers are modified at instantiation, you just need to uncheck this option and click, at instantiation, the Parameters button in the Insert Object dialog box. This way you can access the part numbers that you want to modify. The unicity of part numbers is now ensured when instantiating document templates into different documents or when the document template is used by different users. When the part numbers renaming mode is set to automatic, a suffix parameter is



64

Basic Tasks

automatically published by the document template. At instantiation, after valuating the inputs of the document template, suffixes can be changed by clicking the Parameters button in the Insert Object window. Note that it is not possible to "unpublish" the suffix or to change its role.

The Icon tab
The Icon tab enables you to modify the icon identifying the Template in the specifications tree. A subset of icons is available when clicking the Icon choice button. Clicking ... displays the Icon Browser, showing all icons loaded in your CATIA session. The Grab screen button enables you to capture an image of the template to be stored along with its definition. The Remove preview button enables you to remove the image if you do not need it. The assembly structure of the documentation template should not be modified after the document template definition (you cannot add or remove documents for example.)

Creating a Part Template

This scenario explains how to create a part template containing a keypad that will be instantiated into a CATProduct document. In this scenario, you: • Create 2 document templates. When creating the first document template, you do not check the Accept instantiation even if not all inputs are filled option (Steps 1 to 4). When creating the second document template, you check the Accept instantiation even if not all inputs are filled option (Steps 5 to 8). To find out more about this option, see Introducing the Document Template Definition Window. Save both document templates in a catalog. • •



Creating the first template



65

knowledgeTemplate

1. Open the PktMobilePhoneKeypad.CATP art file. The opposite image is displayed.

2. From the Insert menu, select the Knowledge Templates->Document Template ... command (in the Part Design workbench) or, if in the Product Knowledge Template workbench, click the Create a Document Template icon ( Template Definition window is displayed. ). The Document

3. In the Document Template Definition window, click the Inputs tab to select the inputs. o In the geometry, select the following features: - Arrow_up_Sketch.8 - Cancel_Sketch.9 - Surface.3

Curve.8 Sharp_Sketch.3 Arrow_down_Sketch.6 Ok_Sketch.7

o

In the Inputs tab, select the Curve.8 feature and assign it a role in the Role field. Repeat the same operation for the features you selected. The final Inputs tab should look like the picture below.

66

Basic Tasks

4. Click the Published Parameters tab to publish parameters. o Click the button. The Select parameters to insert window is displayed. Use the arrow to select the Button_Offset and the Button_top_angle parameters in the Parameters to publish column. Click OK twice. The Document template is added to the KnowledgeTemplates node. Right-click DocumentTemplate.1 and select the Properties command to rename the document template. In the Feature Name field, enter Keypad1. Click OK to validate.

o

o

o o

Creating the second template
1. From the Insert menu, select the Knowledge Templates->Document Template ... command (in the Part Design workbench) or, if in the Product Knowledge Template workbench, click the Create a Document Template icon ( Template Definition window is displayed. ). The Document

2. In the Document Template Definition window, click the Inputs tab and select the

67

knowledgeTemplate

following inputs in the specification tree: o o o o 3. Check the Accept instantiation even if not all inputs are filled check box. Click the Published Parameters tab to publish parameters. • Click the button. The Select parameters to insert window is displayed. In the Parameters to publish column, click the Button_Offset and the Button_top_angle parameters and use the arrow to select them. Click OK twice. The Document template is added to the KnowledgeTemplates node. Right-click DocumentTemplate.2 and select the Properties command to rename the document template. In the Feature Name field, enter Keypad2. Click OK to validate. Save your file. Curve.8 Sharp_Sketch.3 Arrow_down_Sketch.6 Ok_Sketch.7

• • • •

Store the document template in a catalog. • If not already in the Product Knowledge Template workbench, from the Start->Knowledgeware menu, access the Product Knowledge Template workbench. Click the Save in catalog icon ( displayed. ). The Catalog save dialog box is





Click OK to create a new catalog or the ... button to change the name of the catalog. The catalog is created. Click here to display the result catalog file. Click here to display the result



68

Basic Tasks

.CATPart file. Close your file and proceed to the next task: lnstantiating a Part Template. Refer to the Quick Reference topic for a comprehensive list of the interactions that can be carried on Document Templates.

lnstantiating a Part Template

This scenario explains how to instantiate a template into a CATProduct file. It is divided into 2 different parts: • • You instantiate Keypad1, a document template saved in the PktKeypadscatalog.catalog. You instantiate Keypad2, a document template saved in the PktKeypadscatalog.catalog.

To perform this scenario, you need the following files: • PktMobilePhoneSupport.CATProduct that is made up of the following CATPart and CATProduct files: PktBottomcase.CATPart PktBody.CATPart PktIndus.CATPart PktFrontShell.CATPart PktPlanarCard.CATProduct InteractiveBoard.CATPart PktCapacitor_700.CATPart PktChip_AC110.CATPart Screen2.jpg • PktKeypadscatalog.catalog: This catalog contains 2 document templates: Keypad1 and Keypad2. When creating Keypad1, the Accept instantiation even if not all inputs are filled option was unchecked. When creating Keypad2, the Accept instantiation even if not all inputs are filled option was checked. PktBattery.CATPart PktLens.CATPart PktLCD30-28.CATPart PktElectronic.CATProduct PktSpeaker.CATPart PktCapacitor_500.CATPart PktChip_AC30.CATPart PktChip_AC20.CATPart

69

knowledgeTemplate

Working with the Cache system: Till R14 the previous instantiation behavior was to load the whole assembly when the instantiation occurs, that is to say, at the very beginning of the instantiation. Now this loading is performed only when you enable the Use Identical Name option. If the Part is not loaded in the current selection, you can now click this part to load it.

Instantiating Keypad1

1. Open the PktMobilePhoneSupport.CATProduct file. ) and 2. Click the Open Catalog icon ( select the PktKeypadscatalog.catalog that you created in the Creating a Part Template topic. The Catalog Browser opens. 3. Double-click DocumentTemplate, 7 inputs and Keypad1. The Insert Object window opens. (Click the graphic opposite to enlarge it).

To find out more about the Insert Object dialog box, click here.

4. Value the Inputs by selecting the publications located below the Industrial Design node in the specification tree or click the Use Identical Name button in the Insert Object window.

70

Basic Tasks

5. Make the appropriate selections in the Replace Viewer window (see picture below) and click OK when done.

Note that in some cases, when instantiating a part or assembly template, the replacing element does not present the same sub-elements as the replaced element. Therefore you need to clearly indicate in a specific dialog box, the Replace Viewer, how to rebuild the geometry from the replacing element. 6. Click OK in the Check warning box, then Close. The keypad is instantiated (see picture below.) 7. Close your file.

71

knowledgeTemplate

Instantiating Keypad2

1. Open the PktMobilePhoneSupport.CATProduct file. 2. Click the Open Catalog icon and select the PktKeypadscatalog.catalog that you created in the Creating a Part Template topic. The Catalog Browser opens. 3. Double-click Document Template, 7 inputs and Keypad2. The Insert Object window opens. 4. Click OK in the Insert Object window. The keypad is instantiated. Note that you do not have to value the inputs since the Accept instantiation even if not all inputs are filled option was checked when creating the Keypad2 part template.

Refer to the Quick Reference topic for a comprehensive list of the interactions that can be carried on Part Templates.

Adding an External Document to a Document Template

This task shows how to insert a drawing into a part template and how it is updated at instantiation. The scenario is divided into the following steps: • • Creating a drawing from an existing part Creating the part template

72

Basic Tasks



Instantiating the part template and updates the generated drawing.

Note that the document(s) that can be added to part and assembly templates must belong to one of the following types: • • • .CATDrawing .CATProcess .CATAnalysis

Prior to performing this scenario, make sure that the Keep link with selected object is checked (Tools->Options...->Infrastructure->Part Infrastructure->General). 1. Open the PktPadtoInstantiate.CATPart file. The following image is displayed.

2. From the Start->Mechanical Design menu, access the Drafting workbench. The New Drawing Creation Window is displayed. 3. Select the All views configuration and click OK. 4. The drawing corresponding to the pad is generated.

73

knowledgeTemplate

4. Save your drawing and close the file. Click here to see the generated drawing. 5. Go back to the PktPadtoInstantiate.CATPart file to create a part template. o Select the Knowledge Templates->Document Template ... command. The Document Template Definition window is displayed. Click the Add... button in the External documents field and select the .CATDrawing file you have just created in the File Selection window (or use the PktPadDrawing.CATDrawing). Click Open. Click the Inputs tab and select Sketch.1 and Sketch.2 in the geometry or in the specification tree. Click the Published Parameters tab and click the Edit List... button. The Select parameters to insert window is displayed. Select the following parameters using the arrow button: PartBody PartBody Pad.1 Pad.2 FirstLimit FirstLimit Length Length

o

o

o

o o o

In the Published Parameters tab, select PartBody Pad.1 FirstLimit Length and rename it to Pad_Width in the Name: field, then select PartBody Pad.2 Pad_Length. FirstLimit Length and rename it to

74

Basic Tasks

o

Click OK to validate. Save your file and close it.

6. Open the PktProduct.CATProduct file. 7. From the Start->Knowledgeware menu, access the Product Knowledge Template workbench (if need be). ) and select the 8. Click the Instantiate From Document icon ( PktPadtoInstantiate_result.CATPart containing the document template. Click Open. The Insert Object dialog box is displayed. 9. Expand the PartBody Pad.1 node in the specification tree, select Sketch.1, and make the appropriate selections in the opening Replace Viewer window (see graphic below). Click Close when done.

10. Select Sketch.2 in the geometry or in the specification tree. 11. Click the Parameters button and enter 10mm in the Pad_Width field and 90 in the Pad_Length field.

75

knowledgeTemplate

12. Click Close and OK to validate. A message is fired indicating that the external document was regenerated. Click OK. The document template was instantiated. (see picture below).

13. From the Window menu, access the generated .CATDrawing file. Right-click CATDrawing2 in the left part of the window and select the Update Selection command. The drawing is updated and matches the new product.

76

Basic Tasks

14.

Refer to the Quick Reference topic for a comprehensive list of the interactions that can be carried out on document templates.

Document Templates: Methodology





It is possible to define document templates based on contextual products and parts or on isolated parts and products. It is highly recommended to work with isolated documents: not so many documents will be instantiated (when working with contextual products, the context products are needed for instantiation). The assembly structure of the documentation template should not be modified after the document template definition (you cannot add or remove documents for example.)

77

knowledgeTemplate

To find out more about Part and Assembly Templates...

Part and Assembly Templates are templates that work at the part or at the assembly level. The Document Template Definition window can be accessed by selecting the Insert>Document Template Creation... command from the following workbenches: • • • • • Part Design Generative Shape Design Wireframe and Surface Design Assembly Design Product Structure

Working with Part Templates
A part created in Catia may contain user parameters and geometry data. It is not a contextual part. You can create a part template that references that part. This template is a feature that is created in the CATPart document itself (very similar to the PowerCopy definition) and stored in a catalog. Several part templates may be defined in the same CATPart document. To create a part template, you: • select parameters and geometry data that will be considered as the template inputs (you can assign a role and a comment to each input). • publish some internal parameters (name and comment). The part number is automatically published. give a name, comment, URL, icon to this template.



In product structure context, the part is inserted as a component of the current product.

Working with Assembly Templates
You create an assembly interactively and you want to create an assembly template that references the root product of this assembly. To create an assembly template, you: • select parameters and geometry data that will be considered as the template

78

Basic Tasks inputs (you can assign a name to each input). • • publish some internal parameters (name and comment). choose if: the part numbers of replicated components are automatically published. for each part or each sub-assembly, this sub-component will be replicated at instantiation or if only a reference to this sub-component will be created (a standard component). you want to select external documents (Drawings / Analysis) that references elements of the product structure. Those elements will be replicated at instantiation. • assign a name, comment, URL, icon to this template. The template definition is a feature located in the CATProduct document itself. Several assembly templates may be defined in the same CATProduct document.

-

To find out more about the Insert Object dialog box ...

The Insert Object dialog box is displayed when instantiating a Power Copy, a User Feature or a Document Template. The Reference scrolling list enables you to select the feature that you want to instantiate if many advanced features (Power Copies, User Features and document templates) were defined. ) is The Comments & URLs icon ( available with User Features and Document templates only. It is always grayed out when instantiating Power Copies. If a URL was added to a User Feature or a Document template, clicking this icon enables you to access the URL. To know more about this function, see the Knowledge Advisor User's Guide.

79

knowledgeTemplate

The Reference scrolling list enables you to select the feature that you want to instantiate if many advanced features (Power Copies, User Features and document templates) were defined. ) is The Comments & URLs icon ( available with User Features and Document templates only. It is always grayed out when instantiating Power Copies. If a URL was added to a User Feature or a Document template, clicking this icon enables you to access the URL. To know more about this function, see the Knowledge Advisor User's Guide. The Name field enables you to change the name of the User Feature instance.

Use identical Features name

This function searches in the whole CATPart for features having the name of the input. If a feature with the input name is found, this feature is automatically used as input

Publications If a publication with the input name is present in the CATPart, the input will be valuated with the published element. The search will be performed only in CATPart files (not in CATProduct). SubElements • If the input is a sub-element of an Axis System (for instance the input name is "Axis System.1 XY Plane") and an axis system named "Axis System.1" is to be found in the CATPart, the "Use Identical Name" function will automatically create a sub-element on Axis System.1. If the input has for name "Point.1/Vertex" (resp "Line.1/Edge", "Surface.1/Face") and Point.1 (resp Line.1, Surface.1) is made of only one subelement, then the input will be valuated automatically.



80

Basic Tasks

Parameters



When an input parameter of a Power Copy or a User Feature belongs to a Geometrical Element or a Parameter Set, in the definition process of the PC or UDF, the default input name of the parameter is computed relatively to its father name. For instance for the parameter X of Point.1, the default input name will be "Point.1/Point Coordinates.1/X". For a parameter in a parameters set, the full name of the parameter will be used because different parameters set can have the same name so we need the full name to identify the right parameter. For instance, for the second parameter Length.1, the default input name will be "Parameters/Parameter.1/Parameters.1/Length.1 " Use Identical Name will look for the parameters published by the geometrical elements. For instance, if the name of the input is "Point.1/Point Coordinates.1/X" (default name) and if a Point.1 is found in the CATPart, the input will be automatically valuated with the parameter X of Point.1. It will work the same way with parameters of a parameter set. For instance, if the name of the input is "Parameters.1/Parameters.1/Length.1 (default name) and if a parameter whose absolute path name is "Parameters.1/Parameters.1/Length.1" is found in the CATPart, the input will be automatically valuated with the parameter Length.1 of the Parameters set.





Multiple solutions Management (V5R11): In case of multiple solutions found for one input name, there will be no automatic valuation and you will have to choose the desired one.

Parameters

This option enables you to display the Parameters dialog box and modify values if need be. It also enables you to create formulas by clicking the Create formulas button on every parameter with the same name provided there are any. This option enables you to access the list of documents (such as design tables) pointed by one of the elements making up the template. If there are documents, the Documents dialog box opens and you can click the Replace button to display the File Selection dialog box and

Documents

81

knowledgeTemplate

navigate to a new design table to replace the initial one. When no document is referenced, the Documents button is grayed out. Repeat Check the Repeat button to repeat the instantiation. In this case, once you have clicked OK in the Insert Object dialog box, the latter remains open, the template's Inputs are listed and ready to be replaced by new inputs, as described above. Modified parameters using Parameters button are retained as well for the next instantiation. To exit the command, uncheck the Repeat button before the last instantiation or click Cancel.

Interactive Templates Quick Reference

User Features Power Copies Part and Assembly Templates

This topic is intended for those of you who need a quick answer to their questions about the interactive templates. However, using this part requires a prerequisite knowledge of templates as no detail is given.

User Features
Creating a User Feature Saving a User Feature in a Catalog Instantiating a User Feature from a Catalog Instantiating a User Feature from a Document Instantiating a User Feature from a Selection Editing a User Feature Managing the orientation of the items making up the User Feature (planes, curves, ...) after instantiating the User Feature in Edit mode Working with the User Feature Definition Window • Renaming an Input • Publishing Parameters • Renaming a Parameter • Modifying the Main Result • Managing Design Tables • Modifying a Parameter Value • Associating a Type to a User Feature Creating a User Feature Scenario 1. Open a .CATPart file.

82

Basic Tasks

2. Select the Insert->UserFeature->UserFeature Creation... command from the standard menu bar or click the Create a UserFeature icon ( Feature Definition dialog box is displayed. ). The User

3. Replace the default User Feature name, then select the object in the specification tree. 4. Select the Outputs tab. Specify the main result. 5. Click OK in the dialog box. The User Feature is added to the specification tree. Saving a User Feature in a Catalog 1. Open a .CATPart file. 2. Click the Save in Catalog icon ( save' dialog box is displayed. ) from the standard menu bar. The 'Catalog
Scenario

3. Select the Create a new catalog option and click the button on the right-hand side of the Catalog name field. The dialog box displayed allows you to create a .catalog file where to store the created User Features. Enter a file name and click Open. Then click OK in the Catalog save dialog box. The catalog containing the User Feature is created. Instantiating a User Feature from a Catalog 1. Open a .CATPart file. 2. In the standard toolbar, click the Open Catalog is displayed. icon. The catalog browser
Scenario

3. Click the icon. In the dialog box which is displayed, select the catalog which contains the User Feature(s) that you want to instantiate. Click Open to open the selected catalog. The dialog box which is displayed next depends on your last interaction on this catalog. Double-click the object displayed in the left pane until the User Feature is available. 4. To instantiate the object into the document: a. If need be, select the feature in the Insert Object dialog box, then select the feature in the document geometry area or in the specification tree. b. Click the Parameters button. The dialog box which is displayed provides you with the way to modify the parameter you have declared as published at the User Feature creation. Modify the value (if necessary). c. Click OK to instantiate the User Feature and exit the Insert Object dialog box. The User Feature is instantiated into the document. Instantiating a User Feature from a Document 1. Open a .CATPart file. 2. Click the Instantiate an element stored in a document icon. The File Selection dialog box is displayed.
Scenario

83

knowledgeTemplate

3. Select the .CATPart file containing the User Feature to instantiate, and click Open. The Insert Object dialog box is displayed. 4. To instantiate the object into the document: a. If need be, select the feature in the Insert Object dialog box, then select the feature in the document geometry area or in the specification tree. b. Click the Parameters button. The dialog box which is displayed provides you with the way to modify the parameter you have declared as published (if any) at the User Feature creation. Modify the value (if necessary). c. Click OK to instantiate the User Feature and exit the Insert Object dialog box. The User Feature is instantiated into the document. Instantiating a User Feature from a Selection Scenario 1. Open the CATPart file that will contain the User Feature instance as well as the file containing the User Feature that you want to instantiate. 2. Tile the window vertically. 3. Expand the KnowledgeTemplates node in the file containing the User Feature and click the User Feature once. 4. Go to the file that will contain the User Feature and click the Instantiate from Selection icon ( ). The Insert Object dialog box is displayed.

5. Make the appropriate selections and click OK to instantiate the User Feature and exit the Insert Object dialog box. The User Feature is instantiated into the document. Editing a User Feature To edit a User Feature, double-click it in the specification tree to display the UserFeature Definition dialog box and edit its content. Note that as far as User Features are concerned, only the following actions can be performed in Edit mode: • • • • • • Renaming inputs Publishing parameters Modifying parameters values Associating an icon with the User Feature Modifying the main result Creating a type associated with the User Feature Note that the User Feature definition cannot be modified after leaving the Definition tab during the creation process.

84

Basic Tasks

Managing the orientation of the items making up the User Feature (planes, curves, ...) after instantiating the User Feature in Edit mode 1. Open the PktManagingPlanes.CATPart file. 2. From the Standard menu, select the Insert->Instantiate from Document... command. 3. In the File Selection window, select the PktPlaneUDF.CATPart file and click Open. 4. The Insert Object dialog box is displayed. Select: o o o Plane.1=zx plane Point.1=Point.1 Plane.2=xy plane

5. Reverse the direction of Plane.1 and Plane.2 and click OK when done. The User Feature is instantiated. 6. Double-click UDF.1 in the specification tree. The Definition box of the User Feature is displayed. Note that even if the selected inputs are both planes, in the first case (Plane.1), the display shows the zx plane as selected, and in the second case (Plane.2), the display shows a new element (Inverse.1) which was created and inserted at instantiation. Click OK to exit the dialog box. 7. Open the PktPlaneUDF.CATPart file and double-click the User Feature: o The input corresponding to Plane.1 is pointed by a Sketch: The orientation of Plane.1 is performed inside the Sketch feature. That is why the input is still the zx plane. The input corresponding to Plane.2 is pointed by a surfacic feature (Extremum.1): To manage the orientation of surfacic features, an Inverse feature is created. That is why the input references Inverse.1.

o

8. Go back to the PktManagingPlanes.CATPart file and double-click the UDF1.1. 9. Select Plane.1 in the Definition box.

85

knowledgeTemplate

o

Note that the orientation of the zx plane is not identical to the one you selected at instantiation. It is a default orientation for the input. If you click the corresponding arrow, you can modify this orientation to get the desired one.

10. Select Plane.2 in the Definition box. o Note that the orientation is the default one for the Inverse.1 feature. If you click the corresponding arrow in the geometry, you can modify the orientation of the User Feature input. You will see then that the Inverse feature disappears or reappears depending on the direction of the arrow.

11. Working withthe UserFeature Definition Window Renaming an Input To rename an input: • Click the Inputs tab in the User Feature Definition window.

86

Basic Tasks

• •

Select the input whose name is going to be modified in the graph. Change its name in the Name field and click OK when done.

Publishing Parameters It is possible to publish parameters. This way, when instantiating the User Feature, you can edit these parameters on the User Feature instance. Published parameters appear under the User Feature reference in the specification tree. To publish a parameter: • • Click the Parameters tab in the User Feature Definition window Select the parameter intended to be modified in a forthcoming instantiation and check the Published option.

It is recommended to change the name of the published parameters for them to be meaningful to the end user. Renaming a Parameter To rename a parameter: • • • Click the Parameters tab in the User Feature Definition window. Select the parameter whose name is going to be modified . Check the Published check box and enter the name of the parameter.

Modifying a Parameter Value To modify the value of a parameter: • • • Click the Parameters tab in the User Feature Definition window. Select the parameter whose name is going to be modified. Check the Published check box, and enter the new parameter value.

Managing Design Tables Suppose you include a design table in the User Feature, you will see the document pointed by the Design Table (as in Edit->Links). When instantiating or editing the User Feature, you will be able to change the document pointed by the internal design table.

87

knowledgeTemplate

Modifying the Main Result 1. Open the PktModifyingMainResult.CATPart file. 2. Double-click UserFeature1 located below the KnowledgeTemplates node. The User Feature Definition window is displayed. 3. Click the Outputs tab. Suppose you are only interested in instantiating the CloseSurface object of Assemble.2. o o Select the Main result output. Click the Replace button, then select the CloseSurface.2 feature in the specification tree. The CloseSurface.2 feature will be the only object carried forward to the receiving document during the instantiation process (no supporting pad).

Suppose you want to instantiate the Assemble.2 feature as a whole plus one of the circles required to build the Body.2 object (Circle.2 for example). o o Specify Assemble.2 as a main result click the Add button, then select the Circle.2 object in the specification tree. The instantiation process will carry forward the Assemble.2 object and the Circle.2 object to the receiving document. Note that the dimension of the secondary outputs should always be inferior to the Main result. 4. Assigning a Type to a User Feature Scenario 1. Open a .CATPart file. 2. Select the Insert->Userfeature->Userfeature Creation... command from the standard menu bar. 3. In the Definition tab, replace the default User Feature name (enter Pad1 as a new name for example) then select a feature in the specification tree. 4. In the Type tab, enter the name of the instance type: Enter the first part of the type in the first box, the second part in the second box and hit the Enter key. 5. Click the Manage Type button. Indicate the Super Type and the Package. 6. Click Create Type, Save, Close.

88

Basic Tasks

Power Copies
Creating a Power Copy Saving a Power Copy in a Catalog Instantiating a Power Copy from a Catalog Instantiating a Power Copy from a Document Instantiating a Power Copy from a Selection Editing a Power Copy Introducing the Power Copy Definition Window • Renaming Inputs • • Publishing Parameters Modifying a Parameter Value

Creating a Power Copy Scenario 1. Open a .CATPart file 2. Select the Insert ->Advanced Replication Tools -> PowerCopy Creation...menu item or click the Create a PowerCopy icon ( 4. Define the Power Copy as you wish to create it. 5. Click OK to create the Power Copy. Saving a Power Copy in a Catalog Scenario 1. Open a .CATPart file containing a Power Copy. The Power Copy is displayed below the Power Copy node. 2. Click the Save in Catalog icon ( ) from the standard menu bar in the PKT workbench. The 'Catalog save' dialog box is displayed. 3. Select the Create a new catalog option and click the button on the right-hand side of the Catalog name field. The dialog box which is displayed allows you to specify a .catalog file where to store the created Power Copies. Enter a file name and click Open. Then click OK in the Catalog save dialog box. Instantiating a Power Copy from a Catalog
Scenario

).

3. Select the elements making up the Power Copy from the specification tree.

1. Open the .CATPart file that will contain the instantiated Power Copy. 2. In the standard toolbar, click the Open Catalog is displayed. icon. The catalog browser

3. Click the icon. In the dialog box which is displayed, select the catalog which contains the Power Copy that you want to instantiate. Click Open to open the selected catalog. 4. Double-click the object displayed in the left pane until you get the object to

89

knowledgeTemplate

be instantiated. 5. Double-click the object. The Insert Object dialog box is displayed. 6. If need be, select the feature in the Insert Object dialog box, then select the feature in the document geometry area or in the specification tree. 7. Click OK to instantiate the Power Copy and exit the Insert Object dialog box. The Power Copy is instantiated into the document. Instantiating a Power Copy from a Document 1. Open a .CATPart file. 2. Click the Instantiate an element stored in a document icon ( Selection dialog box is displayed. ) . The File
Scenario

3. Select the .CATPart file containing the Power Copy to instantiate, and click Open. The Insert Object dialog box is displayed. 4. To instantiate the object into the document: a. If need be, select the feature in the Insert Object dialog box, then select the feature in the document geometry area or in the specification tree. b. Click the Parameters button. The dialog box which is displayed provides you with the way to modify the parameter you have declared as published (if any) at the Power Copy creation. Modify the value (if necessary). c. Click OK to instantiate the Power Copy and exit the Insert Object dialog box. The Power Copy is instantiated into the document. Instantiating a Power Copy from a Selection
Scenario

1. Open the .CATPart file that will contain the Power Copy as well as the file containing the Power Copy that you want to instantiate. 2. Tile the window vertically. 3. Expand the Power Copy node in the file containing the Power Copy and click the Power Copy once. 4. Go to the file that will contain the Power Copy and click the Instantiate from Selection icon ( ). The Insert Object dialog box is displayed.

5. Make the appropriate selections and click OK to instantiate the Power Copy and exit the Insert Object dialog box. The Power Copy is instantiated into the document. Editing a Power Copy To edit a Power Copy, double-click it in the specification tree to display the PowerCopy Definition dialog box and edit its content. Introducing the Power Copy Definition Window Renaming Inputs

90

Basic Tasks

To rename an input: • • • Click the Inputs tab in the Power Copy Definition window. Select the input whose name is going to be modified in the graph. Change its name in the Name field and click OK when done.

Publishing Parameters To publish a parameter: • • Click the Parameters tab in the Power Copy Definition window. Select the parameter intended to be modified in a forthcoming instantiation. Check the Published option.



Modifying a Parameter Value To modify the value of a parameter: • • • Click the Parameters tab in the Power Copy Definition window. Select the parameter whose name is going to be modified. Check the Published check box, and enter the new parameter value.

Part and Assembly Templates
Creating a Part Template Instantiating a Part Template Introducing the Document Template Definition Window

• •

Adding External documents Assigning a Role to an Input

Creating a Part TemplateScenario 1. Open a .CATPart file. 2. From the Insert menu, select the Document Template Creation ... command or click the Create a Document Template icon ( ).

3. In the Document Template Definition window, click the Inputs tab and select

91

knowledgeTemplate

the inputs you want to select. 4. In the Document Template Definition window, click the Published Parameters tab to publish parameters (if need be.) 5. Save the file (note that you can save the document template in a catalog.) lnstantiating a Part Template from a catalogScenario 1. Open a .CATProduct file. 2. Click the Catalog icon and select the catalog you created when creating the template. 3. Double-click the family and the Document Template.1 template. 4. In the Insert Object window, click the Use Identical Name button in the Insert Object window. Make the appropriate selections in the viewer when necessary and click OK when done. Using the Document Template Definition Window Adding External documents To add external documents: • In the Documents tab, click the Add... button. The File Selection window is displayed. Select the file that will be associated with the template. Click Open. Note that external documents can only be files of the following types: • • • .CATDrawing .CATAnalysis .CATProcess

• •

Assigning a Role to an Input To assign a role to an input: • • • Click the Inputs tab in the Document Template Definition window. Select the input whose name is going to be modified in the graph. Change its name in the Name field and click OK when done.

92

Advanced Tasks
Advanced Tasks

Working with Scripting Templates Use Cases

Working with Scripting Templates
Working with Scripting Templates
• • The upward compatibility of the Scripting Language is guaranteed. For comprehension purposes, some modifications (listed in the following pages) have been made to the Generative Script language. New objects have been added, as well as new attributes. Some types have been removed. To know more about the objects and their new equivalents, see Generative Script Objects. The objects available in the browser can now be instantiated.



This new section explains how to use the scripting language to create templates. It is divided into 2 different parts: The first part explains the basics of the scripting tool that you can access by clicking the Create a Generative Script This first section is made up of the following topics: • Creating a Script • Starting from a Script Skeleton • Generating the Result of a Script icon in the toolbar.

The second part presents the script: its structure, its syntax, its objects, the commands that can be of use when writing a script as well as more advanced functions. This second section is made up of the following topics: • Using the Scripting Language Script Structure Generative Script Objects Object Properties Comments Operators

o o o o o

93

knowledgeTemplate

o o o o

Keywords Variables Limitations Using The Generative Knowledge Commands

• • • • • Specifying a Context Declaring Input Data Reusing Input Data Tips and Tricks

Before creating a loop in a CATPart document, make sure that the Manual input option is unchecked in the Part Number field of the Tools>Options->Infrastructure->Product Structure->Product Structure tab.

Creating a Script

This task explains how to use the script editor as a dialog box to create a script. For information on how to write a script, see Using the Scripting Language Before creating a loop in a CATPart document, make sure that the Manual input option is unchecked in the Part Number field of the Tools->Options>Infrastructure->Product Structure->Product Structure tab. 1. Access the Product Knowledge Template workbench by selecting the Product Knowledge Template workbench from the Start>Knowledgeware menu. 2. Click the icon. The Knowledgeware Script Editor is displayed.

94

Advanced Tasks

3. At this stage, you can create a document skeleton by using the File>New->CATPart or CATProduct document command or by typing the proper instructions into the editor. See Using a Script Skeleton for information on how to start from a skeleton. See Using the Scripting Language for information on the language. 4. Save your script by using the File->Save or File->Save As command. Your script is saved in a .CATGScript file. 5. Click Generate to create the document.

Starting from a Script Skeleton

This task explains how to write a script by using the Script Editor. This editor provides you with a way to create a skeleton which reflects the structure of a .CATPart or of a .CATProduct document.

1. In the Product Knowledge Template workbench, click the icon. The Script Editor is displayed. 2. In the Script Editor, select the File->New->CATPart document command. The dialog box is displayed:

95

knowledgeTemplate

3. Fill in the fields and click OK. A basic script is created. 4. Save your script and/or generate the related document.

To enrich this script, see Using the Scripting Language.

Generating the Result of a Script
This task shows how to generate a document from a script. 1. Access the Product Knowledge Template workbench by selecting the Knowledgeware-> Product Knowledge Template command from the Start menu. 2. Click the icon. The Knowledgeware Script Editor is displayed.

3. Enter your script in the editor or open an already existing .CATGScript file. 4. Click Generate. The related document is created in the geometry area. 5. If need be, save your script before exiting the editor. You can add a new feature to an already existing part provided the name of the part in the script describing this new feature is the same as the name of the part to which you want to add the new feature to. This capability applies to parts generated either from a script or from the Part Design workbench.

Using the Scripting Language
Using the Scripting Language
Introducing the Scripting Language

96

Advanced Tasks The Scripting Language is a declarative way of generating V5 Features. What does it allow you to do? You can describe objects using a very simple script language. • • • 3D geometric features (sketches, parts, ...). Parameters on features including formulas. Related positioning & orientation constraints.

They can interactively generate the corresponding V5 models.

How can you use it? • You can launch the Script editor (graphic mode) in the Product Knowledge Template workbench, open a script file or type it in, then generate the result. • You can launch a script file in a Rule action using the GenerateScript function. You can launch a script stored in a catalog.



Introducing the Scripting Language main Features

The Scripting language enables you to: • Import definitions from other models/scripts and then instantiate the imported components. See Import keyword. • Incrementally define objects, their properties and the other features they own. Define input parameters that will be valued by you at the beginning of the generation. See Declaring Input Data. Easily capture generic naming to instantiate contextual features, constraints, ... See Using the Generative Knowledge Commands.





Script Structure Generative Script Objects Object Properties Comments Operators Keywords

97

knowledgeTemplate Variables Limitations Using The Generative Knowledge Commands

Script Structure

A generative script is written in text format and is organized in blocks consisting of related sets of statements. A block consists of an instruction designed to create an object followed by a set of statements surrounded by braces ({ }). Statement blocks can be nested and the most enclosing one within a script corresponds to the document creation. A document is made up of a hierarchy containing objects, their properties and the features they own. A generative script reflects this object hierarchy. In the outermost statement block, you must create the document intended to contain all the features to be created later on.

Example 1
Please find below the basic structure of a script. You can create this skeleton by using the File->New->CATPart document command of the Script Editor: part isa CATPart { Mypart isa Part { PartBody isa BodyFeature { } } }

Example 2

98

Advanced Tasks MyDocument isa CATPart // Creates a CATPart document { MyPart isa Part { L = 30.0; PartBody isa BodyFeature // Creates the main body { Length = 100.0; // Length is a parameter of the part Cyl isa Cylinder { cylinderLength = 20.0; } Base isa Cylinder // Base is an instance of Cylinder owned by MyPart { Height = ?Length * 2; // a formula property using MyPart/Length; } } } }

To know more about the isa keyword and the ? operator, see isa keyword and ? operator.

Object Properties



An object is created by default with some property values. These properties are defined or re-defined within the braces just following the object declaration (isa keyword). Unless otherwise specified, the units are SI units. When defining properties, the semicolon ( ;) is a terminator (see example below).

• •

Example

myLineDocument isa CATPart

99

knowledgeTemplate { myPart isa Part { OBody isa OpenBodyFeature { Po1 isa GSMPoint { PointType = 0; TypeObject isa GSMPointCoord { X = 50mm; Y = 100mm; Z = 150mm; } } Po2 isa GSMPoint { PointType = 0; TypeObject isa GSMPointCoord { X = 50mm; Y = 0mm; Z = 150mm; }

100

Advanced Tasks } L isa GSMLine { LineType = 0; TypeObject isa GSMLinePtPt { FirstPoint = object: ../../Po1; SecondPoint = object : ../../Po2; } } L2 isa GSMLine { RefPoint = object: ../../Po1; Values["Start"] = 2 mm; Values["End"] = 20 mm; RefSkin = object : ../../../`xy-plane`; } } } } }

To know more about the objects, see Generative Script Objects.

Comments
101

knowledgeTemplate

Multi-line comments (/* ... */) are supported. A single-line comment begins with a pair of forward slashes(//). Note that DBCS characters are not supported as comment.

Example
Sphere1 isa Sphere // Creates a sphere { // Valuates the Radius property Radius = 15.0 ; }

Operators
Arithmetic operators
+ Addition operator (also concatenates strings) - Subtraction operator * Multiplication operator / Division operator ( ) Parentheses (used to group operands in expressions) = Assignment operator

? (Question Mark in Formulas)
Definition

In a formula, specifies that the parameter value to be applied is the first parameter value found when scanning the specification tree from the formula to the top of the specification tree.

(Relative Path in Formulas)
Definition

Defines where the value of a parameter used as an argument in a formula is to be read. A single.. exits the statement block where the formula is defined. The parameter value applied in the formula is then the one defined in the parent feature scope. 102

Advanced Tasks

Keywords
import Keyword
Definition
Specifies a document file (.CATPart or .CATProduct) containing definitions to be reused or redefined in the document to be generated. All the features and feature values in the imported file become available to the document to be generated. Importing a document is: • Of interest whenever you want to retrieve a consistent set of definitions from an already existing document. • Required whenever you need to create a feature from a sketch (the script language does not allow you to specify a sketch).

Syntax

import FileName ; where FileName is the name of the file which contains the document to be imported. You should enclose the document name within quotation marks and end the import statement with a semicolon (;). To specify a file to be imported, you can: • Use the 'Insert File Path' command from the contextual menu. Selecting this command displays a file selection window. Quotation marks are automatically included but not the semicolon or Use the Input keyword. A dialog box is displayed when the document is generated. You have to enter the input data required one-by-one to execute the script. For more information, see Input and In Keywords.



Example
The following statement import Input : FilePath "Name of the document to be imported";

103

knowledgeTemplate displays the dialog box below when the script is executed:

Clicking Select displays a file selection window. You have to click Apply to make the OK button active.

let Keyword
Definition

Assigns the value of an Input expression to a variable. Using this keyword prevents you from re-entering the value of an input data.
Syntax let name = Input : type_of_input ; Example

context Input : Feature "Context ?"

let X = Input : Feature "First Point to reuse"; let Y = Input : Feature "Second Point to reuse";

body isa OpenBodyFeature { L isa GSMLine { LineType = 0; TypeObject isa GSMLinePtPt

104

Advanced Tasks { FirstPoint = object: Input X; SecondPoint = object: Input Y; } } }

In Keyword
Definition
Enables you to create a multiple value parameter. It can be used together with the Input keyword to specify that a piece of data is a multiple value one.

Syntax
DataName = DefaultValue, Input: DataType In: 'value1,value2,...'; where: • DataName is the name of the piece of data whose value is to be entered by the end-user. • DefaultValue is the default value to be displayed in the "Enter Inputs" dialog box. DataType is the type of the piece of data whose value is to be specified (see above).



Example

myDocument isa CATPart { myPart isa Part { PartBody isa {
BodyFeature

105

knowledgeTemplate WWW = 3.6 mm , Input: Length; X = 6.6 mm , Input: Length In : `6.6mm,12 mm,100mm,3.3m` ; Y = 5 , In : `5,10,15,25,50,3304324324`; XX = "relation" , In : `relation1, relation2, relation3`; ZZ = 3, Hide: true; } } }

publish Keyword
Definition
Enables you to assign an object a name that will be used in the script.

Syntax
publish "!xxx" as yyy ; Where: • xxx is the name of the object to be published. To select this object, it is highly recommended to use the contextual menu. • yyy is the name you want to assign to this object

Example 1
Product_Root isa CATProduct { Product_Assemblage isa Product { Part_For_Publish isa Product { Boite isa Part { PartBody isa BodyFeature { My_Boite isa Pad {} } } publish

106

Advanced Tasks "!Selection_RSur:(Face:(Brp:(My_Boite;0:(Brp:(Sketch.1;2)));None:());My_Boite)" as Surf_Normal_To_X_axes; } } }

Input Keyword
Definition
Enables you to declare a value to be entered by the end-user. Before the document is generated, a dialog box is displayed and the user is required to enter a value for each piece of data declared as an input. The Input keyword may be used in two different contexts: • If you want a user input to be required, use the following syntax: Input:type_of_the_needed_input Example: Input:Feature or Input:Length or Input:FilePath A user input may be required in the following cases: • To define the context of the script: context Input:Feature "Specify the context" • To valuate an attribute: X = 10, Input:Length "Enter the value"; or RefPlane = object: Input:Feature "Specify the reference plane"; • To valuate a name: PartBody, Input:Name "Enter the body name" isa BodyFeature • To define an import: import Input : FilePath "Enter the file name"; • To valuate a local variable: let X = Input : Feature "First Point to use";



If you want to re-use a local variable. Example: let X = Input : Feature "First Point to reuse"; let Y = Input : Feature "Second Point to reuse"; .... L isa GSMLine {
LineType = 0; TypeObject isa GSMLinePtPt { FirstPoint = object: Input X; //X and Y are local

107

knowledgeTemplate

SecondPoint = object: Input Y; // variables

} } ... // Here is the list of data that can be declared as an input: Data parameter file paths feature names edges when they are used to create features like chamfers or fillets points when they are used to create holes features faces axes length type parameter type as declared in f(x) FilePath Name Edge Point Feature Face Axis Length

Syntax
DataName = DefaultValue, Input: DataType "Comment" or DataName = DefaultValue, Input: DataType In: 'value1,value2,...'; where: • DataName is the name of the data whose value is to be entered by the enduser. • DefaultValue is the default value to be displayed in the "Enter Inputs" dialog box. DataType is the type of the data whose value is to be specified (see above). valuei is one of the values of a multiple value data.

• •

Example
When the script below is executed: myDocument isa CATPart

108

Advanced Tasks { myPart isa Part { PartBody isa BodyFeature { L = 3.6 mm , Input: Length "Enter the pad length"; X = 6.6 mm , Input: Length "Select a value in the list" In : `6.6mm,12 mm,100mm,3.3m` ; FeatureName = "Part1" , In : `Part1,Part2,Part3`; } } } The following dialog box is displayed: • The L and X values are to be entered by the user. The L default value is set to 3.6mm. If you wish to modify this value, select the L line, modify the value in the 'L=' field then click Apply. The X line is then highlighted and the 'X=' field displays a four-value list.



Select one of these values, click Apply then click OK to execute the script and generate the document. The FeatureName parameter which is a multiple value parameter is created in the specification tree. You can edit it to check the list of possible values.

from Keyword
Definition

109

knowledgeTemplate Allows the user to copy a document from an existing document without maintaining any link.

Syntax
DocumentName isa DocumentType from FilePath where: • DocumentType is either CATProduct, CATPart or model. • FilePath is the full path of the initial document.

To enter a file path you can: • Use the Insert File Path command from the contextual menu or • Use the Input keyword:
?" h isa CATPart from Input : FilePath "Enter the file path

Example
h isa CATPart from "c: temp { h isa Part { // Additional features } } CATPart"

context Keyword
Definition
Enables you to define in which part of the specification tree the object will be created. The context keyword may be of use in 4 different cases: • It can be used together context Input: FilePath with the Input keyword. Part isa Part In this case, you are { prompted to enter your BBB isa BodyFeature inputs. { Mycylinder isa Cylinder { } } } • It can indicate a document to be used. In this case, the "..." are used. context "Mypart.CATPart" MyPart isa Part { }

110

Advanced Tasks



It can reference an context `My.CATPart object contained in the CC isa Cylinder { } document. In this case the path needs to be specified (between `...`).

MyPart

PartBody`



It can be used as an `$context$` argument when the script is generated with a knowledge Expert rule.

Syntax
• context Input: FilePath

or • context "Mypart.CATPart"

or • context
`My.CATPart MyPart PartBody`

or • `$context$`

Example
context Input: FilePath Part isa Part { BBB isa BodyFeature { Mycylinder isa Cylinder { } } } context "Part.CATPart" Mypart isa Part { } context `Part.CATPart CC isa Cylinder { } Mypart PartBody`

111

knowledgeTemplate

isa Keyword
Definition
Creates a typed object or instantiates an object.

Syntax

ObjectName isa ObjectType or

ObjectName isa InstanceName where: • ObjectName is the name of the object to be created. • • ObjectType is the type of the object to be created. InstanceName is the name of the object to be instantiated.

Example
In the example below, S0 is an instance of the Sketch.0 feature which is imported from the GPS.CATPart document. import "E: GPS.CATPart"; myGps isa CATPart { myPart isa Part { PartB isa BodyFeature { S0 isa Sketch.0 {} pad0 isa Pad("S0") ... } } } The name of the created object should be different from the object type (Box isa Box is incorrect).

Variables

112

Advanced Tasks

Variables are declared explicitly in your script. These variables are displayed as parameters in the specification tree.

ALPHA = 45 deg;

Unlike in most script languages, a variable's scope is not really determined by where you declare it. From anywhere in your script, you can access a variable by using the ../.. and ? operators. After the script is finished running, the variable declared in your script still exists as a document parameter.

Limitations

You should be aware of some restrictions: • Instances of sketch-based features cannot be moved apart from their prototype. • Any parameter used as an argument in a formula should be preceded by the ? symbol. The syntax X = 2 * Y is invalid and should be replaced with X = 2 * ? Y. Unless a formula-defined parameter has not been initialized with the proper units, the value calculated from the formula is dimensionless. Y = 0 kg ; Y=2*?X; A script error stops the reading and the execution of the script.





Generative Script Objects

113

knowledgeTemplate To display the list of the objects that can be instantiated in PKT, use the Object Browser available through the Tools->Object Browser... command. To know more about the Object Browser, see Using the Object Browser.

Using The Get... Commands
The commands described in this section are the ones you can access when using scripting language Editor and right-clicking in the Editor window. When writing a script containing the path of a feature contained in the specification tree, it is highly recommended to use the Get Feature command to retrieve the internal name of this feature. • • • • • Using Using Using Using the the the the Get Get Get Get Axis Command Edge Command Surface Command Feature Command

Using the Insert File Path Command

The 'Get Axis' Command
This task explains how to create a chamfer by using the Get Axis command. This command enables you to interactively capture the generic name of an axis and to insert it into the script instead of keying it in. 1. Access the Product Knowledge workbench, and open the Script Editor. 2. Enter the following script and click Generate. A pad is created. myChamferDocument isa CATPart { myPart isa Part { PartBody isa BodyFeature { P isa Pad { } } } }

3. Under the P isa Pad block, add F isa Chamfer, right-click to open the contextual menu and select the Get Axis command, and select an edge in your geometrical surface. The script should be as follows: myChamferDocument isa CATPart {

114

Advanced Tasks

myPart isa Part { PartBody isa BodyFeature { P isa Pad { } F isa Chamfer("Edge:(Face:(Brp:(P;0:(Brp:(Sketch.1;2))); None:());Face:(Brp:(P;0:(Brp:(Sketch.1;3)));None:()); None:(Limits1:();Limits2:()))"){} } } } 4. Click the Generate button. The chamfer is created.

The "Get Edge" Command
This task explains how to create a chamfer by using the Get Edge command. This command enables you to interactively capture the generic name of an edge and to insert it into the script instead of keying it in. 1. Access the Product Knowledge Template workbench, and open the Script Editor. 2. Enter the following script and click Generate. A pad is created. myChamferDocument isa CATPart { myPart isa Part { PartBody isa BodyFeature { P isa Pad { } } } }

3. Under the P isa Pad block, add F isa Chamfer, right-click to open the contextual menu and select the Get Edge command, and select an edge in your geometrical surface. The script should be as follows: myChamferDocument isa CATPart { myPart isa Part { PartBody isa BodyFeature {

115

knowledgeTemplate

P isa Pad {} F isa Chamfer("Edge:(Face:(Brp:(P;0:(Brp:(Sketch.1;2))); None:());Face:(Brp:(P;2);None:());None:(Limits1:();Limits2:()))"){} } } } 4. Click the Generate button. The chamfer is created.

The "Get Surface" Command
This task explains how to create a sketch on an existing face by using The Get Surface command. This command enables you to interactively capture the generic name of a surface and to insert it into the script instead of keying it in. 1. Open the PktGetSurface.CATPart file. 2. Access the Product Knowledge Template workbench, and open the Script Editor. Enter the following script: import "f: cube.CATPart"; myFaceDocument isa CATPart { myPart isa Part { PartBody isa BodyFeature { P isa Pad{} S isa Sketch.1() 3. Position the cursor between the two parentheses of the last line of the above script, right-click to open the contextual menu and select the Get Surface command. 4. Select the face whose name you want to capture. The full name is inserted at the cursor location. Enter the end of your script. In our example, the final script is as follows: import "f: PktGetSurface.CATPart"; myFaceDocument isa CATPart { myPart isa Part { PartBody isa BodyFeature { P isa Pad{} S isa Sketch.1("Face:(Brp:(P;0:(Brp:(Sketch.1;2)));None:())") { }

116

Advanced Tasks

} } 5. }

The "Get Feature" Command
This task explains how to create a sketch on an existing face by using The Get Surface command. This command enables you to interactively capture the generic name of a surface and to insert it into the script instead of keying it in. 1. Open the PktGetFeature.CATPart file. 2. Access the Product Knowledge Template workbench, and click the Create a Generative Script icon. 3. In the editor, select the File->Open command, and select the PktGetFeature.CATGScript file. 4. Position the cursor after FirstPoint = object: and select the Get Feature command in the contextual menu. 5. Select a point in the geometry and add a semi-colon (;) at the end of the line. 6. Position the cursor after SecondPoint = object: and select the Get Feature command in the contextual menu. 7. Select another point in the geometry and add a semi-colon (;) at the end of the line. Your script should now look like the one below:

Click the Generate button. The line is created.

The "Insert File Path" Command

117

knowledgeTemplate

This task explains how to use the Insert File Path command. This command is one of the methods you can use to specify a path in a script. 1. Access the Script Editor and enter any instruction requiring a file path specification (import in the example below). 2. Position the cursor where the path is to be specified.

3. Right-click and select the Insert File Path command from the contextual menu.

4. In the dialog box which is displayed, select the appropriate file. Click Open to go back to the script editor. 5. The full path is inserted at the cursor place. Check that the statement is ended by a semi-colon.

6.

Specifying a Context

118

Advanced Tasks

After a document has been generated, you can add new features to this document by executing another script provided you declare in this other script the document you want to add new features to. This declaration is made by using the context keyword. To know more about this keyword, see context keyword. 1. Re-run The Pocket Calculator scenario. 2. Enter the script below into the editor (close the editor from before and reopen a new window or delete all the instructions in the current editor). context `calc.CATPart/part1/partbody` h1 isa Hole ( ) { Diameter = 4mm; } 3. The path specified in the context statement must be surrounded by back quotes. 4. Position the cursor between the parentheses right after the Hole statement, select the Get Feature command from the contextual menu then select a point on the calculator (see the figure below for the location of that point). Then click 'Generate'. This is what you get on screen.

The h1 feature is added to the document.

Declaring Input Data

119

knowledgeTemplate

This task explains how to declare data as to-be-entered by the user and how to fill in the dialog window which is displayed before the document is generated. Not all data can be declared as inputs. Data can be entered by the user provided they have been declared as Inputs by using the Input keyword in the script. When the script is generated, a dialog box is displayed the list of values to be entered in order to generate the document. See the Input Keyword for more information on this keyword. File Paths, Feature Names and Parameter Values 1. In the Product Knowledge Template workbench, click the Knowledgeware Script Editor is displayed. 2. Enter the script below icon. The

import Input : FilePath "Name of the CATPart to be imported"; Pad1 isa CATPart { mypad isa Part { X = 10mm, Input : Length "Enter the pad length"; PartBody, Input:Name "New PartBody Name" isa BodyFeature { S isa Sketch.1{} P isa Pad("S"){} } } } 3. Click Generate. The dialog box below is displayed:

120

Advanced Tasks

4. To enter the FilePath input, click Select then select the PktSketchToImport.CATPart sample. Click Apply. 5. The X value is now highlighted in the dialog box and you are prompted to enter the X value, that is the pad length. To use the default value, just click Apply. Otherwise, enter a new value in the X field, then click Apply. 6. If need be, repeat this operation for the Name input. Click Apply to enter the Name value. The OK button should now be active. (The OK button is grayed out as long as there is still one or more inputs to be specified). Click OK. The extruded pad below is generated:

Edges 1. In the Product Knowledge Template workbench, click the The Knowledgeware Script Editor is displayed. icon.

121

knowledgeTemplate

2. Enter the script below:

MyBox isa CATPart { BoxPart isa Part { PartBody isa BodyFeature { Box1 isa Box { Width = 20.0 mm ; Height = 25.0 mm ; Length = 15.0 mm ; } } } } 3. Click Generate. A box is displayed in the geometry area. 4. Back to the script editor. Add the statements related to the fillet and hole creations to your script:

MyBox isa CATPart { BoxPart isa Part {

122

Advanced Tasks

PartBody isa BodyFeature { Box1 isa Box { Width = 20.0 mm ; Height = 25.0 mm ; Length = 15.0 mm ; } /* Added statements - Start */ fillet2 isa ConstantEdgeFillet (//right-click, select the Get Edge command and click an edge in the Geometry) { Radius =2.0 mm; } /* Added statements - End */ } } } 5. Click Generate. The fillet is created.

Features 1. In the Product Knowledge Template workbench, click the The Knowledgeware Script Editor is displayed. icon.

2. Use the File->Open command to open the PktInputFeature0.CATGscript macro which is delivered as a sample.

123

knowledgeTemplate

Don't remove the comments corresponding to the line creation. 3. Click Generate. The Po1 and Po2 points are created in the geometry area and the specification tree is updated accordingly. 4. In the script editor, remove the comments in order to create L, then click Generate. The "Enter Inputs" dialog box is displayed. Only one input is to be entered by the end-user. Click Select, then select the Po1 feature in the specification tree.

5. Click Apply then OK. The line joining Po1 and Po2 is created.

6.

Reusing Input Data

124

Advanced Tasks

The scenario below explains how to reuse input data using the let keyword. To know more about this keyword, see let Keyword.

1. Re-run The Pocket Calculator scenario. Keep the generated document open. 2. Enter the script below in the editor:

context Input : Feature "Select OBody" P1 isa GSMPoint { PointType = 0; TypeObject isa GSMPointCoord { X = 50mm; Y = 0mm; Z = 150mm; } } P2 isa GSMPoint { PointType = 0; TypeObject isa GSMPointCoord { X = 50mm; Y = 100mm;

125

knowledgeTemplate

Z = 150mm; } }

Line1 isa GSMLine { LineType= 0 ; TypeObject isa GSMLinePtPt { FirstPoint = object : Input : Feature "Select WindowP3"; SecondPoint = object: ../../P1; } }

Line2 isa GSMLine { LineType= 0 ; TypeObject isa GSMLinePtPt { FirstPoint = object : Input : Feature "Select WindowP3"; SecondPoint = object: ../../P2; } } 3. Click Generate. The Enter Inputs dialog box is displayed. You are prompted to enter the OBody feature, then twice the WindowP3 feature. Click Cancel

126

Advanced Tasks

and proceed to the next step. 4. Replace the current script with the one below:

let X = Input: Feature "Select WindowP3"; context Input : Feature "Select OBody"

P1 isa GSMPoint { PointType = 0; TypeObject isa GSMPointCoord { X = 50mm; Y = 0mm; Z = 150mm; } } P2 isa GSMPoint { PointType = 0; TypeObject isa GSMPointCoord { X = 50mm; Y = 100mm; Z = 150mm;

127

knowledgeTemplate

} }

Line1 isa GSMLine { PointType = 0 ; TypeObject isa GSMLinePtPt { FirstPoint = object : Input X; SecondPoint = object: ../../P1; } }

Line2 isa GSMLine { LineType= 0 ; TypeObject isa GSMLinePtPt { FirstPoint = object : Input X; SecondPoint = object: ../../P2; } } 5. Click Generate. The dialog box below is displayed:

128

Advanced Tasks

6. Click Select then select the WindowP3 feature. Click Apply. The second input line is highlighted. Click Select then select the OBody feature. Click Apply then click OK. Two lines are created. WindowP3 is the point where they intersect.

Tips and Tricks
About Generic naming
Generic naming is a CATIA technique which creates a label whenever an element has been selected interactively. This label is a coded description of the selected element. When you specify a fillet to be applied to a face, you must select interactively the 129

knowledgeTemplate face definition but prior to doing this you must of course have generated the face to be filleted. This is why scripts requiring face, point or edge definitions cannot be generated in one shot. You don't have to mind about the generic naming itself as it is automatically captured from the geometry area. The thing you have to mind about is the order your instructions are to be written and executed in the script. Example The "mechanical" part of the PktPocketCalculator.CATGScript sample is to be generated in two shots: 1. import the necessary sketches and generate the pads: import Input : FilePath "Select the PktInitialSketch.CATPart sample" ; calc isa CATPart { part1 isa Part { partbody isa BodyFeature { S1 isa Sketch.1 {} S2 isa Sketch.2 {} pad1 isa Pad("S2") { FirstLength = 0.5mm; SecondLength=2.0mm; } fillet1 isa ConstantEdgeFillet ("Face:(Brp:(pad1;0:(Brp:(S2;1)));None:())") { Radius =1.0 mm; } pattern1 isa Pattern[4,4] of fillet1 { Step1 =7.0 mm; Step2 = 7.0 mm; } /* pad0 isa Pad("S1") { FirstLength = 5.0mm; SecondLength=0mm; } */ /* fillet2 isa Fillet (select the cylindrical face of pad0 ) { Radius =2.0 mm; } */

130

Advanced Tasks } } } 2. Remove the comments before the following lines and click Generate: pad0 isa Pad("S1") { FirstLength = 5.0mm; SecondLength=0mm; } 3. Capture the fillet1 and fillet2 definitions, remove the comments and reexecute the script: 4. import Input : FilePath "Select the PktInitialSketch.CATPart sample" ; calc isa CATPart { part1 isa Part { partbody isa BodyFeature { S1 isa Sketch.1 {} S2 isa Sketch.2 {} pad1 isa Pad("S2") { FirstLength = 0.5mm; SecondLength=2.0mm; } fillet1 isa ConstantEdgeFillet (capture the face using the Get surface command) { Radius =1.0 mm; } pattern1 isa Pattern[4,4] of fillet1 { Step1 =7.0 mm; Step2 = 7.0 mm; } pad0 isa Pad("S1") { FirstLength = 5.0mm; SecondLength=0mm; } /* fillet2 isa ConstantEdgeFillet (capture the face using the Get surface

131

knowledgeTemplate command ) { Radius =2.0 mm; } */ } } }

Message "property does not exist..."
Check in the browser that the attribute name is correct. For attributes of list type (Fillets and Chamfers), check the indexes. The indexes specified must be consecutive from 1 to n without any gaps. The script below displays the message: "property does not exist: CstEdgeRibbon.2 on: EdgeFillet.1" at generation Boite isa CATPart { boite isa Part { partbody isa BodyFeature { pad1 isa Pad { FirstLength = 0.5mm; SecondLength=2.0mm; } fillet1 isa ConstantEdgeFillet ( "Face:(Brp:(pad1;2);None:())" ) { CstEdgeRibbon.2 } } } } Radius =1.0 mm;

Message "feature could not be updated"
This message is displayed whenever the system does not find the required data to build the specified feature. In the PktPocketCalculator.CATGScript sample, replacing the WindowCurve and Fill2 definitions with the script below displays the message "Fill2 could not be updated".

132

Advanced Tasks WindowCurve isa GSMCurve { Elements[1] = object : .. Elements[2] = object : .. WindowP1; WindowP2; WindowP3;

// Elements[3] = object : .. Elements[4] = object : .. Elements[5] = object : .. } Fill2 isa GSMFill { Boundary = object : .. }

WindowP4; WindowP1;

WindowCurve;

Fill2 cannot be created because one element of the list required to defined the WindowCurve feature has been removed. WindowCurve is created but it is not a closed curve and it cannot be filled. Features that "could not be generated" are displayed as invalid features in the specification tree. Editing an invalid feature can help you determine which data is missing. Another way to investigate consists in rebuilding interactively the feature that could not be built by the script.

Specifying a File Path (3 methods)
Method 1: Use the Insert File Path command from the contextual menu. To do this, position the cursor where the file path is to be specified, then right-click and select the Insert File Path command from the contextual menu. In the dialog box which is displayed, select the appropriate path, then click Open. This insert the full path between quotation marks into your script. Method 2: Define your linked document strategy. Use the Link Document Localization command of the CATIA Tools->Options... menu to define your linked document strategy. Choosing an appropriate strategy allows you to specify only the short path of a document. Example: If the E: www samples folder is specified in the 'Search Order' of the 'Other Folders' Configuration, you can write: import "PktInitialSketch.CATPart" ; instead of import "E: www samples PktInitialSketch.CATPart" ;

133

knowledgeTemplate See to the CATIA Infrastructure User's Guide for how to use the Link Document Localization command. Method 3: Use the Input : FilePath keyword. Input : FilePath comment ; displays a dialog box which prompts you to select a file path. The file path being selected, you must click Apply to enter the next input data or make the OK button active.

The Rectangular Pattern is not Generated
Sorry! The present version of the Generative Script only allows you to generate rectangular pattern in the xy plane.

Importing Sketches: Recommendation
When designing a document to be generated by a script, it is better to group all the required sketches in a single file. That way: • you minimize the overall size of your sketch-related data • no matter the method used to specify the input file, you just have to specify the path once the design of the final document is made easier. You get a global view of the sketches on which the other features rely.



Specifying Strings: Recommendation
Double quotation marks as well as single quotation marks of apostrophe type (`) can be used to delimit strings. Single quotations marks (`) must be used to enclose character strings which contain other strings. Here is an example: RuleBody =`if P->Name() == "Wing" Message("This is a wing")`;

Use Cases
Use Cases
Assembly The Tow Hook

134

Advanced Tasks

Template User Feature Scripting Template The Morphing Template The Ladder The Pocket Calculator

The Tow Hook
The scenario developed below is intended to show how to create and instantiate an assembly template into a .CATProduct file.

To perform this scenario, you will need the following files:

PktTowHook.CATProduct PktTowHook_Result.CATProduct

M39.CATPart Liner_Step3.CATPart Axis_Step3.CATPart Support.CATPart

PktDestinationProduct.CATProduct Input_Axis.CATPart Part32.CATPart

135

knowledgeTemplate

Creating the Assembly Template

1.

Open the PktTowHook.CATProduct file. The following image is displayed.

2. From the Start->Mechanical Design menu, access the Drafting workbench. The New Drawing Creation Window is displayed. 3. Select the All views configuration and click OK. 4. The drawing corresponding to the pad is generated.

4. Save your drawing and close the file. Click here to see the generated drawing.

136

Advanced Tasks

5. Go back to the PktTowHook.CATProduct file to create an assembly template. From the Insert menu, select the Document Template Creation ... command. The Document Template Definition window is displayed.

6. In the Document Template Definition window, define the document template. • In the Documents tab, click the Add... button and select the drawing that you have just selected or use the PktHookDrawing.CATDrawing file. Click the Inputs tab. In the geometry, expand the Support node and select the following items located below the Isolated External References node: • • • • • • • • • Surface.1 Curve.1 Surface.2



Select Surface.1 and assign it a new name: PlanarFace Select Curve.1 and assign it a new name: Center_CircularEdge Select Surface.2 and assign it a new name: Axis_CylindricalFace Click the Published Parameters tab and click the Edit List... button. In the Select parameters to insert window, select the Support Tube_Thickness parameter using the arrow button. Click OK to validate. The Document template is displayed below the KnowledgeTemplates node.

7. Save your file and close it. Click here to open the result .CATProduct file.

137

knowledgeTemplate

Instantiating the Assembly Template 8. Open the PktDestinationProduct.CATProduct file. The following image is displayed.

9. From the Start->Knowledgeware menu, access the Product Knowledge Template workbench. ) and select the 10. Click the Instantiate from Document icon ( PktTowHook_result.CATProduct file in the File Selection window. The Insert Object dialog box is displayed.

138

Advanced Tasks

11. Select the visible face of the pad. Face is displayed in the Insert Object dialog box. 12. Select the pocket in the Geometry. 13. Expand the Input_Cylinder node and select the Extract.1.

14. Click OK to validate. The assembly template is instantiated (Click here to open the result file)...

and the associated drawing is updated accordingly (click here to open the generated drawing).

139

knowledgeTemplate

The Ladder

140

Advanced Tasks

The scenario below illustrates the following generative script capabilities: • • • • Multiple value parameters Part design patterns Knowledge advisor rules Formulas using the ? operator.

To perform this scenario, you need the PktLadderSketch.CATPart sample which provides you with the necessary sketches. 1. Select the Knowledgeware->Product Knowledge Template command from the Start menu. 2. Click the icon. The Knowledgeware Script Editor is displayed.

3. Use the File->Open command to open the PktLadder.CATGScript document, then click Generate. The Enter Inputs dialog box below is displayed.

4. Click Select, then select the PktLadderSketch.CATPart sample in the file selection box. Click Apply. The H input is now highlighted. The H field displays a three value list. 5. Select one of the values, 3500mm for example. Click Apply, then click OK. The document is generated.

The Pocket Calculator

141

knowledgeTemplate

The scenario developed below is intended to show how to combine part design and shape design features to generate a simple pocket calculator. It comprises the steps and instructions required for each step. To perform the scenario below, you need to have on hand the basic sketches from which you create your mechanical features. These basic sketches are available in the PktInitialSketch.CATPart sample. The shape design features are created from scratch. To perform the scenario below, we use the PktInitialSketch.CATPart sample (~46KB) along with the PktPocketCalculator.CATGScript script (~8KB). Check the size of the resulting document. It should be around 250KB. 1. Select the Knowledgeware->Product Knowledge Template command from the Start menu. 2. Click the icon. The Knowledgeware Script Editor is displayed.

3. Use the File->Open command to open the PktPocketCalculator.CATGScript document. 4. Position the cursor after the import keyword and right-click to select the Insert File Path command. Navigate to the PktInitialSketch.CATPart sample, then click Generate. The document generation starts. This is what you get onscreen, once the generation process is over.

Back to the script:

142

Advanced Tasks



The import statement below displays an input box whereby you can specify a sketch file. The pads created in the script all rely on these sketches.

import Input:FilePath "Select the PktInitialSketch.CATPart sample";



The script is divided into two sections:

a ) The part design features are enclosed by the BodyFeature b ) The shape design features are enclosed by the OpenBodyFeature. calc isa CATPart { part1 isa Part { partbody isa BodyFeature { // your mechanical features are described here } OBody isa OpenBodyFeature { // your shape design features are described here } } }

The fillet and pattern type features cannot be generated in one shot. You must first of all create the pad0 and pad1 objects, then add to your script the statements necessary to generate fillets and patterns. See the Fillet Object.

143

Reference
Reference

The packages listed below are those displayed in the Script Browser.

Using the Object Browser

The object browser guides you when writing a script. It allows you to access the keywords, operators and feature attributes that can be used when working with Product Knowledge Template. The packages displayed in the left part of the browser are those you selected from the Tools->Options... command. To add or remove packages: 1. Select the Tools->Options... command to open the Options window, then select General->Parameters and Measure, and click the Language tab. 2. In the Language field of the Knowledge tab, check Load extended language libraries and select the libraries.

To access the Product Knowledge Template Object Browser: 1. Access the Product Knowledge Template workbench by selecting the Knowledgeware-> Product Knowledge Template command from the Start menu. 2. Click the icon. The Knowledgeware Script Editor is displayed.

3. Select the Tools->Object Browser... command from the Script Editor toolbar. The following window opens:

145

knowledgeTemplate From this window, you can manipulate the list of objects supported by Generative Knowledge using their attributes. • The left part of the browser displays the packages available: BasicWireframePackag e, GSDPackage, GSDSharedPackage, KnowledgeExpert, MechanicalModeler, PartDesign, Standard. The central part displays the list of objects belonging to this category. The right part displays the attributes allowing you to manipulate these objects (if any).





The Back icon. To return to your last interaction in the wizard. Has no action on the script editor. The Forward icon. To go forward to your next interaction in the wizard when moving through a series of interactions. The Attribute Type icon. This icon is not available in the current version of the product. The Inheritance icon. To return to the root object. The Insert icon. To insert the object name in the script.

Basic Wireframe Package
GSMPoint

146

Reference

Definition:
A GSMPoint is a point: • • generated by the Generative Shape Design product available in the BasicWireFrame Package.

To find out more about points, see the Generative Shape Design User's Guide.

Attributes:
PointType A point is defined by its type. The attribute to use is PointType. The syntax to be used is: PointType = i, i corresponding to the type of point that you want to create. Please find below a table listing the existing types of points that you can create and the digit to indicate. PlaneType in GSD Coordinates On surface On curve On plane Circle center Plane Type in the Package GSMPointCoord GSMPointOnSurface GSMPointOnCurve GSMPointOnPlane GSMPointCenter 0 1 2 3 4 Corresponding digit

As mentionned above, you may create 5 different point sub-types. Please find below a description of each sub-type, as well as its attributes and the syntax to use.

Coordinates (GSMPointCoord)
The sub-type to be used in this case is GSMPointCoord which enables you to create a coordinate point. The following attributes are available for this sub-type:

147

knowledgeTemplate



• • •

RefPoint (Reference point, optional). If specified, x, y, and z are indicated in a mark whose origin is this reference point. X (First coordinate) Y (Second coordinate) Z (Third coordinate)

These attributes can be combined as follows: Combination • • • • RefPoint (Reference point, optional) X which is defined by the syntax below: X = 10mm; Y which is defined by the syntax below: Y = 10mm; Y which is defined by the syntax below: Z = 10mm;

148

Reference

On surface (GSMPointOnSurface)
The sub-type to be used in this case is GSMPointOnSurface which creates a point on a plane. The following attributes are available for this sub-type: • Direction: Element taking its orientation as reference direction or a plane taking its normal as reference direction RefPoint: Reference point. By default, the surface middle point is taken as reference. Support: Surface where the point is to be created. Values: Distance along the reference direction used to display a point.



• •

These attributes can be combined as follows: Combination • • • Direction which is defined by the syntax below: Direction = object: .. Line.1; Support which is defined by the syntax below: Support= object: .. Extrude.1; Values which is defined by the syntax below: Values = 12mm;

On curve (GSMPointOnCurve)
The sub-type to be used in this case is GSMPointOnCurve which enables you to create a point on a curve. The following attributes are available for this sub-type:

149

knowledgeTemplate

• • • •

Boundary: Not available. RefPoint: Reference point. If not specified, it is the extremity of the curve. Support: Curve Values: Distance between the reference point and this point. Combination

• • •

Refpoint which is defined by the syntax below: RefPoint= object: .. Point.1; Support which is defined by the syntax below: Support = object: .. Line.1; Values which is defined by the syntax below: Values = 12mm;

On plane (GSMPointOnPlane)
The sub-type to be used in this case is GSMPointOnPlane. It creates a point on a plane. The following attributes are available for this sub-type: • • • Direction (optional). When specified, indicates the direction H: Vector. RefPoint: point used to define a reference for computing coordinates in the plane. Support: Plane on which the point will be created. V: Vector.

• •

The attributes should be used as follows: Combination • Direction which is defined by the syntax below:

150

Reference

• • • •

Direction = object: .. Line.1; H which is defined by the syntax below: H = 150mm; RefPoint which is defined by the syntax below: RefPoint= object: .. Point.1; Support which is defined by the syntax below: Support = object: 'xy plane' V which is defined by the syntax below: V = 150mm;

Circle Center (GSMPointCenter)
The sub-type to be used in this case is GSMPointCenter which enables you to define the center of a circle. • Curve: circle, circular arc, or ellipse.

This attribute is to be used as follows: Combination • Curve which is defined by the syntax below: Curve = object: .. Extrude.1;

151

knowledgeTemplate

GSMLine

Definition:
A GSMLine is a line : • • generated by the Generative Shape Design product. available in the BasicWireFrame Package.

To find out more about lines, see the Generative Shape Design User's Guide.

Attributes:
LineType A line is defined by its type. The attribute to be used is LineType. The syntax to be used is: LineType = i, i corresponding to the type of line that you want to create. Please find below an equivalence table listing the existing types of lines that you can create and the digit to indicate. Line Type in GSD Point to Point Point-Direction Angle to Curve Tangent to Curve Normal to surface Intersection betw. 2 planes Line Type in the Package GSMLinePtPt GSMLinePtDir GSMLineAngle GSMLineTangency GSMLineNormal GSMLineBiTangent 0 1 2 3 4 5 Corresponding digit

As mentioned above, you may create 7 different line sub-types. Please find below a description of each sub-type, as well as its attributes and the syntax to use.

152

Reference

Point to Point Line (GSMLinePtpt)
The sub-type to be used in this case is GSMLinePtpt which defines the line extremities. The following attributes are available for this sub-type: • • • • • FirstPoint (feature) SecondPoint (feature) Support (feature) Length1 (length, optional for both combinations) Length2 (length, optional for both combinations)

These attributes can be combined as follows: 1st combination • the FirstPoint which is defined by the syntax below: FirstPoint = object: .. .. theFirstPoint; the SecondPoint which is defined by the syntax below: SecondPoint = object: .. .. theSecondPoint; Length1 which is defined by the syntax below: Length1=200mm; Length2 which is defined by the syntax below: Length2=150mm; • 2nd combination the FirstPoint which is defined by the syntax below: FirstPoint = object: .. .. theFirstPoint; the SecondPoint which is defined by the syntax below: SecondPoint = object: .. .. theSecondPoint; the Support





• •



153

knowledgeTemplate

Point-Direction (GSMLinePtDir)
The sub-type to be used in this case is GSMLinePtDir which defines the line direction. The following attributes are available for this sub-type: • • • • • • Length1 Length2 Direction Orientation RefPoint Support

These attributes can be combined as follows: Combination • • • • • Length1 which is defined by the syntax below: Length1 = 100mm; Length2 which is defined by the syntax below: Length2 = 10mm; Direction which is defined by the syntax below: Direction = object: .. .. Plane.2; RefPoint which is defined by the syntax below: RefPoint = object: .. .. Point.2; Support which is defined by the syntax below: SecondPoint = object: .. .. 'xy plane';

Tangent to Curve (GSMLineTangency)
The sub-type to be used in this case is GSMLineTangency. The following attributes are available for this sub-type:

154

Reference

• • • • • •

Curve: Reference curve used to define the tangency. Length1 Length2 Orientation RefPoint: Reference point used to define the tangency. Support

These attributes can be combined as follows: Combination • • • • • Curve which is defined by the syntax below: Curve = object: .. .. Spline.2; Length1 which is defined by the syntax below: Length1 = 100mm; Length2 which is defined by the syntax below: Length2 = 10mm; RefPoint which is defined by the syntax below: RefPoint = object: .. .. Point.2; Support which is defined by the syntax below: SecondPoint = object: .. .. 'xy plane';

Normal to surface (GSMLineNormal)
The sub-type to be used in this case is GSMLineNormal. The following attributes are available for this sub-type: • • • Orientation RefPoint RefSkin

These attributes can be combined as follows: Combination • • RefPoint which is defined by the syntax below: RefPoint = object: .. .. Point.2; Support which is defined by the syntax below:

155

knowledgeTemplate

RefSkin = object: ..

..

Extrude.1;

GSMPlane

Definition:
A GSMPlane is a plane: • • generated by the Generative Shape Design product. available in the BasicWireFrame Package.

To find out more about planes, see the Generative Shape Design User's Guide.

Attributes:
PlaneType A plane is defined by its type. The attribute to use is PlaneType. The syntax to be used is: PlaneType = i, i corresponding to the type of plane that you want to create. Please find below a table listing the existing types of planes that you can create and the digit to indicate. PlaneType in GSD Equation Through 3 points Through 2 lines Through a point and a line Normal to a curve Tangent to a surface Normal to a plane Plane Type in the Package GSMPlaneEquation GSMPlane3Points GSMPlane2Lines GSMPlane1line1Pt GSMPlane1Curve GSMPlaneTangent GSMPlaneNormal 0 1 2 3 4 5 6 Corresponding digit

156

Reference

As mentionned above, you may create 7 different plane sub-types. Please find below a description of each sub-type, as well as its attributes and the syntax to use.

Equation (GSMPlaneEquation)
The sub-type to be used in this case is GSMPlaneEquation which enables you to create a plane by using an equation. The following attributes are available for this sub-type: • • • • • A (First component of the equation) B (Second component of the equation) C (Third component of the equation) Length RefPoint (point used to position the plane through this point)

These attributes can be combined as follows: 1st Combination • • • • A which is defined by the syntax below: A=31; //A value is required B which is defined by the syntax below: B=-47; //A value is required C which is defined by the syntax below: C=-24; //A value is required Length: enables the user to indicate the required length. It is defined by the syntax below: Length=24mm • • • • 2nd Combination A which is defined by the syntax below: A=31; //A value is required B which is defined by the syntax below: B=-47; //A value is required C which is defined by the syntax below: C=-24; //A value is required RefPoint which is defined by the syntax below: RefPOint = object: .. Point ;

Through 3 points (GSMPlane3Points)

157

knowledgeTemplate

The sub-type to be used in this case is GSMPlane3Points which creates a plane passing through 3 points. The following attributes are available for this sub-type: • • • Element1 (First point) Element2 (Second point) Element3 (Third point)

These attributes can be combined as follows: Combination • • • Element1 which is defined by the syntax below: Element1 = object: .. Point.1; Element2 which is defined by the syntax below: Element2 = object: .. Point.2; Element3 which is defined by the syntax below: Element3 = object: .. Point.3;

Through 2 Lines (GSMPlane2Lines)
The sub-type to be used in this case is GSMPlane2Lines which enables you to create a plane passing through 2 lines. The following attributes are available for this sub-type: • • Element1 (First line) Element2 (Second line)

Combination • Element1 which is defined by the syntax below:

158

Reference



Element1 = object: .. Line.1; Element2 which is defined by the syntax below: Element2 = object: .. Line.2;

Through a Point and a Line (GSMPlane1line1Pt)
The sub-type to be used in this case is GSMPlane1Line1Pt which enables you to create a plane passing through a line and a point. The following attributes are available for this sub-type: • • Line: Line used to create the plane. RefPoint: Point used to create the plane.

The attributes should be used as follows: Combination • • Line which is defined by the syntax below: Line = object: .. Line.1; RefPoint which is defined by the syntax below: RefPoint = object: .. Point.2;

Normal to a Curve (GSMPlane1Curve)
The sub-type to be used in this case is GSMPlane1Curve which enables you to create a plane 159

knowledgeTemplate

normal to a curve at a specified point. • Element1: Line

This attribute is to be used as follows: Combination • Line which is defined by the syntax below: Line = object: .. Spline.1;

Tangent to a Surface (GSMPlaneTangent)
The sub-type to be used in this case is GSMPlaneTangent which enables you to create a plane tangent to a surface at a specified point. The following attributes are available for this sub-type: • • RefPoint (Point) Support (Surface)

These attributes are to be used as follows: Combination • Support which is defined by the syntax below: Support = object: .. • Spline.1;

RefPoint which is defined by the syntax below: RefPoint = object: .. Point.4;

160

Reference

Normal to a Plane (GSMPlaneNormal)
The sub-type to be used in this case is GSMPlaneNormal. The following attributes are available for this sub-type: • • Curve: Reference curve used to create the plane. RefPoint: Reference point used to create the plane.

These attributes are to be used as follows: Combination • Curve which is defined by the syntax below: Curve = object: .. • Spline.1;

RefPoint which is defined by the syntax below: RefPoint = object: .. Point.4;

GSMCircle

Definition:
A GSMCircle is a circle: • • generated by the Generative Shape Design product. available in the

161

knowledgeTemplate

BasicWireFrame Package. To find out more about circles, see the Generative Shape Design User's Guide.

Attributes:
PointType A point is defined by the following attributes: • • • • CircleType: The syntax to be used is CircleType = i, i corresponding to the type of circle that you want to create. CircleRelimitation: The syntax to be used is CircleRelimitation =. EndAngle: The syntax to be used is EndAngle = xxxdeg. StartAngle: The syntax to be used is StartAngle =xxxdeg.

Please find below a table listing the existing types of circles that you can create and the digit to indicate. PlaneType in GSD Three Points Center and Radius Center and Point Plane Type in the Package GSMPCircle3Points GSMCircleCtrRad GSMCircleCtrPt 3 0 1 Corresponding digit

As mentionned above, you may create 3 different circle sub-types. Please find below a description of each sub-type, as well as its attributes and the syntax to use.

Three Points (GSMCircle3Points)
The sub-type to be used in this case is GSMCircle3Points which enables you to create a circle passing through 3 points. The following attributes are available for this sub-type:

162

Reference

• • • •

Element1: First point Element2: Second point Element3: Third point Support: Support surface onto which the circle will be projected (optional)

These attributes can be combined as follows: Combination • • • • Element1 which is defined by the syntax below: Element1 = object: .. Point.1; Element2 which is defined by the syntax below: Element2 = object: .. Point.2; Element3 which is defined by the syntax below: Element3 = object: .. Point.3; Support which is defined by the syntax below: Support = object: .. Extrude.1;

Center and Radius (GSMCircleCtrRad)
The sub-type to be used in this case is GSMCircleCtrRad which enables you to create a circle by indicating its center and its radius. The following attributes are available for this sub-type: • • • • • Center: Point that will be the center of the circle. FirstDirection Geodesic Radius: Radius of the circle. Support: Support plane or surface onto which the circle is to be created.

These attributes can be combined as follows: Combination • • Center which is defined by the syntax below: Center = object: .. Point.1; Radius which is defined by the syntax below:

163

knowledgeTemplate



Radius = 120mm; Support which is defined by the syntax below: Support = object: .. Extrude.1;

Center and point (GSMCircleCtrPt)
The sub-type to be used in this case is GSMCircleCtrPt which enables you to create a circle by indicating its center and a point. The following attributes are available for this sub-type: • • • • Center: Point used as the center of the circle. Geodesic: Curve. RefPoint: Second point used to create the circle. Support: Support plane or surface where the circle is to be created. Combination • • • Center which is defined by the syntax below: Center = object: .. Point.1; RefPoint which is defined by the syntax below: RefPoint = object: .. Point.1; Support which is defined by the syntax below: Support = object: .. Extrude.1;

Part Design Package

Please find below a table listing the types available in the Part Design package. Box Counterbored Hole Cylinder Pocket Shaft SoldCombine Chamfer Counterdrilled Hole Hole RemoveFace Shell Split Cone Countersunk Hole Pad ReplaceFace SimpleHole TaperedHole

164

Reference

Thickness

ThickSurface

Torus

Box
Definition:

A box is a pad extruded from a rectangular sketch.
Attributes:

A box is defined by the following attributes: • • • Length which is the pad first limit. The syntax to be used is Length = 10mm. Width which is the pad width. The syntax to be used is Width = 20mm. Height which is the pad height. The syntax to be used is Height = 12mm.

MyBox isa CATPart { BoxPart isa Part { PartBody isa BodyFeature { // Create a box Box1 isa Box { // Specify the box properties Width = 20.0 mm ; Height = 25.0 mm ; Length = 15.0 mm ; } } } }

Chamfer

165

knowledgeTemplate

Definition:

A cut through the thickness of the feature at an angle, giving a sloping edge.

Attributes:

A chamfer is defined by the following attributes: • • • Angle. The syntax to be used is Angle = 20 deg; Length1. The syntax to be used is Length1 = 5 mm; Length2. The syntax to be used is Length2 = 5 mm;

Important Notes: • A chamfer has a Length2 attribute which is the default chamfer length. You don't have to manipulate this attribute in a script.

To specify a chamfer within your script, you must have a part open, then: 1. Create a Chamfer by using the isa function Chamfer1 isa Chamfer ( ) { } 2. Right-click anywhere inside the parentheses and select the 'Get Edge' or the 'Get Surface' command from the contextual menu. Then, in the geometry area, select the edge or surface to be chamfered. MyBox isa CATPart { BoxPart isa Part { PartBody isa BodyFeature { // Create a box Box1 isa Box { Width = 20.0 mm ; Height = 25.0 mm ; Length = 15.0 mm ; } // Create a chamfer // The edge definition must be captured // from the geometry area // Use the Get Edge command from the // contextual menu

166

Reference

Chamfer1 isa Chamfer (Edge Definition) { Angle = 20 deg; Length1 = 5 mm ; } Chamfer2 isa Chamfer (Edge Definition) { Angle = 30 deg; Length1 = 10 mm ; } } } }

Cone
Definition:

A cone is a shaft created by rotating a triangular sketch.
Attributes:

A cone is defined by the following attributes: • • Length. The syntax to be used is Length = 15.0 mm ;. Radius. The syntax to be used is Radius = 20.0 mm ;.

MyCone isa CATPart { ConePart isa Part { PartBody isa BodyFeature { // Create a cone Cone1 isa Cone { Radius = 20.0 mm ; Length = 15.0 mm ; } } } }

Counterbored Hole

167

knowledgeTemplate

Definition:

A mechanical feature of Hole type you create when you click icon in the Part Design the workbench. For more information, refer to the Part Design User's Guide.

Attributes:

A counterbored hole is defined by the following attributes: • • CounterboreDepth. The syntax to be used is CounterboreDepth =12mm. CounterboreDiameter: The syntax to be used is CounterboreDiameter =15mm.

Counterdrilled Hole
Definition:

A mechanical feature of Hole type you create when you click icon in the Part Design the workbench. For more information, refer to the Part Design User's Guide.

Attributes:

A counterdrilled hole is defined by the following attributes: • CounterdrillAngle. The syntax to be used is CounterdrillAngle =

168

Reference

• •

22deg. CounterdrillDiameter. The syntax to be used is CounterdrillDiameter =12mm. CounterdrillDepth. The syntax to be used is CounterdrillDepth =12mm.

Countersunk Hole
Definition:

A mechanical feature of Hole type you create when you click icon in the Part Design the workbench. For more information, refer to the Part Design User's Guide.

Attributes:

A countersunk hole is defined by the following attributes: • • • CountersinkAngle. The syntax to be used is CountersinkAngle = 12deg. CountersinkDepth. The syntax to be used is CountersinkDepth =15mm. CountersinkDiameter. The syntax to be used is CountersinkDiameter =15mm.

Cylinder
Definition:

A cylinder is a pad created by extruding a circular sketch.
Attributes:

169

knowledgeTemplate

A cynlinder is defined by the following attributes: • • EndLimit Length. The syntax to be used is Length =12mm. Radius: The syntax to be used is Radius =5mm.

Cylinder1 isa CATPart { Part isa Part { PartBody isa BodyFeature { // Create a cylinder Cyl1 isa Cylinder { Radius=15.0 mm; EndLimit=20.0 mm; } } } }

Hole
Definition:

A is an opening through a feature.

Attributes:

A hole is defined by the following attributes: • • • • • • • • • BottomAngle BottomType Depth Diameter DiameterThread HoleType LimitType Pitch TapSide

170

Reference

• • •

Threaded ThreadingDepth Radius

To specify a hole within your script, you have to use one of the holes listed below. Hole is the father type and cannot be used. • • • • Counterbored Hole Countersunk Hole Counterdrilled Hole Tapered Hole

Pad
Definition:

A pad is a feature created by extruding a sketch.

Attributes:

A pad is defined by the following attributes: • • • the sketch the pad is extruded from. the FirstLimit the SecondLimit Length (or StartLimit Length ( or EndLimit Length) Length).

A limit which is not specified is set by default to zero. // Use the Insert File Path command from the // contextual menu to specify the path of the file // to be imported import PktSketchToImport.CATPart;/*In the script above, the P0 pad is created from the Sketch.1 sketch which is imported from the document.*/

171

knowledgeTemplate myDocument isa CATPart { myPart isa Part { PartBody isa BodyFeature { Sketch isa Sketch.1 {} P0 isa Pad("Sketch") { SecondLimit } } } } Length=40.0mm;

Shaft
A shaft is a feature created by rotating a sketch around and axis.

Attributes:

A shaft has two attributes: • • • • • • • The The The The The The The StartAngle. The syntax to be used is StartAngle=12deg. EndAngle. The syntax to be used is EndAngle=23deg. MergeEnd NeutralFiber Thickness1 Thickness2 Thinmode

The sketch to be rotated must be imported from an external CATPart document. This external document must also include a rotation axis.

172

Reference /* Use the Insert File Path command from the contextual menu to select the the sketch to be imported */ import //Use the Insert File Path command to insert the Pktsketch_shaft.CATPart file. MyShaft isa CATPart { myPart isa Part { PartBody isa BodyFeature { Sketch isa Sketch.1 {} S0 isa Shaft("Sketch") { StartAngle = 20 deg ; EndAngle = 300 deg ; } } } }

Shell
Definition:

A shell is a hollowed out feature.

Attributes:

A shell is defined by the following attributes: • • DefaultInsideThickness. The syntax to be used is DefaultInsideThickness = 2mm. DefaultOutsideThickness: The syntax to be used is DefaultOutsideThickness = 1mm.

To specify a shell within your script, you must have a part open, then: 1. create a Shell by using the isa function Shell1 isa Shell ( ) { } 2. right-click anywhere inside the parentheses and select the 'Get Surface' function from the contextual menu. Then, in the geometry area, select the

173

knowledgeTemplate

face to be hollowed out. A 1mm thick shell is created by default. MyBox isa CATPart { BoxPart isa Part { PartBody isa BodyFeature { Box1 isa Box { Width = 20.0 mm; Height = 25.0 mm; Length = 15.0 mm; } Shell1 isa Shell (face definition) { DefaultInsideThickness = 2mm; DefaultOutsideThickness = 1mm; } } } }

SimpleHole
Definition:

A mechanical feature of Hole type you create when you click the icon in the Part Design workbench. For more information, refer to the Part Design User's Guide..
Attributes:

Hole1 isa CATPart { Part isa Part { PartBody isa BodyFeature { P isa Pad { } F isa SimpleHole("Use the Get Edge command to select the edge") { }

174

Reference

} } }

Sphere
Definition:

A sphere is a shaft created by rotating half a circle around an axis passing through the arc extremities. The only property is the Radius.
Attributes:

A sphere is defined by the following attribute: • Radius. The syntax to be used is: Radius = 20.0 mm.

MySphere isa CATPart { SpherePart isa Part { PartBody isa BodyFeature { Sphere1 isa Sphere { Radius = 20.0 mm ; } } } }

Tapered Hole
Definition:

A mechanical feature of Hole type you create when you click icon in the Part Design the workbench. For more information, refer to the Part Design User's Guide.

Attributes

175

knowledgeTemplate

A tapered hole is defined by the following attribute: • TaperAngle:

Thickness
Definition:

A thick

Attributes

A thickness is defined by the following attribute: • DefaultThickness:

ThickSurface
Definition:

A thicksurface is a surface to which material was added in two opposite directions.

Attributes:

A thicksurface is defined by the following attributes: • • TopOffset, the thickness in one direction. The syntax to be used is TopOffset = 0.5mm. the BotOffset, the thickness in the one direction. The syntax to be used is BotOffset = 10 mm.

176

Reference

myThickSurface isa CATPart { myPart isa Part { OpenBody1 isa OpenBodyFeature { P1 isa GSMPoint { PointType = 0; TypeObject isa GSMPointCoord { X = 0mm; Y = 0mm; Z = 0mm; } } C isa GSMCircle { CircleType = 0; TypeObject isa GSMCircleCtrRad { Center = object : .. object : .. .. .. .. P1; Support = `xy-plane`; Radius = } StartAngle = EndAngle = } Fi isa GSMFill { Boundary = object : .. } } PartBody isa BodyFeature { Thick1 isa ThickSurface { TopOffset = 0.5mm; C;

150mm; 0deg; 360deg;

177

knowledgeTemplate

BotOffset = 10 mm; Surface = object : .. } } } .. } OpenBody1 Fi;

Torus
Definition:

A torus is a shaft created by rotating a circular sketch around an axis.
Attributes:

A torus is defined by the following attributes: • • InnerRadius SectionRadius

BodyDoc isa CATPart { BodyPart isa Part { Body isa BodyFeature { // Create a sphere Sphere1 isa Sphere { Radius = 15.0 mm; } // Create a torus Torus1 isa Torus { InnerRadius = 20.0 mm ; SectionRadius = 10.0 mm ; } } } }

Part Shared Package
Fillet Object
Definition

178

Reference

Describes the feature you create when you click the icon in the Part Design workbench. For more information, please refer to the Part Design User's Guide. It is defined by one property: • Radius

There are 3 different types of fillets: • ConstantEdgeFillet • • FaceFillet TriTangentFillet

Constant Edge Fillet Object
Definition
A fillet is a curved surface of a constant or variable radius that is tangent to, and that joins two surfaces. Together, these three surfaces form either an inside corner or an outside corner. Important Note: To specify a fillet within your script, you must have a part open, then: 1. Create a Fillet by using the isa keyword. Fillet1 isa ConstantEdgeFillet ( ) { } 2. Right-click anywhere inside the parentheses and select the 'Get Edge' or the 'Get Surface' function from the contextual menu. Then, in the geometry area, select the edge or the face to be filleted.

Example
Box1 isa CATPart { BoxPart isa Part { PartBody isa BodyFeature { Box1 isa Box { Width = 20.0 mm ; Height = 25.0 mm ; Length = 15.0 mm ; } // Use the Get Edge or Get Surface command // from the contextual menu to retrieve // the edge or face to be filleted

179

knowledgeTemplate Fillet1 isa ConstantEdgeFillet ( face to be filleted) { Radius =1.0 mm; } } } }

Pattern
Definition
A pattern is a set of similar features repeated in the same part. Two types of patterns can be created with CATIA: the rectangular patterns and the circular patterns. At present, only rectangular patterns can be generated from a script. A rectangular pattern is defined by the following properties: • Nb1, the number of elements to be replicated along the first direction • • • • Nb2, the number of elements to be replicated along the second direction Step1, the element spacing along the first direction Step2, the element spacing along the second direction Activity.

Syntax

pattern1 isa pattern [Nb1,Nb2] of feature_to_be_repeated

Example

MyBox isa CATPart { BoxPart isa Part {

180

Reference

PartBody isa BodyFeature { Box1 isa Box { Width = 20 mm ; Height = 20 mm ; Length = 20 mm ; }

// Use the Get Surface command from the // contextual menu to specify the hole // anchor Hole1 isa SimpleHole ("Face:(Brp:(Pad.1;2);None:();Cf9:())") { Diameter = 15 mm; } Pattern1 isa Pattern[3,4] of Hole1 { Step1 = 50 mm; Step2 = 50 mm; } } } }

181

knowledgeTemplate

Standard Package
Old Types Names Old Attributes New Types Names Feature New Attributes Id Name Owner Color Layer Pick Show

-

-

List Visualizable

GSD Shared Package
Types Names GSMAffinity Attributes AxisFirstDirection AxisOrigin AxisPlane Ratio

GSMAxisToAxis GSMRotate GSMScaling GSMSymetry GSMTransformation GSMTranslate Angle Axis Ratio Reference Reference Activity ToTransfor Direction Distance

GSD Package
Please find below a table listing the types contained in the GSD package: GSM3DCurveOffset GSMBlend GSMConic GSMCurve GSMCylinder GSMExtractContour GSMExtremumPolar GSMAssemble GSMBoundary GSMConnect GSMCurvePar GSMDirection GSMExtrapol GSMExtrude GSMAxisToAxis GSMCombine GSMCorner GSMCurveSmooth GSMExtract GSMExtremum GSMFill

182

Reference

GSMFillet GSMHelix GSMLawDistProj GSMNear GSMReflectLine GSMSpine GSMSweep GSMSweepSegment GSMUnfold GSOJunction GSOVariableOffset

GSMFilletBiTangent GSMIntersect GSMLineCorner GSMOffset GSMRevol GSMSpiral GSMSweepCircle GSMSweepSketch GSMWSupport GSOSeatDiabolo GSOWrapCurve

GSMHealing GSMInverse GSMLoft GSMProject GSMSphere GSMSplit GSMSweepConic GSMTrim GSOBump GSPShapeMorphing GSOWrapSurface

GSMAssemble
Definition:

A GSMAssemble is an object which joins at least two surfaces or two curves. The surfaces or curves to be joined must be adjacent. See the Generative Shape Design User's Guide for more information.
Attributes:

Click here to open the GSMAssembleScript script file.

GSMCurve

183

knowledgeTemplate

Definition:

A GSMCurve is an object generated by the Generative Shape Design product. You can create a corner by ) clicking the Corner icon ( in the Generative Shape Design workbench. Click here to open the GSMCurveScript script file.

GSMCurvePar
Definition:

An GSMCurvePar object is a Generative Shape Design parallel curve.

Attributes: A GSMCurvePar is defined by the following attributes: • • • • • • • • • • InvertLaw. Length1. Length2. Mode. Offset. Orientation. PassingPoint. Support. TMDeviation. Type.

184

Reference

Click here to open the GSMCurveParScript script file.

GSMExtrude
Definition:

A surface created by extruding a profile along a given direction. You can create an extruded surface by clicking the Extrude ) in the Generative icon ( Shape Design workbench. Attributes: A GSMExtrude is defined by the following attributes: • • • • • Direction. Element1. Length1. Length2. Orientation.

Click here to open the GSMSplit script file.

185

knowledgeTemplate

GSMFillet
Definition:

An GSMFillet object is curved surface of a constant or variable radius that is tangent to and joins two surfaces. Together these three surfaces form either an inner or outer corner. Attributes: A GSMFillet is defined by the following attributes: • • • Element1. Element2. Radius.

Click here to open the GSMFilletScript.CATGScript file.

GSMProject
186

Reference

Definition:

A Generative Shape Design projection. See the Generative Shape Design User's Guide for more information.

Attributes: A GSMProject is defined by the following attributes: • • • • • • Direction. Normal which corresponds to the Projection type field in the Projection Definition dialog box ( Normal = 1 for an orthogonal projection - otherwise specify a direction, a GSMLine for example). SolutionType. TMDeviation. ToProject which corresponds to the Projected field in the Projection Definition dialog box. Support which corresponds to the Support field in the Projection Definition dialog box.

Click here to open the GSMSplit script file.

GSMSplit
Definition:

A surface or wireframe element that was split by means of a cutting element. You can split: • a wireframe element by a point, another wireframe element or a surface a surface by a 187



knowledgeTemplate

wireframe element or another surface. You can split geometry by ) in clicking the Split icon ( the Generative Shape Design workbench. Click here to open the GSMSplit script file.

GSMSweepSegment
Definition:

Attributes: A GSMSweepSegment is defined by the following attributes: • • • • • • • Angle. GuideCrv. GuideSurf. Length. Length1. Length2. Spine.

Click here to open the GMSweepSegmentScript file.

Knowledge Expert Package
188

Reference Please find below a table listing the types contained in the Knowledge Expert package: KWECheck KWEGenericRuleBaseComponent KWERule KWERuleBaseComponent

KWERuleBase KWERuleSet

KWECheck
Definition:

Expert Checks are features generated by the Knowledge Expert product. Checks are regrouped into rule sets. Rule sets belong to a rule base. When writing a script with checks you must comply with the Rule Base/Rule Set hierarchy. Refer to the Knowledge Expert User's Guide for more information on the concepts behind the expert rules and checks. Click here to open the KnowledgeExpertScript file.

KWERule
Definition:

Expert Rules are features generated by the Knowledge Expert product. Rules are regrouped into rule sets. Rule sets belong to a rule base. When writing a script with rules you must comply with the Rule Base/Rule Set hierarchy. Refer to the Knowledge Expert User's Guide for more information on the concepts behind the expert rules and checks.

189

knowledgeTemplate

Click here to open the KnowledgeExpertScript file.

KWERuleBase
Definition:

Rule bases are features generated by the Knowledge Expert product. Refer to the Knowledge Expert User's Guide for more information on the concepts behind this type of feature. Click here to open the KnowledgeExpertScript file.

KWERuleSet
Definition:

Rule sets are features generated by the Knowledge Expert product. Refer to the Knowledge Expert User's Guide for more information on the concepts behind this type of feature. Click here to open the KnowledgeExpertScript file.

190

Reference

Mechanical Modeler Package
Some types and attributes were changed. Please find below a conversion table listing the old types, their attributes, their new names (if any) as well as their attributes: BodyFeature MechanicalFeature OpenBodyFeature GeometryFeature OpenBodyFeature

BodyFeature
Definition:

A body is the combination of several features within a part. For more information, see the Part Design User's Guide.

BodyDoc isa CATPart { BodyPart isa Part { Body isa BodyFeature { // Create a sphere Sphere1 isa Sphere { Radius = 15.0 mm; } // Create a torus Torus1 isa Torus { InnerRadius = 20.0 mm ; SectionRadius = 10.0 mm ; } } } }

191

Workbench Description
Workbench Description
This section contains the description of the icons and menus specific to the Product Knowledge Template workbench. The Product Knowledge Template workbench is shown below. Click the sensitive areas (toolbars) to access the related documentation.

Product Knowledge Template Menu Bar Generative Knowledge Toolbar Templates Creation Toolbar Templates Instantiation Toolbar

Product Knowledge Template Menu Bar
The menu specific to Product Knowledge Template is described below.

193

knowledgeTemplate

Start

File

Edit View Insert Tools Window Help

Insert
For
Document Template Creation...

See
Creating a Document Template

Toolbars
Templates Creation Toolbar
The Templates Creation toolbar contains the following tools

See Create a Power Copy. See Create a User Feature. See Create a Document Template.

Generative Knowledge Toolbar
The Generative Knowledge toolbar contains the following tools: See Creating a Script.

Templates Instantiation Toolbar
The Templates Creation toolbar contains the following tools

194

Workbench Description

See Instantiating Power Copies, Instantiating User Features. See Instantiating Power Copies, Instantiating User Features. See Instantiating Power Copies, Instantiating User Features, and Instantiating a Part Template.

195

Project Standards
Customizing for Knowledge Template
Customizing
Before you start your first working session, you can customize the way you work to suit your habits. This type of customization is stored in permanent setting files: these settings will not be lost if you end your session 1. Select the Tools -> Options command. The Options dialog box is displayed. 2. Choose the General category in the left-hand box. 3. Click the Parameters and measure tab. The following tabs display.

This tab lets you define: o o o the Knowledge settings the libraries you want to load the report settings

4. Two other tabs, located in the Infrastructure category, in the Part Infrastructure workbench, also interfere with Knowledgeware applications.

o o

General Display

5. Change these options according to your needs. 6. Click OK when done to validate your settings.

Knowledge
This page deals with these categories of options: • Parameter Tree View

197

knowledgeTemplate • • • Parameter names Relations update in part context Design Tables

Parameter Tree View

There are 2 types of items that you can display in the specification tree.

With value
Displays the parameter values in the specification tree. By default, this option is unchecked.

With formula
Displays the formulas constraining the parameter in the specification tree. By default, this option is unchecked.

Parameter names

This option should be checked if you work with non-Latin characters. If this option is unchecked, parameter names should have to be renamed in Latin characters when used in formulas. By default, this option is unchecked.

Relations update in part context

Before V5R12, Knowledge relations (formulas, rules, checks, design tables, and sets of equations) used to execute as soon as one of their inputs was modified. The user can now choose, when creating the relation, if it will be synchronous (i.e. the evaluation will be launched as soon as one of its parameters is modified) or

198

Project Standards asynchronous (i.e. the evaluation will be launched when the Part is updated). Each relation can therefore be synchronous or asynchronous. The 2 following options enable the user to create synchronous or asynchronous relations.

Creation of synchronous relations
Enables the user to create synchronous relations, that is to say relations that will be immediately updated if one of their parameters/inputs is modified. Relations based on parameters are the only one that can be synchronous. By default, this option is unchecked

Creation of relations evaluated during the global update
Enables the user to associate the evaluation of asynchronous relations with the global update. The relations can be asynchronous for 2 reasons: • • • • • The user wants the relations to be asynchronous The relation contains measures. Relations based on parameters: These relations can be synchronous or asynchronous. Relations based on geometry: These relations can only be asynchronous. Relations based on parameters and on geometry: For the part of the relations containing parameters, the user decides if he wants the update to be synchronous or not. For the other part of the relations, the update occurs when the global update is launched. Note that the user can also decide if already existing relations are synchronous or asynchronous. To know more, see Controlling Relations Update in the Infrastructure User's Guide. •

By default, this option is checked.

Design Tables

199

knowledgeTemplate

There are 2 types of items that you can set up.

Automatic Synchronization at Load
When loading a model containing user design tables, if the design table files have been modified and the external file data is contained in the model, the design table will be synchronized automatically if this radio button is checked. By default, this option is checked.

Interactive Synchronization at Load
When loading a model containing user design tables whose external source file was deleted, this option enables the user to select a new source file or to save the data contained in the design tables in a new file. By default, this option is unchecked.

Manual Synchronization
When loading a model containing user design tables, if the design table files have been modified and the external file data is contained in the model, the design table will be synchronized if this radio button is checked. To synchronize both files, rightclick the design table in the specification tree and select the DesignTable object>Synchronize command or the Edit->Links command. By default, this option is unchecked.

Default Mode: Copy Data Into Model
If checked, the data contained in the external source file will be copied into the model. By default, this option is unchecked.

Default Mode: Do Not Copy Data Into Model
If checked, the data contained in the external source file will not be copied into the

200

Project Standards

model. By default, this option is checked.

Language
This page deals with the following categories of options: • • Language Reference Directory for Types

Language

This field is to be used when using measures in relations or user functions. Measures are specific functions to be used in formulas and rules. The Knowledge Advisor User's Guide provides you with tasks explaining how to use measures. For how to create and use user functions, see the CATIA Application Architecture documentation.

Load extended language libraries
If checked, enables the user to select the packages he wants to load under Packages (if he wants to load a limited number of packages.)

This option is particularly useful for the administrator to limit the number of packages used by the user. It is also very useful to improve performances since only the required libraries are loaded.

201

knowledgeTemplate



When you open a document and some relations are broken, you might need to load all libraries to solve the error, which may take quite a long time. It is strongly recommended to identify the packages you will need and to select them.



By default, this option is unchecked.

All packages
Enables the user to select all packages.

Reference Directory For Types

Reference Directory For Types
Enables the user to save the CATGScript file in the Directory indicated in the Reference Directory for Types field for later re-user (To know more, see the PKT User's Guide). By default, this option is not available.

Report Generation
This page explains how to customize the reports generated by the Global Check Analysis tool in the Knowledge Advisor and Knowledge Expert workbenches. It deals with the following categories of options: • • • • • Configuration of the Check Report Input XSL Report content Output directory HTML Options

Configuration of the Check Report

Html
Enables the user to generate a HTML report.

202

Project Standards

Xml
Enables the user to generate a XML report. By default, the HTML option is enabled.

Input XSL
Note that this option is available only if the XML configuration setting is set.

Input XSL
Enables the user to select the XSL style sheet that will be applied to the generated XML report. The StyleSheet.xsl file is the default XSL file, but you can use your own template.

Report content

Failed Checks
If checked, the generated report will contain information about the failed checks only. By default, this option is unchecked.

All Checks
If checked, the generated report will contain information about all the checks contained in the document. By default, this option is checked.

203

knowledgeTemplate

Check Advisor
If checked, the generated report will contain information about all the Knowledge Advisor checks contained in the document. By default, this option is checked.

Parameters information
Not available

Check Expert
If checked, the generated report will contain information about all the Knowledge Expert checks contained in the document. By default, this option is checked.

Passed objects
If checked, the generated report will contain information about the objects that passed the Expert checks as well as information about the parameters of these objects (diameter, depth, pitch,...). By default, this option is checked.

Objects information
Not available

Output directory

Output directory
Enables the user to select the output directory that will contain the generated report. By default, this option is available.

HTML Options

Open HTML browser into CATIA Session

204

Project Standards

This option is available for Windows only. It enables the user to define if the report will be opened in a CATIA session (in this case, the check box should be checked) or if it will be opened in an Internet Explorer session (in this case, the check box should remain unchecked.) Note that it is highly recommended not to use this report as a basis for macros or for other applications. It is only provided for information purposes. By default, this option is checked.

Part Infrastructure for Knowledgeware Applications

This page deals with the options concerning: • • the external references: Keep link with selected object the specification tree display

Part Infrastructure General option

Keep link with selected object
You need to select this option to take advantage of the associativity. Click here to know more about the Part Infrastructure General options.

Part Infrastructure Display option

205

knowledgeTemplate

Parameters
Select this option to display the parameters when working in a CATProduct context. By default, this option is unchecked.

Relations
Select this option to display the relations when working in a CATProduct context. By default, this option is unchecked. Click here to know more about the Part Infrastructure Display options.

206

 
statystyka