How to Add a Filter to an Agent in CAA

In CAA, adding a filter to an agent involves the CATAcquisitionFilter class. A custom filter condition function CheckSelectedElement() is used for judgment, and the SetFilter method is used to apply the filter.
The sample code is as follows:

// Create a filter object, using the custom filter method CheckSelectedElement
CATAcquisitionFilter * pFilterSelected = Filter((FilterMethod) &TJMWheelHouseDraftCmd::CheckSelectedElement,(void *)NULL);

// Create an agent for Sketch selection
_pSketchAgent = new CATPathElementAgent("Select Sketch");
// Set the element type selected by the agent to CATISketch
_pSketchAgent->SetElementType("CATISketch");
// Set the behavior of the agent
_pSketchAgent->SetBehavior(CATDlgEngWithPrevaluation|CATDlgEngWithCSO|CATDlgEngWithPSOHSO|CATDlgEngOneShot);
// Apply the filter to the agent
_pSketchAgent->SetFilter(pFilterSelected);
posted @ 2025-05-04 23:18  lianxi528  阅读(33)  评论(0)    收藏  举报