Filtering PDM menu command

Programming and macros
MMartens
Posts: 36
Joined: Wed Apr 28, 2021 10:01 am
Answers: 6
Location: Shawano, WI USA
x 6

Filtering PDM menu command

Unread post by MMartens »

My searches haven't yielded any results so I thought I'd just ask the question. I know you can filter a custom PDM menu command based on file or folder selection and single or multiple selection. But does anyone know of a way to change the availability of a menu command based on the file type. I have an STP conversion command but I wanted to have it unavailable if the user selected a drawing file. Similarly, I have a DXF conversion command that I would want unavailable when the selection is an assembly or part file.
User avatar
AlexB
Posts: 501
Joined: Thu Mar 18, 2021 1:38 pm
Answers: 28
x 269
x 445

Re: Filtering PDM menu command

Unread post by AlexB »

I don't think there's a way to disable a menu command. I would recommend performing a validation of the selection once a user clicks that command before running the STP conversion on a file.

A couple of examples:
1. If the selection contains a non-sldprt file then pop up an error that says the user cannot run that command on a file that isn't a sldprt.
2. If the selection contains a non-sldprt file then skip over it and process all the sldprt files in the selection list.
MMartens
Posts: 36
Joined: Wed Apr 28, 2021 10:01 am
Answers: 6
Location: Shawano, WI USA
x 6

Re: Filtering PDM menu command

Unread post by MMartens »

I currently have the code only grab the filetypes able to be converted for the selected task similar to your second selection. I was just curious if it was possible to prevent it in the menu command coding.
Post Reply