Im looking for a macro to export total length and width of a sheatmetal flatpattern and create a excel "Cutlist" of multiple drawings. anyone have an idea if its possible? and help me get started.
You don't even need to use drawings. If you open the part, you can use the cut list properties of the sheet metal body.
I don't know any existing solution that does this. Your solution needs two parts:
Even though I'm not a huge fan, #Task could do the first. It can even detect crashes and restart every now and then to prevent crashes. I've just advised a customer to purchase a license so they can run my macro on a few thousand files.
If you don't go through that many files, you could still traverse a folder in a macro, for example with the Dir function in VBA.
CodeStack has done some legwork to read a slew of file properties. As long as your Cut-list is "updated," it will read the Cut-list properties and report the Bounding Box Length/Width of your SW part file. I gather that these values are what you're after unless I'm mistaken.
Read custom properties from file, configuration and cut-list elements using SOLIDWORKS API
One option available to you is to run a macro on a folder of files like Peter said, get the Width/Length properties from your cut-list property values, then input those values into your excel table.
I tried the macro you linked and it did nothing... I would use #task but its not free so
I have made a windows form that alows you to select the files you whant and add them to a list. now im working on to get it to open one file and collect thes 3 and add them to a excell list (all to one list) and close solidworks and reapeat. I whant to do it from the drawings beacuse they have the right filenames but after alot of googleing it seems pretty hard...
Thanks for clarifying! FYI - when you run the macro from VBA, check out the 'Immediate Window' output to see the results. Here's mine on a dummy part file. You can take the parts of that macro that you need, particularly that 'gets' the cut-list properties, and use that for your macro. This would be the 'GetCutLists' function in the macro.
It's quite alright for you to use drawings, it'll just require some extra legwork to get the referenced model from said drawing. I can help you further if you need.
Can you post a screenshot of the list? Does it contain filenames or full file paths?
It might also be worth putting in a request to CodeStack to create a variation of another of their existing macros to read Cut-list properties, see below for existing macro. They have created this macro to read file custom properties using SolidWorks Document Manager: Excel macro to manage custom properties in SOLIDWORKS files
This doesn't require the user to open SW at all, and can be done entirely within Excel.
The Macro from codestack is almost exaactly what im looking for but for drawings. wating for a key at the moment so i can test it.
The list contains filenames at the moment but its easy to change to full path. i got the other macro to work I couldnt enter cutlist properties at first but after a rebot it worked. im happy to get any help I can get.
Retrieving data ...