Launch a macro when starting solidworks if drawing

Hello

I'm looking to launch a macro when opening any drawing.

Is it possible?

Thank you in advance for your feedback

 

Yannick

Hello

What should this macro do because the question is not very clear.

1 Like

Hello

 

Indeed I forgot a word in my request.

I'm looking to launch a macro when opening a shot

This macro will reload the background plan template and zoom in at best.

 

Cdlt

It seemed to me that I had seen something that resembled your request.

Without having tried, here is the link that seems to correspond to your request:

https://www.codestack.net/solidworks-api/application/documents/handle-document-load/

If you manage to do what you want, share the code with us, it could possibly interest me for the near future (background  to be reviewed)

1 Like

Hello;

there's an example of macro automation when launching Solidworks here: handle-document-load (site: codestack.net)

 .... sbadenis just edited the same answer as me (unless it's the other way around?) And I haven't found a way to delete a position. (Nasty Forum!)

All that's left to do is create/call a second macro with your conditions.

otherwise there are also the "Macro Feature", but I don't recommend them at all....

https://www.codestack.net/solidworks-api/document/macro-feature/

https://help.solidworks.com/2020/English/api/sldworksapi/Create_Macro_Feature_Subfeature_Example_VB.htm?verRedirect=1

Kind regards.

1 Like

Faster than @Maclane that's not to say ;)

As they say, great minds meet!

After digging deeper, I don't think it really meets the need. because it's a macro feature to insert into the template drawing. (or AS-Piece)

So it's impossible to catch up.

The easiest way for you will surely be to use integration (MyCadtools utility) to make a catch-up on all the selected drawings.

https://help.visiativ.com/mycadtools/2020/fr/Integration.html

I've already done it over several weekends and a very large amount of plans (+ 60,000) and it's done pretty well (programming with task planner possible)

https://help.visiativ.com/mycadtools/2020/fr/TaskPlanner.html

For the rule in condition: Solidworks, Systematics

In operation -> Miscellaneous, launch a macro

 

 

Hello

I arrive a little after the battle, but by playing with events it's possible. On the other hand, you have to change the command of the SW shortcut to launch it with a macro launched when opening.

So it's related to SW and not to doc templates, so you can launch actions based on a whole bunch of SW events (memory, retrieving the event of opening a file, different user actions...)