8 Replies Latest reply on Feb 26, 2014 1:07 PM by Karen Brunke

    50 File limit for APIs and macros in SWX?

    Karen Brunke

      Is there a hard limit of 50 files in APIs and macros in SWX?  We have several for simple tasks like printing to pdf, resetting revision tables, resetting variable values, etc.  However, they all require you to count (because the swx window does not give you a # of objects selected) 50 files at a time.  Go over 50, and they all crash SWX.  If it is a bug, is there anything to be done about it?  We have a HUGE program that saves its progress all the time so it can restart where it left off if SWX crashes, but these are simple little programs.  It doesn't seem like all of that complexity should be necessary. 

       

      We are on SWX 2012 SP5, but hope to upgrade to 2013 in the next month or so.

      I am not a programmer, just a user, so think "programming for dummies"

      The programs were written 4+ years ago, so there is a good chance there is something new we are not using that will fix the problem.

      The person who wrote the programs is no longer with us, but they are predominantly VB.net programs installed into a custom menu for company tools.

      We have a programmer that has been able to fix the programs.  He doesn't see the problem with having to run the programs on groups of 50 files, so isn't motivated to build in the complex solution that was used on the larger program.  However, making it hard just means people don't do it.  He's a good guy, so I'm sure if I push, he will do it, but the forum is frequently my hero, so I'm hoping you will provide a simpler solution.

        • Re: 50 File limit for APIs and macros in SWX?
          Jim Sculley

          Most likely, objects in the program are not being properly released and as a result the memory associated with them is not released.  Process enough files and you run out of memory.

           

          I have run C# add-ins that process thousands of files with no issues, you just have to do it correctly.

           

          If your code is actually opening files in SolidWorks, you want to make sure you close each one before you open the next.  It is possible to open files via code in SW, but not actaully have them visible, so you may know you have 50 files open.  If you can post the code for one of your smaller programs, it will be easier to determine if there is a problem that is easy ti fix.

           

          Jim S.

            • Re: 50 File limit for APIs and macros in SWX?
              Karen Brunke

              The one I recently ran did not close the files.  However, I wasn't even close on memory ... I have 16GB.  Is there another setting in SWX that would keep me from having over 50 files open?  This sounds like a post all its own, but if you know the answer, it will save me the effort.

               

              I will talk to the programmer to see if he can easily add a line to close each file.  I'm not sure if I can post the code.  IT management is kinda silly about it EVEN THOUGH most of it was based on free code available at the time.  I don't have direct access.   That isn't a complaint.  It just makes me giggle because they choose to draw the line here.

                • Re: 50 File limit for APIs and macros in SWX?
                  Jim Sculley

                  Karen Brunke wrote:

                   

                  The one I recently ran did not close the files.  However, I wasn't even close on memory ... I have 16GB.  Is there another setting in SWX that would keep me from having over 50 files open?  This sounds like a post all its own, but if you know the answer, it will save me the effort.

                   

                  Video memory is another potential bottleneck.  Can you open the same 50 files manually on your machine with no issues?  If you can, the problem most likely is the code not releasing objects.  If you cannot, you are simply running into a resource limitation for your hardware.

                   

                  Jim S.

              • Re: 50 File limit for APIs and macros in SWX?
                Roland Schwarz

                If you are converting to PDF, you may just want to use the task scheduler.

                 

                Also, it's not just about closing files in SW.  The program needs to release the object.  Usually done in VB by setting the object to Nothing.

                 

                If I were programming such a thing, I would have a list of files, then load, print, and close each individually.