1 2 3 First Previous 141 Replies Latest reply on Dec 6, 2018 6:27 AM by Ulric Bloem

    Batch export to dwg

      Hello,  I'm looking for some input on batch exporting sheet metal parts as dwg flat patterns.  Has anyone created a macro for this?  I tried just recording a macro in 2010 SP2.1, but it didn't work out so hot.  An automated process for this would be very helpful for us because we generally have 50+ flats we have to create at a time for a job.  SW2010 may have made this task more challenging due to all the new flat pattern export features they added, thus, more steps to create the flat.


      Any help on this would be greatly appreciated.  Thank you.



        • 1. Re: Batch export to dwg
          Steven Vandermeulen
          i think LaserMRP by angelsix.com might do the trick ...
          • 3. Re: Batch export to dwg

            Thanks guys.  The info you gave pointed me in the right direction.  I ended up just jumping into my first ever experience with VBA and combined some code from two different macros, then added a few of my own flavors.  The first draft is still rough code wise, but it works.  It currently asks for a folder location and opens any .SLDPRT file in that folder and saves the flat patterns of all configurations.


            Currently, there is no user option to specify what parts need the bend lines in the flat.  A nice feature I just added while typing this is to only open one part at a time.  This is good if you have a lot of parts that are being saved.


            Please provide any input you may have for improving it.





            • 4. Re: Batch export to dwg
              Chad Moles

              Casey, I have had an ongoing thread that is simillar to your macro except that I need dxf file output without bendlines. The files need to be AutoCAD R13.dxf files. I am including a link to my thread Macro- for saving dxf flat patterns with configuration names.dxf

              As stated in this post, your macro does in fact work with SW 2010 and this is a big step which Deepak and myself have had problems with. In order for this macro to work with the most sheetmetal designers, we would need more selections as far as with and without bendlines, also selectable file outputs would be extreamly useful. This would be necessary for the mojority of sheetmetal designers in order to remove the necessary convertion time for each and every dwg file into a dxf file. Myself, and I believe quite a few other sheetmetal desigers are dealing with multiple configuration (between 50-500) and the time spent on converting these files is enormous when dealing with so many files. Maybe the best solution would be for us to take this macro and modify it for each situation but I wanted to see if you thought modifying it yourself with selicatble output choices would be something you would be interested in providing. Thank you so much for what you have already completed, it is a big step towards where I have been trying to arrive.

              • 5. Re: Batch export to dwg



                I want to include the option to turn the bend lines on or off in a text box, I just haven't had time to refine it yet.  This would be useful to us as well because we are using RouterCIM and we use the bend lines to rout aluminum sheet for hand forming.  We do not do this on every part, so I want to be able to choose which parts have bend lines.


                As far as the AutoCAD export type, I don't think it is practical to change that in the code.  When you export the flat in Solidworks as a DWG or DXF, in options, you just change it to what ever type you need there and it keeps your settings.


                As it sits, the macro will save as DXF if you go into the code and go down to the line commented 'edit here for save as dxf.  Just change the ".DWG" to ".DXF" and it will save as DXF.  Also, you can remove the bend lines by doing the following:


                'Export Flat Pattern
                bRet = swModel.ExportFlatPatternView(NewFilePath, 0)  'Change the 0 to a 1 to remove bend lines.


                I'm going to play with it today and see if I can get a user form going.

                • 6. Re: Batch export to dwg
                  Deepak Gupta

                  Casey wrote:


                  'Export Flat Pattern

                  bRet = swModel.ExportFlatPatternView(NewFilePath, 0)  'Change the 0 to a 1 to remove bend lines.


                  Have you tested this as I had tried it earlier but nothing happens.

                  • 7. Re: Batch export to dwg
                    Yes I have tested that.  Attached is version 2.  This has a User Input box for dwg/dxf export and an option to chose bend line status.  Test it out and see if the code is working.  I am still very green in VBA, so bear with me!
                    • 8. Re: Batch export to dwg
                      Deepak Gupta



                      The macro is cool and can be modified further (I'm trying to add few more features) But as I said above, the remove bend line function is not working for me, at least not in SW 2009. Can someone confirm it?

                      • 9. Re: Batch export to dwg
                        Deepak Gupta
                        Version 3. Added options to Browse for file folder and Form unloading at the end of the function.
                        • 10. Re: Batch export to dwg
                          Good find on the "browse to folder" option.  Form unloading is new to me, so I'm glad you added that in.  I have a few more features that I'm going to play with that I may add in the future.  I would really like to be able to show the parts in a checklist box.  That is going to take a bit more coding.
                          • 11. Re: Batch export to dwg
                            It did not work with my SW2009, only with SW2010.  I don't know why that is.
                            • 12. Re: Batch export to dwg
                              Deepak Gupta
                              May be this has been fixed for SW2010.
                              • 13. Re: Batch export to dwg
                                Chad Moles
                                Finally, we have a dxf file conversion macro that works in SW2010, the bend lines are in fact removed in SW2010 and we have the option of dxf or dwg conversions. You two have been a extreamly helpful to alot of sheet metal designers. Thanks so very much, this macro rocks, good job to the both of you.
                                • 14. Re: Batch export to dwg
                                  No problem!
                                  1 2 3 First Previous