Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Atuo running a macro after a part has been saved

Status
Not open for further replies.

nickjb

Mechanical
Jun 19, 2007
35
I want to run a macro after a part has been saved to record the file name in a database. I've got the recording bit working fine I just need to get it to autorun. I'd rather it ran from the standard save and saveas and not need a special save macro. Can anyone point me to some hints?
 
Replies continue below

Recommended for you

You want an addin for this.

Event-triggered routines are best in an addin. You can have a macro constantly running to catch events like a file save, but that takes resources and is prone to trouble.

[bat]Honesty may be the best policy, but insanity is a better defense.[bat]
-SolidWorks API VB programming help
 
Add-in is a good idea. However, you may not need an add-in. You can create a macro that replaces the save function and set up a keystroke and/or toolbar icon for it. It should save the file, then execute your DB editing code. The advantage to doing it this way is that you will only save to the DB when intended, and not just every time someone changes a model and then blinks and saves it again.



Matt Lorono
CAD Engineer/ECN Analyst
Silicon Valley, CA
Lorono's SolidWorks Resources
Co-moderator of Solidworks Yahoo! Group
and Mechnical.Engineering Yahoo! Group
 
Thanks for the help so far

Not used add-in before. Is it easy, or even possible?

I did consider the macro button option but it will get missed a few times. I like to make these sort of thing completly invisible to the user rather than adding extra thing to do. I don't mind updating the database often, its pretty solid.
 
Making an addin will require that the program be compiled, so you will need to write it in VB (6 or .NET) or C.

You can migrate macros to full VB, then write added code for macro functinality. I did a presentation on this once. It is posted on my website.

[bat]Honesty may be the best policy, but insanity is a better defense.[bat]
-SolidWorks API VB programming help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor