|
-
Open the
KwxAdvancedCheck.CATPart file. The following document is displayed:
-
From the Start > Knowledgeware menu, access
the Knowledge Expert workbench.
-
Click the Expert Check icon ().
The Check Editor dialog box is displayed.
-
In the Language scrolling list, select the KWE
Advanced Language (see picture opposite). Click OK.
-
In the For All field (),
enter the feature type that you want to apply to the expert rule. The
following syntax must be applied: Pad1:Pad
-
Copy/Paste the code below into the edition box and click
OK when done:
/* Set the local variables */
let MyListOfHole(list)
let MyListOfPad(list)
let MyTupleFailed (list)
let MyTupleSucceeded (list)
let MyHole(Hole)
let MyPad(Pad)
let MyHoleBody(Body)
let MyPadBody(Body)
let MyOwner (BodyFeature)
let i = 1
/*Go to the root and look for all the Pads */
set MyOwner = Pad1.Owner
MyListOfPad = MyOwner.Owner > Query("Pad","")
/* Go to the PartBody and look for the Holes */
MyListOfHole = Pad1.Owner > Query("Hole","")
/* Filter the threaded holes */
MyListOfHole > Filter("Hole","X.Threaded == true")
for i while i<=MyListOfHole > Size()
{
MyHole = MyListOfHole > GetItem(i)
for MyPad inside MyListOfPad
{
/* Filter the Pad Pad Pad1 */
if (Pad1.Name <> MyPad.Name)
{
/* Check that the direction of MyHole is identical to the direction
of the Pad plane */
if (MyHole.GetAttributeString("Direction") == MyPad >
GetAttributeString("Plane") )
{
/* Cast Hole and Pad in the type Body (distance has "Body" type
argument) */
set MyHoleBody = MyHole
set MyPadBody = MyPad
/* Distance between this Hole and this Pad is lower than 35 mm */
if (distance(MyHoleBody,MyPadBody) < 35 mm)
/* for the report */
ThisCheck.AddTupleFailed(MyHoleBody,MyPadBody)
else
ThisCheck.AddTupleSucceeded(MyTupleSucceeded)
}
else
ThisCheck.AddTupleSucceeded(MyHoleBody,MyPadBody)
}
}
i = i+1
} |
-
Right-click the rule base in the specification tree, and
select RuleBase object > Manual Complete Solve, or click the
Solve icon ().
The check icon turns to red indicating that the check failed.
-
Right-click the rule base in the specification tree, and
select RuleBase object > Report..., or click the Report
icon ().
The check icon turns to red indicating that the check failed. Select the
directory and click OK. The report is displayed.
|