AnsweredAssumed Answered

API: expand selected sketch in FM tree

Question asked by Ronny Engmann on Dec 6, 2018
Latest reply on Dec 7, 2018 by Ronny Engmann



I'm selecting a sketch via API and I want to have it expanded in the FM tree just like SOLIDWORKS does when you select the sketch via breadcrumbs:



You can see that the parent features incl. folders and subfolders will be expanded.


Unfortunately that doesn't happen via API (ModelDocExtension::SelectByID2). I tried to use FeatureManager::ExpandFeature but depending on the "WhichPane" parameter it will do that either in the wrong FM pane or only expand the "History" folder.


Is there any workaround? The only thing that I have in mind is to work with nodes (FeatureManager::GetFeatureTreeRootItem2 and TreeControlItem::Expanded). Do you have any better solution / suggestion?


Attached you'll find the test macro and an example part.


Thanks in advance.


Kind regards,