Metadata-Version: 2.4
Name: sldprt2xt
Version: 1.2.0
Summary: Extraire la géométrie Parasolid (.x_t) d'un fichier SolidWorks (.SLDPRT), sans SolidWorks
Author: Emilien-Etadam
License-Expression: AGPL-3.0-only
Keywords: solidworks,sldprt,parasolid,x_t,cad,convert
Classifier: Environment :: Console
Classifier: Intended Audience :: Manufacturing
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Multimedia :: Graphics :: 3D Modeling
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: NOTICE
Requires-Dist: olefile>=0.47
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == "dev"
Requires-Dist: ruff>=0.5; extra == "dev"
Dynamic: license-file

🇫🇷 [Version française](README.fr.md)

# sldprt2xt

Gets the geometry out of a SolidWorks file. Without SolidWorks.

`part.SLDPRT` → `part.x_t`, a Parasolid file.
## Install

```sh
pip install sldprt2xt
```

## Use

```sh
sldprt2xt part.SLDPRT
```

That writes `part.x_t` right next to it. That's all.

Somewhere else:

```sh
sldprt2xt part.SLDPRT -o output/
```

Several files:

```sh
sldprt2xt *.SLDPRT -o output/
```

A whole folder, subfolders included — the tree structure is mirrored in the
output, and SolidWorks lock files (`~$part.SLDPRT`) are ignored:

```sh
sldprt2xt my_parts/ -o output/
```

From Python:

```python
from sldprt2xt import to_x_t

to_x_t("part.SLDPRT")             # writes part.x_t
to_x_t("part.SLDPRT", "output/")  # elsewhere — the folder is created if needed
```

Every failure raises `ConversionError` (or `SchemasNotFound`), with a message
that says what to do. Writes are atomic: never a truncated file under its
final name.

## The tables are built in

A Parasolid file cannot be read without a table saying which fields each node
type carries. **This package states the facts of those tables itself**
(`schema_facts.py`): every SolidWorks version known at its release — 2003
through 2026 — converts with nothing else installed.

Only two cases where you provide anything:

- **a SolidWorks version newer than this package**, for a multi-body part.
  Three ways out, from simplest to most manual: update the package; hand over
  a multi-body `.x_t` exported by the same SolidWorks (`--donor part.x_t` —
  the tool learns what it is missing from it); or point `--schemas` at the
  `pschema` folder of an installation.
- **your own schema files**, if you prefer: a supplied folder always takes
  precedence over the built-in tables (`--schemas`, or the `P_SCHEMA`
  variable Parasolid itself consults — a local SolidWorks installation is
  found on its own anyway).

## What comes out

Every body in the part, with its colours. The geometry is **the file's own,
transcribed** — nothing is rebuilt, nothing is approximated.


**What is *not* transmitted, and why it matters.** A SolidWorks partition
carries far more than geometry: permanent identifiers for every edge and face,
body recipes, time stamps, the id of the last feature that touched a body.
Those mean something only inside SolidWorks' own model, and its export never
transmits them — **it refuses to read a transmit that carries them**. Measured
on a 49-body part: 31 attribute definitions written where its own export keeps
7, and the file would not open. Since 1.2.0 they are left behind, and the
result opens as a multi-body part with its colours intact.

> **If you are on 1.1.0, upgrade.** It writes files SolidWorks declines with
> *"The data in this file may be invalid"*, and where an older version does
> open one, it opens as an assembly of N components rather than a part with N
> bodies — a mark on the assembly root was missing too.

## What opens the `.x_t`

Software built on the Parasolid kernel: SolidWorks, NX, Solid Edge,
Fusion 360, Onshape, Rhino, Plasticity…

**Not FreeCAD** — nor anything built on OpenCASCADE. There is no free
Parasolid reader; that is precisely why this tool exists. The open-source
chain needs STEP, and producing STEP is a different job — rebuilding the
geometry in a kernel rather than transcribing it — which this tool
deliberately does not do.

That other job is being worked on separately and is not released yet. When it
is, expect it to say body by body what it managed — because a rebuild is not a
transcription, and only one of the two can be checked against the file.

## What it works on

`.SLDPRT` files from SolidWorks 2003 through 2026, both generations of the
file format.

Linux, macOS, Windows. Python 3.10 or later.

## License

AGPL-3.0. See [LICENSE](LICENSE).

Parasolid is a trademark of Siemens Industry Software Inc., SolidWorks a
trademark of Dassault Systèmes. This project is affiliated with neither.
