My feature tree in a drawing looks like this:
I want to get the selected component "Assem1". I am selecting "Assem1" as pictured above and then run my code:
IModelDoc2 model = (IModelDoc2)App.ActiveDoc;
SelectionMgr sm = (SelectionMgr)model.SelectionManager;
IDrawingComponent selectedComponent = (IDrawingComponent)sm.GetSelectedObjectsComponent4(-1, -1);
int count = sm.GetSelectedObjectCount2(-1);
I am getting a count of zero no matter what I try. In fact, after my simple script runs my selection is unhighlighted.
What might be happening? How do I get the currently highlighted IDrawingComponent?
SolidworksApi/macros