AnsweredAssumed Answered

Macro to export PDF's, Sheet metal DXF's & Sheet Metal BoM

Question asked by Simon Rafferty on May 5, 2016
Latest reply on Oct 31, 2017 by Huseyin Ata

Thought this might be useful to some of you.

If you open an assembly and run the macro, it will export PDF's of any drawings (in the same folder as the Assembly) then find all the parts with Sheet Metal.

It exports a DXF file for the unfolded flat pattern and builds a BoM as a CSV for just the sheet metal parts.

  

PART NAME MATERIAL THICKNESS(mm) QUANTITY
Part1.DXF1060 Alloy61
Part2.DXF1060 Alloy61
Another Part.DXFPlain Carbon Steel101

 

This is intended that you can send the BoM + DXF's to your Laser Cutter being sure you've not forgotten anything!

 

It creates two folders in the root of the assembly for the DXF & PDF files.

It's not the tidiest bit of code I've ever written - and mostly just cobbled together out of examples from here & the API help - but it does seem to work OK.

The worst bit IMHO is the way it finds drawings by looking for a file with the same name as the part, but with the extension .sldprt.  If found, it saves as a PDF.

 

It seems that it's pretty difficult to find the drawing referenced by a model within an assembly.  I tried a few methods, which didn't work - so having run out of time kept it as it was!

The upshot is all the part & drawing files need to be in the same folder as the assembly (which I rarely do) - but you can use Pack'n'go and save to a single folder to make it so - better than nothing!

 

If I've 'borrowed' a snippet of your code - let me know and I'll give you a credit!

 

I hope it's useful to some of you.

 

Si

Attachments

Outcomes