13 Replies Latest reply on Dec 17, 2014 12:10 PM by Dintej Patel

    How can I create a Macro that will give me a list of all the configurations in my solid works sheetmetal part, from which I can pick certain configs to be exported as a flat pattern .dwg file

    Dintej Patel

      Hello everyone,

      I am new to the forums and to solidworks API.

      I have used the forums to the best of my ability and created a Macro by pasting a couple of different macros I found on the forums that is capable of doing the following when executed:

      1. Check to ensure the open file is a part file

      2. Pops up a message box asking if user would like to create dwg flat pattern for all configurations or just the current active configuration

      3. A browser window then opens to allow user to save the file or files in a specific folder on the company network, If the folder doesn't exists it also allows the user to create a folder in which they can have the files for all the configurations saved.

      4. The macro then uses strings to grab the part file name and add the configuration to the end, my company uses a part number and then the width as the differentiation Eg. the part number would be A01111-2500 (2500 being 25 inches) the actual configurations are created using design tables

      5. The macro then provides the user with a final message box stating files have been saved.

       

      I now need help adding a couple more features to the macro since my colleagues like how the macro is currently working they are pushing for more functionality out it before implementing is company wide.

      - My team would like if the macro was able to create a pop up box that lists all the configurations available in the part from where the user can select only the configurations for which they want to create the dwg for. Some sort of a radio button style input where they can go in and check only the selection they want( to create flat patterns for only newly added configurations to existing part), and also have the ability to create dwg for all configurations in the event new parts are created and all dwgs need to be created.

       

      - The second feature would be a warning to let the user know if a dwg already exists for a configuration they are  trying to create a dwg for. At which point they can either select to over write the existing configuration dwg file or exit the macro without creating any dwgs.

       

      I have hard coded a root folder to start from so the users don't have to browse to the main folder location where all the dwgs are saved, this root folder path will have to be changed to your specific root folder, maybe your desktop or my documents folder, for this macro to function, I have it all labeled in notes to keep things neat.

       

      Any help with doing this will be greatly appreciated, I am a novice when it comes to coding and I would appreciate all the help I could get on this

      We use a 64 bit system with SW-2011 premium