Skip to content

Profiling SOLIDWORKS 2015+ SLDPRT/SLDASM without SOLIDWORKS: swformat reads metadata, component tree; TraceParts files recognisable by component paths

TL;DR.

Modern SOLIDWORKS files are a chunked container (marker 14 00 06 00 08 00 at offset 12), so olefile fails; KenM76/swformat (Apache-2.0, git install) returns doc metadata, custom props, configurations and assembly component trees in under a second per file. Portal-generated files carry C:\TPO v2\SharedFS\Outgoing\ paths.

Context: inventorying ~800 SLDPRT/SLDASM files on macOS without a SOLIDWORKS licence, for a dataset data sheet.

Facts verified (SOLIDWORKS internal versions 8000, 10000, 18000):

  • Files saved by SOLIDWORKS 2015 and later are NOT OLE2 compound documents. There is no D0 CF 11 E0 signature anywhere; the first 8 bytes vary per file and bytes 12..17 are 14 00 06 00 08 00. olefile raises on them. Searching the raw bytes for UTF-16 strings finds almost nothing (streams are deflated), so grep-style provenance probes that work on DWG do not work here.
  • swformat (https://github.com/KenM76/swformat, Apache-2.0, not on PyPI) reads the modern container in pure Python. Install for a one-off: uv run --with "swformat @ git+https://github.com/KenM76/swformat" python script.py (~5 s first time). Useful calls:
    • swformat.tools.sw_docinfo.read_doc_metadata(path) -> DocMetadata(last_modified_by, created, modified, application='SOLIDWORKS', app_version='23.0000', company, total_edit_minutes, ...) (the Office-style summary properties).
    • swformat.api.metadata.read_metadata(path) -> dict with doc_type ('part'|'assembly'), properties (custom properties; TraceParts files carry SUPPLIER, REFERENCE, DESIGN plus opaque attr_<hex> keys), material, configurations, dimensions (named sketch dimensions with values), keyword_index_counts.
    • swformat.api.components.read_component_tree(path) on an SLDASM -> list of Component(name, path, config, hidden, suppressed, virtual, transform, bounding_box, model_ref); path is the absolute path on the authoring machine, so missing-reference checks and provenance (vendor library folders like ...\SKF\7000\...) come for free.
    • swformat.compat.check_supported(path, warn=False) -> (internal_version, status); it emits UntestedVersionWarning for versions outside [11000, 15000, 19000] but the reads above still worked at 8000/10000/18000.
    • No geometry: no bounding box of the part itself, no body count. For display meshes you need sldkit/cad3d-ir-sldprt, which are PolyForm Noncommercial (unusable for commercial profiling).
  • Files downloaded from TraceParts are generated on the fly; their assembly component paths all read C:\TPO v2\SharedFS\Outgoing\<part>.SLDPRT and child parts are numbered <slug>_01..NN.SLDPRT. Folder names of the form <9-digit id>-<format code>-<slug> (code 7 = SOLIDWORKS, 19/3 = STEP, 270/271/36 = DWG) are the portal's download record. That signature is enough to classify a batch as catalog downloads rather than an engineering firm's own models, which matters for redistribution rights.
No signals yet