Solidworks .sldprt file format

1822 views
Skip to first unread message

Bryan Bishop

unread,
Jan 12, 2010, 12:21:40 PM1/12/10
to Open Manufacturing, kan...@gmail.com
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

Mike Slouka

unread,
Aug 21, 2015, 3:24:18 PM8/21/15
to Open Manufacturing, kan...@gmail.com

It's 5 years later. Have you gotten any farther on this?
What was your goal?
My goal is to edit the sldprt file and update features, parameters and such then save the file.
Later I want to be able to open it in edrawing or solidworks.

Currently I open the file in Solidworks, and through VbScript and other means I update features and parameters.
The problem is that it is too slow. It takes about 60-90 seconds to complete. I want to do it in under 5 seconds.

Mike

Bryan Bishop

unread,
Aug 21, 2015, 3:25:36 PM8/21/15
to Mike Slouka, Bryan Bishop, Open Manufacturing
On Fri, Aug 21, 2015 at 2:21 PM, Mike Slouka <slouk...@gmail.com> wrote:
It's 5 years later. Have you gotten any farther on this?

Nope, I haven't looked into this since then. I also don't know anyone who is currently trying. In the mean time I suggest looking at verbnurbs or solvespace as possibly-usable alternatives to SolidWorks. I would be happy to take this up in the future, but at the moment I have no pressing need to know the file format for SolidWorks models...

praj...@gmail.com

unread,
Oct 14, 2015, 3:49:30 PM10/14/15
to Open Manufacturing, slouk...@gmail.com, kan...@gmail.com
Hey Bryan, 
   I've been working on this, too. Your design files link in the original post seems broken. Is it possible for you to reupload or maybe send me an email with these files? They'll be a huge step ahead for me in this direction. 

Thanks,
Prasanna.

Bryan Bishop

unread,
Oct 14, 2015, 3:50:26 PM10/14/15
to praj...@gmail.com, Bryan Bishop, Open Manufacturing, Mike Slouka
On Wed, Oct 14, 2015 at 2:47 PM, <praj...@gmail.com> wrote:
> Your design files link in the original post seems broken

http://diyhpl.us/~bryan/irc/solidworks/sw-reverser.zip

praj...@gmail.com

unread,
Oct 14, 2015, 3:55:29 PM10/14/15
to Open Manufacturing, praj...@gmail.com, kan...@gmail.com, slouk...@gmail.com
That was quick. Thanks! Will post updates to this thread. 

Yilong Fan

unread,
Nov 21, 2018, 7:41:57 PM11/21/18
to Open Manufacturing
Hi Mike

How did your project go?

I am looking into this because I want to get a hash of a file to check whether a file has been updated.

But the hash changes every time you save it.

I assume there might be a timestamp inside the file, therefore I was looking into unpacking the file and only hashing the 3d model.

In regards to your project, you can run solidworks without solidworks showing, because solidworks does not have to work out display, it would be quicker that way.

Sean
Reply all
Reply to author
Forward
0 new messages