Convert Solidworks Assembly Drawing to AutoCAD layout

Hi,
In an old thread called "Re: Which addin do you need" (dated April
2003) I asked for a macro that would put every component in a
Solidworks wireframe assembly drawing on a different layer. The
drawing could then be saved as an AutoCAD dwg file, and worked on in
AutoCAD in the traditional way.
The good news is that I finally discovered the macro. If you go to:
formatting link

...there is a visual basic file called:
"How to put all assembly components in a drawing view on different
layers".
If you cut and paste the contents of this file into an empty
Solidworks Macro, then follow the instructions in the file, it should
work out fine.
There appears to be a double up in layer names if the same part is
used in multiple assemblies. It would also be nice to have a random
colour assigned to each layer. If anyone knows how to do either of
these, please post.
Regards,
Anthony
Reply to
Anthony Honeyfield
Loading thread data ...
Done. Check "Layout.swp" on
formatting link
and click the "Donate" button too, please ...
Reply to
Philippe Guglielmetti
I guess this works on SWX2004, and not previous releases?
Reply to
Michael Rice
"Michael Rice" wrote
May I ask why you "guess" so instead of trying ? It works perfectly on SW2003, and it should work even on SW2001+.
Reply to
Philippe Guglielmetti
Philippe,
Thanks for the link to your script.
I have tried the script (in SWx 2003) and found that it puts every part on the same layer, and in fact strips the layer name such that ABC-361-001 becomes layer name ABC.
The layer does seem to have a random colour assigned, though.
Any idea's what's wrong?
Thanks,
Anthony
Reply to
Anthony Honeyfield
Phillippe,
A bit more research has uncovered the following:
We use a naming convention whereby each part is given the name ABC-400-001 or similar. The 400 number refers to a process (ie. injection moulding, turning, etc) hence an assembly would consist of something like:
ABC-400-056 ABC-200-001 ABC-100-032
...and so on. Your script sees all of these as the same, and puts them on one layer called ABC. If I rename the parts as:
Fred Jane Sam
...the script works as intended.
How do you change the script to remove this sensitivity? I think our naming convention is quite common.
Regards,
Anthony
Reply to
Anthony Honeyfield
yes, sorrys, stupid mistake: just change the line : name = Left(name, InStr(name, "-") - 1) into: name = Left(name, InStrRev(name, "-") - 1)
or re-download the updated macro.
Part names weren't supposed to contain "-" characters as they mix with the "-1" "-2" ... SolidWorks adds to number components...
Reply to
Philippe Guglielmetti

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.