How can I get the selected component in the feature manager at drawing document?

Hi folks,

I’ve been trying to get the custom properties from a virtual component (fig. 1) for further adding as a text note in the sheet or view but the SelectionMgr::GetSelectedObjectsComponent4 only returns the root DrawingComponent class related to the view.

It’s possible to get the virtual component from the DrawingComponent::GetChildren array result but it isn’t the intended goal.

Figure #1 (virtual component selected at feature manager)

I though that GetSelectedComponentType3 would return a Feature, but it returns Component. But then you use GetSelectedObject6 and try to cast it to a Component, it doesn’t work. Casting it to a DrawingComponent does work, so then you get the underlying Component property and that’s the one you are looking for.

Well, to get custom properties you need to make sure the component is fully resolved, then get the underlying Model via GetModelDoc2, make sure you are using the correct configuration. If not, activate a window with that model and activate the right configuration. And THEN, you get get the custom properties.