The following example shows how to access the RuleSet of the rule Base RB1
Dim CATDocs As Documents
Set CATDocs = CATIA.Documents
Dim partdoc As Document
Set partdoc = CATDocs.Add("CATPart")
Dim part as Part
Set part = partdoc.Part
Dim relations as Relations
Set relations = part.Relations
Dim RuleBase as ExpertRuleBaseRuntime
Set RuleBase = relations.Item("RB1")
Dim RuleSet as ExpertRuleSet
Set RuleSet = RuleBase.RuleSet
Methods
- Func CreateCheck( iName, iCheckVariables, iCheckBody, iRuleSet) As
-
Creates a check and adds it to the RuleSet.
- Parameters:
-
- iName
- The check name dd>
- iCheckVariables
- define variables of the check. dd>
- iCheckBody
- The check definition dd>
- iRuleSet
- The ruleset name where the check is to be aggregated. If this macro is used from the RuleSet where we want to create the check, the param must be equal to value : "". dd>
- Returns:
- The created check
- Example:
-
This example creates the SolidActivity check
and adds it to the newly created RuleSet.1 RuleSet then
creates the HoleActivity check
and adds it to the newly created RuleSet.2 RuleSet
Dim CATDocs As Documents Set CATDocs = CATIA.Documents Dim partdoc As Document Dim part as Part Dim CheckSolid as ExpertCheck Dim ruleset as ExpertRuleSet Dim CheckHole as ExpertCheck Set partdoc = CATDocs.Add("CATPart") Set part = partdoc.Part Set CheckSolid = part.Relations.Item("RuleBase").RuleSet.CreateCheck ("SolidActivity", "Sol : Solid", "Sol.Activity == True", "RuleSet.1") Set ruleset = part.Relations.Item("RuleBase").RuleSet.CreateRuleSet ("RuleSet.2", "") Set CheckHole = ruleset.CreateCheck ("HoleActivity", "H : Hole", "H.Activity == True", "")
- Parameters:
-
- iName
- The rule name dd>
- iRuleVariables
- define variables of the rule. dd>
- iRuleBody
- The check definition dd>
- iRuleSet
- The RuleSet name where this rule aggregated. If this macro is used from the ruleset where we want to aggregate the rule, the param must be equal to value : "". dd>
- Returns:
- The created rule
- Example:
-
This example creates the DesactivateIfActivatedOnSolid rule
and adds it to the newly created RuleSet.1 RuleSet then creates the
DesactivateIfActivatedOnHole rule and adds it to the newly created RuleSet.2
RuleSet
Dim CATDocs As Documents Set CATDocs = CATIA.Documents Dim partdoc As Document Set partdoc = CATDocs.Add("CATPart") Dim part as Part Set part = partdoc.Part Dim rulesolid as ExpertRule Set rulesolid = part.Relations.Item("RuleBase").RuleSet.CreateRule ("DesactivateIfActivatedOnSolid", "Sol : Solid", "Sol.Activity == True then Sol.Activity = False", "RuleSet.1") Dim ruleset as ExpertRuleSet Set ruleset = part.Relations.Item("RuleBase").RuleSet.CreateRuleSet ("RuleSet.2", "") Dim rulehole as ExpertRule Set rulehole = ruleset.CreateRule ("DesactivateIfActivatedOnHole", "H : Hole", "H.Activity == True then H.Activity = False", "")
- Parameters:
-
- iName
- The ruleset name dd>
- iRuleSet
- The ruleset name where this ruleset is to be aggregated. If this macro is used from the ruleset or the rulebase where we want to aggregate the ruleset, the param must be equal to value : "". dd>
- Returns:
- The created ruleset
- Example:
-
This example, firstly, creates the RuleSet.1 RuleSet
and adds it to the newly created RuleBase. Secondly, it creates RuleSet.2 RuleSet
and adds it to the ruleset RuleSet.1
Dim CATDocs As Documents Set CATDocs = CATIA.Documents Dim partdoc As Document Set partdoc = CATDocs.Add("CATPart") Dim part as Part Set part = partdoc.Part Dim RS1 as ExpertRuleSet RS1 = part.Relations.Item("RuleBase").RuleSet.CreateRuleSet ("RuleSet.1", "") Dim RS2 as ExpertRuleSet RS2 = part.Relations.Item("RuleBase").RuleSet.CreateRuleSet ("RuleSet.2", "RuleSet.1")