pycatia.general_knowledge_interfaces.expert_rule_base_runtime

Module initially auto generated using V5Automation files from CATIA V5 R28 on 2020-09-25 14:34:21.593357

Warning

The notes denoted “CAA V5 Visual Basic Help” are to be used as reference only. They are there as a guide as to how the visual basic / catscript functions work and thus help debugging in pycatia.

class pycatia.general_knowledge_interfaces.expert_rule_base_runtime.ExpertRuleBaseRuntime(com_object)

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357)

System.IUnknown
System.IDispatch
System.CATBaseUnknown
System.CATBaseDispatch
System.AnyObject
KnowledgeInterfaces.KnowledgeObject
KnowledgeInterfaces.KnowledgeActivateObject
KnowledgeInterfaces.Relation
ExpertRuleBaseRuntime

Represents the Runtime part of the RuleBase.
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:
Relations
accurate_type() str

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Func AccurateType() As CATBSTR

Returns as a string the type of component.

Returns:
A string among (“ExpertRuleBase”, “ExpertRuleBaseRuntime”)
Return type:

str

add_fact(i_fact: AnyObject) None

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Sub AddFact(AnyObject 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:

i_fact (AnyObject) –

Return type:

None

add_root_of_facts(i_root_facts: AnyObject) None

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Sub AddRootOfFacts(AnyObject iRootFacts)

Adds a new root of facts to the rule base.

Parameters:

iRootFacts
root of facts to be added.
Parameters:

i_root_facts (AnyObject) –

Return type:

None

deduce() None

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Sub Deduce()

Launch a Forward chaining Solve on the current RuleBase.
Example:

Dim rulebase as ExpertRuleBase

Set rulebase = part.Relations.Item(“RuleBase”)
rulebase.Deduce ()
Return type:

None

fingerprint() bool

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Func Fingerprint() As boolean

Returns the Fingerprint information. The fingerprint indicates
if the last result of the rulebase is relevant regarding to the
objects the rule base has checked. In other words, if the part
has evolved since last Deduce, the fingerprint is false.
Be careful : on volatile rulebases ( ExpertRuleBase.VolatileCopy ), it raises an error.

Example:

on error resume next
part.Relations.Item(“RuleBase”).Fingerprint ()
on error goto 0


Returns:
Fingerprint information
Return type:

bool

get_number_of_roots_of_facts() int

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Func GetNumberOfRootsOfFacts() As long

Retrieves the number of roots of facts of the rule base.

Returns:
Number of roots of facts.
Return type:

int

get_roots_of_facts(o_roots_of_facts: tuple) None

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Sub GetRootsOfFacts(CATSafeArrayVariant oRootsOfFacts)

Retrieves all the roots of facts from the rule base.

Parameters:

oRootsOfFacts
array of roots of facts.
Parameters:

o_roots_of_facts (tuple) –

Return type:

None

import_(i_rule_set: ExpertRuleSet, i_force: bool) None

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Sub Import(ExpertRuleSet iRuleSet,
boolean iForce)

Import from RuleSet.

Parameters:

iRuleSet
CATIAExpertRuleSet : the RuleSet user want to import.
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:
Return type:

None

import_from_file(i_path: str, i_force: bool) None

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Sub ImportFromFile(CATBSTR iPath,
boolean iForce)

Import from file.

Parameters:

iPath
CATBSTR : the path of the document user want to import.
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:
  • i_path (str) –

  • i_force (bool) –

Return type:

None

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Sub ImportWithLink(AnyObject iRoot,
boolean iForce)

Import with link to a document.

Parameters:

iRoot
CATIABase : the root user want to import into.
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:
Return type:

None

remove_root_of_facts(i_root_facts: AnyObject) None

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Sub RemoveRootOfFacts(AnyObject iRootFacts)

Removes a root of facts from the rule base.

Parameters:

iRootFacts
root of facts to be removed.
Parameters:

i_root_facts (AnyObject) –

Return type:

None

report(really_start_browser: bool) None

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Sub Report(boolean reallyStartBrowser)

Launch a Report. The default output format is HTML

Parameters:

reallyStartBrowser
Boolean : if True (= 1), then the browser is started on the report

Example:

part.Relations.Item(“RuleBase”).Report (0)
Parameters:

really_start_browser (bool) –

Return type:

None

property report_description_length: int

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357)
o Property ReportDescriptionLength() As
CatDescriptionLengthType

Returns or sets the Report Description Length (For Text option
only).

0
ShortText
1
LongText
Returns:

enum cat_description_length_type

Return type:

int

property report_output_format: int

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357)
o Property ReportOutPutFormat() As CatOutPutFormatType

Returns or sets the Report OutPut Format.

0
Html
1
Text
2
Print
3
Email
Returns:

enum cat_out_put_format_type

Return type:

int

property report_path: str

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357)
o Property ReportPath() As CATBSTR

Returns or sets the Report output path.
Return type:

str

property report_show_result: int

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357)
o Property ReportShowResult() As CatShowResultType

Returns or sets the option for sorting the report.

0
ByRule
1
ByObject
2
ByState
Returns:

enum cat_show_result_type

Return type:

int

property rule_base_edition: ExpertRuleBase

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357)
o Property RuleBaseEdition() As ExpertRuleBase (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
Return type:

ExpertRuleBase

property rule_set: ExpertRuleSet

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357)
o Property RuleSet() As ExpertRuleSet (Read Only)

Returns the Set linked to the RuleBase. This is the main RuleSet that
contains all the RuleBase components.
Return type:

ExpertRuleSet

property solve_type: int

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357)
o Property SolveType() As CatSolveType

Returns or sets the solve option.
Returns:

enum cat_solve_type

Return type:

int

synchronize_status() bool

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Func SynchronizeStatus() As boolean

Returns the Synchronize information. The synchronize status indicates
for a linked rule base if the rulebase is synchronized.
Be careful : on volatile rulebases ( ExpertRuleBase.VolatileCopy ), it raises an error.

Example:

on error resume next
part.Relations.Item(“RuleBase”).SynchronizeStatus ()
on error goto 0

Returns:
Synchronize status
Return type:

bool

property text_visualization: int

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357)
o Property TextVisualization() As CatVisualizationType

Returns or sets the Report option for visualization.

0
Passed
1
Failed
2
Both
Returns:

enum cat_visualization_type

Return type:

int