Instead of opening each part from the assembly, I made a macro to go through a directory and open each SLDPRT.
Then it creates a property for X, Y, and Z lengths, where X is always the longest dimension and Z is always the shortest.
Next it changes the color of the part based on its thickness (Z dimension).
After that, it creates a coordinate system at the corner, oriented appropriately.
Finally, it exports an IGES file using the new coordinate system.
It would have been nice to have beeen able to do this from the assembly, but that process seems buggy using VBA - especially when you get several hundred parts and dozens of subassembly layers.
I'd post it, but I don't know how. At any rate, it could use some refining.
Please provide the macro that computes the bounding box for each component in an assembly.
I haven't had time to check in in a while. I post what I made when I get back to the office.
I'm certain this could be cleaned up; I am not a programmer.
I have almost no error checking.
If you improve this, please share your improvements.
How this works:
1) Put your assembly and part files (or copies) in one specific directory.
I) Only files in this directory will be modified.
II) All SLDPRT files in this directory will be modified.
a) A new coordinate system will be added at X,Y,Z
b) Part colors will be changed according to thickness (smallest dimension).
i) The smallest dimension is always "Z".
ii) The largest dimension is always "X".
iii) If a thickness doesn't fit the list, the part will be black.
III) Exported files will be saved to this directory.
2) Open SolidWorks.
3) Run "ModifyParts.swp"
4) Browse to the folder location in step 1.
5) Choose whether you want to additionally export all parts as...
6) Choose whether you want to additionally change the units of all parts to...
7) Hit the Run button.
ModifyParts.swp.zip 64.7 KB