Hello I would like to put a button in a part or assembly to launch a macro. It's a macro specific to the part or assembly, so I don't want to put it in the toolbars (there's a tutorial for that :http://www.lynkoa.com/tutos/3d/creer-un-bouton-macro-dans-solidworks ) but only on the desired element. (in the same way as you put objects like an Excel spreadsheet but it would be a button that automatically launches a macro). Example:
This button can also be in FeatureManager as in the example above.
If this is not yet possible, can we ask Solidworks Dassault Système to develop a small update integrating this simple feature?
I think I want to do what I did in this conversation: http://www.lynkoa.com/forum/solidworks/macro-mod%C3%A8le-de-document#answer-666046
It all depends on the macro to be launched, but you should look at the feature macros, otherwise a button in the global toolbar (next to the record buttons...) with a macro that has a processing that allows you to launch this or that code depending on the type of file.
Basically, it's all really related to the complexity of the macro.
I don't see how the complexity of the macro has an influence on the possibility of having a button.
A button to launch a macro remains the same in the toolbar regardless of the conplexity of the macro. The same would be true for the macro starting with a button on the assembly.
What is the point of putting a button in the Feature Manager? A button will only be in a toolbar. As detailed here: http://www.lynkoa.com/store/fr/ajouter-un-bouton-pour-macro-dans-solidworks.html
I have a macro that works with a single part and another that is used for a single assembly. (and I'm in the process of programming others for other elements)
When someone is working with this part or assembly, they run the corresponding macro multiple times. If we don' t work on these parts, we don't need these macros
Therefore
- If I put a button in the taskbar, I have two buttons (for the moment but more in the future) that take up space for nothing in 99.9% of the rooms, moreover I have to install the buttons on the toolbars of all my colleagues :-\
- If I don't put a button, I either have to create a special keyboard shortcut to launch this macro or do several times Tools/ Macro/ find my macro... It's annoying when you have to do it 10 times in a row. In addition , colleagues always come to you to ask you what is the right macro? and how to launch it....
Hence my need to put a simple button that is linked to a room and that directly calls the macro. This button can be integrated as tables on the drawing, either in the Feature Manager alongside the equations, annotations, sensors... I want a feature a bit like in excel that simply allows you to create a button on the spreadsheet and that, when you click on it, launches the macro.
To answer quite simply, as @Remrem indicated, it is not possible to do this in Solidwoks!
On the other hand, you can insert a text file in which you describe the procedure to follow, the places where the macro is stored, etc etc for your colleagues (and your successors).
But otherwise the addition of buttons is not necessarily that problematic. You can have only one button per type of action (streamlining as much as possible) and make it apply only if the right file is open.
It works by doing "Insert an object", "Create from a file" and then point to a programme.exe. 1 double-click on your object will then launch this program.
This means that you have to go through the creation of a program rather than a macro.