The following example shows how to create the Rule Base RB1 from a newly created part document:
Dim CATDocs As Document
Set CATDocs = CATIA.Documents
Dim partdoc As PartDocument
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.CreateRuleBase("RB1")
- See also:
Properties
- Property ReportDescriptionLength() As
-
Returns or sets the Report Description Length (For Text option only).
- 0
- ShortText
- 1
- LongText
- Property ReportOutPutFormat() As
-
Returns or sets the Report OutPut Format.
- 0
- Html
- 1
- Text
- 2
- 3
- Property ReportPath() As
- Returns or sets the Report output path.
- Property ReportShowResult() As
-
Returns or sets the option for sorting the report.
- 0
- ByRule
- 1
- ByObject
- 2
- ByState
- Property RuleBaseEdition() As (Read Only)
- Returns the editable object corresponding to this rulebase. Be careful that, according to your licence, or the type of rulebase you're handling, you may not have the right to edit the rulebase.
- Example:
-
Dim aRBEdition As CATIAExpertRuleBase Set aRBEdition = aRBRuntime.RuleBaseEdition If not(aRBEdition is Nothing) Then ' .. action on the editable rulebase End if
- 0
- Passed
- 1
- Failed
- 2
- Both
Methods
- Func AccurateType() As
-
Returns as a string the type of component.
- Returns:
- A string among ("ExpertRuleBase", "ExpertRuleBaseRuntime") dd>
- Sub AddFact( iFact)
-
Adds new fact to the rule base resolution.
- Parameters:
-
- iFact
- Fact to be added
- Example:
-
Dim pad3 as Shape Dim rulebase as ExpertRuleBase Set pad3 = part.MainBody.Shapes.Item("Pad3") Set rulebase = part.Relations.Item("RuleBase") rulebase.AddFact (pad3)
- Parameters:
-
- iRootFacts
- root of facts to be added. dd>
Dim rulebase as ExpertRuleBase
Set rulebase = part.Relations.Item("RuleBase")
rulebase.Deduce ()
- Example:
-
on error resume next part.Relations.Item("RuleBase").Fingerprint () on error goto 0
- Returns:
- Fingerprint information dd>
- Returns:
- Number of roots of facts. dd>
- Parameters:
-
- oRootsOfFacts
- array of roots of facts. dd>
- Parameters:
-
- iRuleSet
- CATIAExpertRuleSet : the RuleSet user want to import. dd>
- iForce
- Boolean : if True (= 1), then if imported rules allready exist in target document, rules of target document are replaced.
- Example:
-
Dim CATDocs As Documents Set CATDocs = CATIA.Documents Dim partdoc As Document Set partdoc = CATDocs.Open("e:\TargetDocument.CATPart") Dim part As Part Set part = partdoc.Part Dim productdoc As Document Set productdoc = CATDocs.Open("e:\ImportedDocument.CATProduct") Dim product As Product Set product = productdoc.Product Dim ruleset As ExpertRuleSet Set ruleset = product.Relations.Item("RuleBase").RuleSet.ExpertRuleBaseComponentRuntimes.ShallowItem(1) part.Relations.Item("RuleBase").Import (ruleset,0)
- Parameters:
-
- iPath
- CATBSTR : the path of the document user want to import. dd>
- iForce
- Boolean : if True (= 1), then if imported rules allready exist in target document, rules of target document are replaced. if False (= 0), then if imported rules allready exist in target document, rules of imported document are ignored.*
- Example:
-
part.Relations.Item("RuleBase").ImportFromFile ("e:\importeddocument.CATProduct",0)
- Parameters:
-
- iRoot
- CATIABase : the root user want to import into. dd>
- iForce
- Boolean : if True (= 1), then if imported rules allready exist in target document, rules of target document are replaced. if False (= 0), then if imported rules allready exist in target document, rules of imported document are ignored.*
- Example:
-
part.Relations.Item("RuleBase").ImportWithLink (root,0)
- Parameters:
-
- iRootFacts
- root of facts to be removed. dd>
- Parameters:
-
- reallyStartBrowser
- Boolean : if True (= 1), then the browser is started on the report
- Example:
-
part.Relations.Item("RuleBase").Report (0)
- Example:
-
on error resume next part.Relations.Item("RuleBase").SynchronizeStatus () on error goto 0
- Returns:
- Synchronize status dd>