Hello,
I am having hard time to get a list of selected bodies in part subscribing to "UserSelectionPostNotify()",
for what i understant till now the event is fired when user click the body but before the body get added to selected Objects list... my approach is as folow:
doc is an object of type "PartDoc"
private int Doc_UserSelectionPostNotify()
{
if(userAddin.RequestSelectionInformation)
{
List
SelectionMgr selectionMgr = ((ModelDoc2)doc).ISelectionManager;
int selectionsCount = selectionMgr.GetSelectedObjectCount();
for (int i = 0; i < selectionsCount; i++)
{
swSelectType_e selectionType = (swSelectType_e)selectionMgr.GetSelectedObjectType(i);
if(selectionType == swSelectType_e.swSelSOLIDBODIES)
{
Body2 body = selectionMgr.GetSelectedObject6(i,-1);
if (body != null)
{
result.Add(body);
}
}
}
userAddin.DrawingCreatorDialog.SetSelectedBodies(result);
}
return 1;
}
my list always miss the actually selected body, if i pic 2 bodies, the event gets fired normally but just the first body is there, the one being selected is is recognized as entity but not as body, and i observe as well the when the event gets fired the body is not highlighted, it highlights just after return from event...
any idea would be appreciated...
SolidworksApi/macros