Modifying existing menu items in sketchup
-
Hey guys!!
I have just started making extensions for sketchup using Ruby. I wanted to know if there was anyway, maybe using a ruby code, that I can disable an existing menu item. I actually need the Save and Save as options in the file menu to get disabled or grayed when the extension I've designed, is run.
From all the research I've done, I've only seen a way to add a menu item and then disable or gray the added item using "MF_GRAYED". But I wanted to do this to already existing menu item.
Please kindly help me if this is possible.
Thankyou. -
It's only possible to do it to your own extensions/methods.
The native ones and those by other authors are inaccessible to you...
-
That's unfortunate but thank you so much for letting me know.
If disabling is not possible for native items, is it possible to trigger my extension when the save button is clicked?
The reason is I need my extension to be run just before I save and close a sketchup file. -
If you are saving by clicking on the toolbar's Save button, why don't you just remove that toolbar and replace it with your own that includes you own custom Save button?
-
But by doing that, I will still have the option of going to the file menu and then clicking save.
The extension I've made is actually an encryption method, and I don't want anyone who uses the file to be able to save it without encrypting it. -
Your extension could use an observer which spots that SketchUp is closing and then runs itself ?
Perhaps an AppObserver [or perhaps a ModelObserver] ?? -
Thank you so much for this suggestion. I checked it out and it seems to be exactly what I needed. I will try it out soon and let you know if it worked.
-
It worked perfectly. Thank you so much!!
Advertisement