I am using Solidworks 2017 and a macro through Microsoft Visual Basic for Applications to create and save drawings in a .png format from a model with 1500-2000 configurations. I have been using Solidworks for many years but I am new to macro's so I have very little experience with how to create or edit them (don't mind some of the commented out notes in the macro that I have to remind me what each line does). Through other forum discussions I have been able to put together the attached macro and it works ok except for after you get to somewhere around 400-500 loops you begin to get Solidworks Resources dangerously low pop up messages and then eventually it will just lock up and crash Solidworks. Below are the steps I take in my process
Step 1 - I open the model in Solidworks
Step 2 - In Solidworks go to Tools/Macro/Edit and open the attached macro
Step 3 - Click Run on the macro
Step 4 - Macro opens a Solidworks drawing template (.drwdot file type)
Step 5 - Macro updates the frame size
Step 6 - Macro pulls the default model into a single predefined view
Step 7 - Macro updates the model view in the template to the next configuration
Step 8 - Macro adds annotations, adjusts zoom
Step 9 - Macro saves file as .png
Step 10 - Macro closes template file
Step 11 - Loop back to Step 4
I can't help but think that it is an issue with cache or something that is building up. If I run 300 and then close Solidworks and start back at Step 1 I have never gotten an issue. If I run 300 and then start back at Step 1 and run another 300 without closing Solidworks I still get a crash. Was wondering if there are a couple of lines of code or something that I could add to the macro to clear the cache or not?
Jason
SolidworksApi macros