join the discussion

over here.
Go back to the main page.
Go back to the "extra" page.

Hey all,

I've been looking at the .sldprt file format off-and-on for a few
months now. I thought I'd share some notes on what it is and how to
get the data out of it.

http://en.wikipedia.org/wiki/SolidWorks#File_format
"SolidWorks files use the Microsoft Structured storage file format.
This means that there are various files embedded within each SLDDRW,
SLDPRT, SLDASM file, including preview bitmaps and metadata sub-files.
Various third-party tools (see Structured storage) can be used to
extract these sub-files, although the subfiles in many cases use
proprietary binary file formats."

COM structured storage
OLE structured storage

So, on debian, if you wanted to make preview images for thumbnails in
a file browser for .sldprt, .sldasm, and .slddrw files, you can do
something like this:

sudo apt-get install libgsf-bin
gsf cat mydrawingfile.SLDDRW PreviewPNG > preview.png && eog preview.png

You can also use the gsf tool to extract the "display list", which is
where the juicy information on the model is. I haven't been able to
figure that out yet. It usually has a name like
Contents/DisplayLists__ZLB and presumably ZLB is some sort of format,
extension, etc. To see an overview of all the sections of the .sldprt
file, you can run "gsf list blah.sldprt" and hack away.

On windows, you can use the win32com library in python to access
Solidworks and convert to 3dxml (or any other format) like so:

#url: http://win32com.goermezer.de/content/view/231/291/
import win32com.client
app=win32com.client.Dispatch("SldWorks.Application")
doc=app.OpenDoc("c:\\Testpart.SLDPRT", 1)
doc.SaveAs2("c:\\Testpart.3dxml", 0, True, False)

Some good that does for the linux folks. Not sure how to run that
under wine successfully. I remember reading about a way to load up
DLLs into python, but this is again Windows only, but I don't see any
particular reason why wine couldn't be used in there somewhere to
facilitate python using a DLL while running under linux.

As a resource to help break the file format, I made a series of files
that started off with nothing, and moved up to basic primitive
geometries, and eventually 3D extruded shapes and so on. At each step,
I was using Solidworks to save the file in as many formats as I could
imagine. You can find the archive on the web here:

http://designfiles.org/~bryan/sw-reverser.zip (8.4 MB)

Helpful links:
http://en.wikipedia.org/wiki/SolidWorks#File_format
http://www.winehq.org/pipermail/wine-devel/2002-January/003468.html
http://pole.berlios.de/
http://download.berlios.de/pole/pole-0.2.tar.gz
http://mail.gnome.org/archives/nautilus-list/2008-March/msg00038.html
Parasolid-XT-format-reference.pdf

- Bryan
http://heybryan.org/
1 512 203 0507