Can you create new features while a PMP is active?

I’m creating a few features using input from a Property Manager Page. I would like to create these features when the PMP is closed with the OK button, so on the OnClose event.

I am able to create a sketch, but not a reference plane. Should this be possible while a PMP is open? Are there documented limitations?

I’m doing some more tests now, maybe the selected objects are marked and they may mess up the preselection for the plane, even though I use different marks.

If I cannot get this to work, I’ll create the features when the AfterClose event fires.

Try swPropertyManagerOptions_LockedPage when creating page

Will do, thanks Artem.

Nope, couldn’t get it to work. I enabled the pushpin option + lock, the tried to add a plane while the PMP is pinned. It keeps on returning null, so it seems to not be allowed while a PMP is open.

Do you have selection boxes in your pmp?

Yes, I do. It would make sense that the selections interfere.

I’ve already tested setting marks for the selection boxes that are different from the marks that the CreateRefPlane method expects, that didn’t help. I think I have also tried suspending the selection list but I’m not sure anymore :yum:

@PeterBrinkhuis, As per API help, SW controls when add-in can do the work and addin is unable to do any real work within OnClose handler. May be that is the reason, you are not able to create the reference plane.

Again as per API help, close PMPage by calling IModelDoc2::ClearSelection method which should call AfterClose event handler, create your reference plane and re-display the PMPage.

I’ve read the docs a dozen times, so I noticed that you cannot perform all actions when a PMP is open. And in true SW fashion, there is no list of what you can and cannot do…

Reopening the PMP after you’re done is a possibility, though not a very nice one. I’ve decided to do all the work in the AfterClose event for now.

3 Likes

SOLIDWORKS controls when add-ins can do work. An add-in is unable to do any real work within the PropertyManager2Handler9::OnClose handler because the PropertyManager page and command are closing. So, typically the IPropertyPage2Handler9::AfterClose handler is called after IPropertyManager2Handler9::OnClose to allow an add-in to do work. However:

read more …