资源描述
Copyright DASSAULT SYSTEMES 2002,1,Knowledge Expert,CATIA Training Foils,Version 5 Release 9June 2002 EDU-CAT-E-KWE-FF-V5R9,Copyright DASSAULT SYSTEMES 2002,2,Course Presentation,Objectives of the course In this course you will learn the functionalities of CATIA V5R8 Knowledge Expert : creation and using of expert rules, expert checks, solving of rule bases, generation of check reports. For the creation of rules and check, you will learn how to use the Object Browser of Knowledge Expert. Targeted audience CATIA V5 users. Prerequisites CATIA V5 Basics.,0.5 day,Copyright DASSAULT SYSTEMES 2002,3,Table of Contents (1/2),Workbench presentation. p.5 Accessing the workbench.p.6 User interface.p.7 User settings.p.8 Terminology.p.11 Creating a rule base and a rule set. p.13 Creating a rule base.p.14 Activating / inactivating a rule base.p.15 Creating a rule set.p.16 Activating / inactivating a rule set.p.18 Deleting a rule set.p.19 Creating an expert rule.p.20 Creating an expert rule.p.21 Editing an expert rule.p.24 Activating / inactivating an expert rule.p.25 Deleting an expert rule.p.26 Creating an expert check.p.27 Creating an expert check.p.28 Editing an expert check.p.31 Activating / inactivating an expert check.p.32 Deleting an expert check.p.33,Copyright DASSAULT SYSTEMES 2002,4,Table of Contents (2/2),Creating Expert Rules or Expert Checks on UDFp.34 Creating the UDF instance type. p.35 Creating Expert Rules or Expert Checks on UDF p.36 6.Navigating the object browser. p.37 Accessing the object browser.p.38 Using the object browser to create or edit expert rules or expert checks.p.39 7.Accessing the Expert Check/Rule in the Check/Rule bodyp.41 Accessing the Expert Check/Rule in the Check/Rule bodyp.42 8.Solving a rule base p.43 Solving a rule basep.44 9.Generating a check reportp.45 Setting a Rule Base optionsp.46 Generating a Check report p.48 10. Performing a Global Analysis of Checks p.49 Customizing checks Reports p.50 Running the checks Analysis p.51 Correcting the checks that failedp.52 11.Working with rule bases and catalogs.p.53 Storing a rule base in a catalog.p.54 Retrieving a rule base from a catalog.p.55,Copyright DASSAULT SYSTEMES 2002,5,Workbench Presentation,In this lesson, you will learn about the Knowledge Expert Workbench by Accessing the workbench User interface User settings Terminology,Copyright DASSAULT SYSTEMES 2002,6,Accessing the Workbench,Anywhere from 1- Start menu or 2- A CATIA document or 3- Workbench Icon,1-,2-,If the node Relations and the node Rule Base under it exist in the specification tree, double-click on Rule Base node,3-,See Tools + Customize + Start menu for the content of this Welcome box,Copyright DASSAULT SYSTEMES 2002,7,User Interface : Knowledge Expert Toolbars and Icons,Rule Base node under Relations node,Rule Set node under Rule Base node Here : the Rule Set name is Hole_Checks,Expert Checks and/or Expert Rules nodes under Rule Set node,Expert Rule,Expert Check,Insert Rules,Report,Solve,Copyright DASSAULT SYSTEMES 2002,8,User Settings (1/3) : Knowledge General Settings,Select the corresponding option if you want the value of the parameter appear in the tree. the formula driving the parameter appear in the tree. to use measures in relations or user functions.,1,2,3,General / Parameters / Knowledge tab,Copyright DASSAULT SYSTEMES 2002,9,User Settings (2/3) : Knowledge in Part Settings,Select the corresponding option if you want the parameters of the part appear in the tree. the relations of the part appear in the tree.,Mechanical Design / Part Design / Display tab,1,2,Copyright DASSAULT SYSTEMES 2002,10,User Settings (3/3) : Knowledge in Product Settings,Select the corresponding option if you want the parameters of the product appear in the tree. the relations of the product appear in the tree.,Infrastructure/ Product Structure/ Product Structure tab,2,1,Copyright DASSAULT SYSTEMES 2002,11,Terminology (1/2),A Relation is a generic name for knowledge objects : formulas, rules, checks, expert rules and checks and design tables. Relations used in Knowledge Expert workbench are hierarchical. A Rule Base is the object at the top of the hierarchy. It assembles sets of Rule objects. An empty Rule Base object is created automatically when you access the Knowledge Expert workbench. A Rule Set is an object which assembles a set of Expert Checks and/or Expert Rule. A Rule Set which will contain a check/rule is created during the creation of this check/rule. An Expert Check verifies for any feature of a given type the satisfaction of a specified condition. Example : for any feature of type Hole, check if the diameter is equal to 10mm. The syntax is the following : H: Hole H.Diameter= 10mm. An Expert Check can be valid (green light) or invalid (red light). An Expert Rule verifies for any feature of a given type a specified condition and if the condition is satisfied, applies a set of actions on the feature . Example : for any feature of type Hole, check if the diameter is equal to 10mm. If it is, set the diameter to 20 mm. The syntax is the following : H: Hole if (H.Diameter= 10mm) H.Diameter= 20mm.,Copyright DASSAULT SYSTEMES 2002,12,Terminology (2/2),The Object Browser is a wizard that allows you to access the features, their attributes, operators and units that can be used in an expert rule or an expert check. The objects are displayed in the leftmost window of the Object Browser. Their attributes are displayed in the middle window of the Object Browser. The methods or properties available for the objects are displayed in rightmost window of the Object Browser. The signature (indicating the type of the arguments and the type of the result) of the methods is displayed in the bottom window.,Copyright DASSAULT SYSTEMES 2002,13,Creating a Rule Base and a Rule Set,In this lesson, you will see how to create and manage Rule Base and Rule Set. These are two objects which are at the top of the hierarchy of Knowledge Expert objects . Creating a Rule Base Activating a Rule Base Creating a Rule Set Activating a Rule Set Deleting a Rule Set,Copyright DASSAULT SYSTEMES 2002,14,If there is no rule base in your CATIA document, an empty rule base will be automatically created when you will access the Knowledge Expert workbench. You can access the workbench from 1- Start menu or 2- Workbench Icon,1-,2-,See Tools + Customize + Start menu for the content of this Welcome box,Creating a Rule Base,Copyright DASSAULT SYSTEMES 2002,15,Select the Rule Base node Access the contextual menu (click on right mouse button) Set Activate or Inactivate option for the Rule Base object,1,2,3,Activating / Inactivating a Rule Base,Copyright DASSAULT SYSTEMES 2002,16,The rule set creation is included in the expert rule/ check creation task. When you create an expert rule/ check, CATIA prompts you to select either a rule base or a rule set. Selecting a rule base creates a rule set and adds a rule/ check to this rule set. Selecting an already existing rule set creates a rule/ check in this rule set.,Creating a Rule Set (1/2),Copyright DASSAULT SYSTEMES 2002,17,You can create interactively Rule Sets by using the Rule Set function. It allows you to create hierarchy and manage to logically structure the corporate knowledge base.,Creating a Rule Set (2/2),Copyright DASSAULT SYSTEMES 2002,18,Select the Rule Set node (here its default name is CATKWERuleSet.1) Access the contextual menu (click on right mouse button) Set Activate or Inactivate option for the RuleSet object,1,2,3,Activating / Inactivating a Rule Set,Copyright DASSAULT SYSTEMES 2002,19,Select the Rule Set node (here its default name is CATKWERuleSet.1) Access the contextual menu (click on right mouse button) Select Delete,1,2,3,Deleting a Rule Set,Copyright DASSAULT SYSTEMES 2002,20,Creating an Expert Rule,In this lesson, you will see how to create and manage an Expert Rule. The Expert Rule is located under a Rule Set in the hierarchy of Knowledge Expert objects . Creating an Expert Rule Editing an Expert Rule Activating an Expert Rule Deleting an Expert Rule,Copyright DASSAULT SYSTEMES 2002,21,1,Select the Rule Base or the Rule Set node,Click on the Expert Rule icon,2,3,A Rule Editor dialog box is displayed. Modify the default rule name and comments if need. Select your language : KWE Language (default language) or Visual Basic Language. Then Click on OK button,Creating an Expert Rule (1/3),Copyright DASSAULT SYSTEMES 2002,22,Creating an Expert Rule (2/3),4,In the Rule Editor displayed enter the expert rule. For example, type H:Hole in the first window after the sign . Type if (H.Diameter = 5mm) H.Diameter = 10mm in the second window. Click on OK button. A rule is added to the rule set in the specification tree. Note : The semantics of your expert rule is the following. For any feature of type Hole in the model, set its diameter to 10mm if the actual diameter is equal to 5mm.,KWE language,Visual Basic Language,4,In the Rule Editor enter the visual Basic Script in the main window. A rule is added to the rule set in the specification tree. Note : To specify that a check is valid or not, you must set the value attribute of the returnvalue object (1 if the check is valid 0 otherwise),Copyright DASSAULT SYSTEMES 2002,23,To avoid syntax errors in the text of the rule we advise you to use Object Browser. Once you are in the second window of the Rule Editor panel, type if (H. Click on the icon to access the Object Browser.,5,Find Hole in Part Design Features List and select Diameter in the list of Hole attributes. Click on Write icon to insert the attribute in the text of the rule. Type the remaining text of the rule.,Creating an Expert Rule (3/3),Copyright DASSAULT SYSTEMES 2002,24,Select the node corresponding to the expert rule to edit. Access the contextual menu (click on right mouse button). Select Expert rule object - Definition in order to display the same panel than in (1).,1-,Double-click in the specification tree on the node corresponding to the expert rule to edit. Edit the rule in the panel which appears.,or,2-,Editing an Expert Rule,Copyright DASSAULT SYSTEMES 2002,25,Select the node corresponding to the Expert rule to activate/inactivate (here its default name is CATKWERule.1) Access the contextual menu (click on right mouse button) Set Activate or Inactivate option for the CATKWERule.1 object,1,2,3,Activating / Inactivating an Expert Rule,Copyright DASSAULT SYSTEMES 2002,26,Select the node corresponding to the Expert rule to delete (here its default name is CATKWERule.1) Access the contextual menu (click on right mouse button) Select Delete,1,2,3,Deleting an Expert Rule,Copyright DASSAULT SYSTEMES 2002,27,Creating an Expert Check,In this lesson, you will see how to create and manage an Expert Check. The Expert Check is located under a Rule Set in the hierarchy of Knowledge Expert objects . Creating an Expert Check Editing an Expert Check Activating an Expert Check Deleting an Expert Check,Copyright DASSAULT SYSTEMES 2002,28,1,Select the Rule Base or the Rule Set node,Click on the Expert Check icon,2,3,A Rule Editor dialog box is displayed. Modify the default check name and comments if need. Select your language : KWE Language (default language) or Visual Basic Language. Then click on OK button,Creating an Expert Check (1/3),Copyright DASSAULT SYSTEMES 2002,29,Creating an Expert Check (2/3),KWE language,4,In the Check Editor displayed enter the expert check. For example, type H:Hole in the first window after the sign . Type H.Diameter = 10mm in the second window. Click on OK button. A check is added to the rule base in the specification tree. Note : The semantics of your expert check is the following. For any feature of type Hole in the model, verify if its diameter is equal to 10mm.,4,Visual Basic Language,In the condition Tab enter the visual Basic Script. For example type H:Hole in the first window after the sign . Type Dim diam As Length Set diam = H.Diameter if (diam.Value = 10.0 ) Then returnValue.Value = 1 else returnValue.Value = 0 end if,Note : To specify that a check is valid or not, you must set the value attribute of the returnvalue object (1 if the check is valid 0 otherwise),Copyright DASSAULT SYSTEMES 2002,30,Creating an Expert Check (3/3),To avoid syntax errors in the text of the check we advise you to use Object Browser. Once you are in the second window of the Check Editor panel, type H. Click on the icon to access the Object Browser.,5,Find Hole in Part Design Features List and select Diameter in the list of Hole attributes. Click on Write icon to insert the attribute in the text of the check. Type the remaining text of the check.,Copyright DASSAULT SYSTEMES 2002,31,Select the node corresponding to the expert check to edit. Access the contextual menu (click on right mouse button). Select Expert check object - Definition in order to display the same panel than in (1).,1-,Double-click in the specification tree on the node corresponding to the expert check to edit. Edit the check in the panel which appears.,or,2-,Editing an Expert Check,Copyright DASSAULT SYSTEMES 2002,32,Select the node corresponding to the Expert check to activate/inactivate (here its default name is CATKWECheck.1) Access the contextual menu (click on right mouse button) Set Activate or Inactivate option for the CATKWECheck.1 object,1,2,3,Activating / Inactivating an Expert Check,Copyright DASSAULT SYSTEMES 2002,33,Select the node corresponding to the Expert check to delete (here its default name is CATKWECheck.1) Access the contextual menu (click on right mouse button) Select Delete,1,2,3,Deleting an Expert Check,Copyright DASSAULT SYSTEMES 2002,34,Creating Expert Rules or Expert Checks on UDF,In this lesson, you will see how to create and manage Expert Rules and Expert Checks on User Define Feature published elements. Creating the UDF instance type Creating Experts Rules or Expert Checks on UDF,Copyright DASSAULT SYSTEMES 2002,35,1,When creating the UDF, select the Type tab and in the Instance Type field, enter the name of the UDF type. To do so, enter a prefix in the first Instance Type field. This prefix should be made of at least 3 characters. It will enable the user to gather UDFs of the same kind by using their names. In the second field, enter the identifier of the UDF. Then the Manage type button is available.,2,Click on the Manage type button. Type is the Instance Type name just created. User Type is the UDF Definition name. Super Type is the type from which the created type will inherit. Package is the workbench in which the created type will be displayed. File corresponds to the CATGscript file you want to create and that you will be able to use in your next CATIA session.,See Tools + Options + General + Parameters and Measure tab to enter the path of the .CATGscript.,Creating the UDF Instance Type,Copyright DASSAULT SYSTEMES 2002,36,1,Instantiate the UDF.,2,In the Knowledge Expert workbench, click the Expert Check icon and select the KWE language. Use the Type (“userfeature1” in this case) that you have just created to perform the Check. You can apply the Check or the Rule only on the UDF published elements (“dist” in this case). Then click OK to validate. If you the Object Browser, you will see appear in PartDesign this new type.,Creating Expert Rules or Expert Checks on UDF,Copyright DASSAULT SYSTEMES 2002,37,Navigating in the Object Browser,In this lesson, you will see how to access the Object Browser and how to use it to create an Expert Rule or an Expert Check. Accessing the Object Browser Using the Object Browser to create or edit an Expert Rule or an Expert Check,Copyright DASSAULT SYSTEMES 2002,38,1,Double click in the tree on an Expert Rule or an Expert Check node to access its definition,Click on the Object Browser icon,2,3,The Object Browser wizard panel is displayed.,Accessing the Object Browser,Copyright DASSAULT SYSTEMES 2002,39,Using the Object Browser to create or edit an Expert Rule or an Expert Check (1/2),In the leftmost window of the Object Browser select the category of the object you are interested in : Part Design or Shape Design feature, an Function or a Unit. In the middle window select the attribute of this feature you want to use. In the rightmost window select (if the window is not empty) the method or the property you want to apply on this attribute Example : Part Design Features - Pocket - EndLimit.,2,1,You can use the following buttons to get more information on the objects you manipulate : to go back or forward in the selection you are performing. to get the type object description. In our example : Diameter object with attribute Double. to get the parent feature and its attributes. In our example : the prototype of Hole feature is Mechanical Feature. to write down in the check or rule editor the method or the attribute you have selected.,Copyright DASSAULT SYSTEMES 2002,40,Notice that : The signature of functions contains several fields Example : accessing Part Design Features - Pad- HasAttribute() we see the following syntax in the bottom of the Object Browser. MechanicalFeature : HasAttribute( AttributeName : String ) : Boolean It means that the function HasAttribute( ) is defined for the class of objects of type MechanicalFeature, it takes one argument of type String and it returns a Boolean. When you indicate the attribute of the object, two syntaxes are possible : H.Diameter or HDiameter. When you use several objects in the expert rule or expert check, you must separate the declarations of types by semi-colons Example : H: Hole ; P: Pad ; S: Shell. You can see very often in the description of the syntax of functions the argument of type Holder. Here Holder is a kind of list. It contains several instances that can be accessed by the index thanks to the method GetInstanceMember(Holder, Index).,Using the Object Browser to create or edit an Expert Rule or an Expert Check (2/2),Copyright DASSAULT SYSTEMES 2002,41,Accessing the Expert Check/Rule in the Check/Rule body,In this lesson, you will see how to access the check/rule itself in the check/rule body by using the “Thischeck”/”Thisrule” variable Accessing the Expert Check/Rule in the Check/Rule body,Copyright DASSAULT SYSTEMES 2002,42,1,“Thischeck” and “Thisrule” are variables which enable the user to reference the check or the rule he is working with. You can: Access the parameters located below the rule or the check Compare various elements,Accessing the Expert Check/Rule in the Check/Rule body,Create an Expert Check/Rule, select the KWE language and add a new parameter.,2,Here is an example to check that the diameters of the holes contained in the model are superior the parameter value: : P:Hole PDiameter ThisCheck-GetAttributeReal (“Length.1”),Copyright DASSAULT SYSTEMES 2002,43,Solving a Rule Base,In this lesson, you will see how to solve a Rule Base. Solving a Rule Base means to solve all the active checks and rules contained in the rule sets of the Rule Base. Solving a Rule Base,Copyright DASSAULT SYSTEMES 2002,44,If the rule base has never been solved: If you are in automatic update mode : Modify a document parameter. All the active rules and checks will be automatically evaluated. If you are in manual update mode : Click on the solve icon. All the active rules and checks will be evaluated.,1-,2-,See Tools + Options + General tab to set the update mode,If the rule base has already been solved: If you are in automatic update mode : Modify a document parameter. Only the active rules and checks relative to the modified parameter will be automatically re-evaluated. If you are in manual update mode : Click on the solve icon. Only the active rules and checks relative to the modified parameter will be re-evaluated.,Solving a Rule Base,Notice that you have the summary of errors at the rule set level.,Copyright DASSAULT SYSTEMES 2002,45,Generating a Check Report,In this lesson, you will see how
展开阅读全文