|
The scenario below illustrates how to use a variable and
specify a return value.
Instead of writing the body of expert rules and checks in the Knowledge
Expert language, you can write it in VB script. There are some adjustments
to be done:
- The variable declared in the (for all) field can be used
as an object.
- The indicated type name in Knowledge Expert Language may change
in VB script.
- To specify that a check is valid or not, set the Value attribute
of the returnValue object ( 1 if the check is valid, 0 if the check
is invalid).
|
|
|
-
Open the
KwxUseCase1.CATPart document.
-
Access the Knowledge Expert workbench, then click the
icon. In the dialog box which is displayed, enter a check name and a
comment. Select the Visual Basic language (KWE language is the default
language), then click OK. The three tab editor is displayed.
-
Select the Condition tab and enter the check below (Do
not use comments starting with /* and ending with */. Remove these
comments).
(for all) H:Hole
Dim diam As Length
Set diam = H.Diameter
if (diam.Value >= 10.0 ) then
returnValue.Value = 1
else
returnValue.Value = 0
end if |
-
Click OK to add the check to the rule base,
then click the
icon to solve the rule base. In the specification tree, the check icon is
green. This indicates that all the part holes have a diameter greater
than or equal to 10mm.
|