ACIS SAT/SAB parsing experiments for CadQuery
Project description
cq-acis
Parse ACIS SAT/SAB data and convert the supported analytic B-rep subset to CadQuery/OpenCascade shapes.
日本語版: README.ja.md
This project is experimental. ACIS SAT versions and producer-specific records vary, so unsupported entities are preserved as raw records and conversion fails explicitly when an exact shape cannot be built.
Features
- SAT container detection and ASCII record framing
- Legacy one-line and modern three-line SAT headers
- Counted
@<length>strings used by SAT 7 and later - SAB and Autodesk ShapeManager SAB preamble detection
- Entity-reference graph validation for
$npointers - Typed decoding for SAT save versions 105, 400, 600, and 700
- Typed topology and analytic geometry entities:
body,lump,shell,face,loop,coedge,edge,vertex,point,straight-curve,ellipse-curve,plane-surface,cone-surface, andtransform - Exact CadQuery conversion for line, circular/elliptical edge, plane, cylindrical, and circular-conical geometry
- Splitting of non-manifold ACIS shells into valid CadQuery solids and compounds
- Preservation of unsupported records as
RawEntity
Elliptical cones, elliptical cylinders, sheared placements, and unsupported surface/curve types are rejected rather than approximated.
Installation
The CadQuery converter is installed with the default dependencies:
python -m pip install cq-acis
For a source checkout:
python -m pip install -e .
Quick start
Parse SAT records and resolve topology references:
from cq_acis import BodyEntity, parse_sat_model
with open("model.sat", "rb") as source:
model = parse_sat_model(source.read())
for body in model.bodies():
assert isinstance(body, BodyEntity)
lump = model.resolve(body.lump)
print(body.index, lump.index if lump else None)
Convert the bodies to a CadQuery Workplane:
from cq_acis import import_sat_file
result = import_sat_file("model.sat")
shape = result.val()
assert shape.isValid()
print(shape.Volume())
Example and visual inspection
examples/parse_sat.py parses a SAT file, prints body
statistics, and exports STEP, STL, and SVG files.
PYTHONPATH=src python examples/parse_sat.py
PYTHONPATH=src python examples/parse_sat.py path/to/model.sat \
--output-dir /tmp/cq-acis-output
Open the generated STL or STEP in any 3D CAD viewer. With the optional
ocp_vscode viewer installed, try:
PYTHONPATH=src python examples/parse_sat.py --show
Supported entities and conversion scope
The parser currently has typed support for:
body, lump, shell, face, loop, coedge, edge, vertex,
point, straight-curve, ellipse-curve,
plane-surface, cone-surface, transform
Typed support does not imply that every entity can already be converted to a
CadQuery shape. Conversion is exact-only and raises CadQueryConversionError
for unsupported geometry.
Development corpus
The pinned development corpus is not included in the Python wheel. It is kept
in this repository for parser and conversion regression tests. Sources,
upstream commits, and SHA-1 values are recorded in
corpus/sources.lock.json; downloaded file hashes
and SAT metadata are recorded in
corpus/manifest.jsonl.
python scripts/fetch_corpus.py
python scripts/fetch_corpus.py --check
Review corpus/README.md and corpus/licenses/ before
redistributing third-party files.
Testing
Run the full test suite from a source checkout:
PYTHONPATH=src python -m unittest discover -s tests -v
The pinned corpus currently covers 25 artifacts, including 23 SAT files and 2 SAB files. CadQuery regression tests convert 23 SAT artifacts and 147 bodies.
Project status
The package is under active development. The public API and supported SAT subset may change while broader producer/version coverage is added.
License
The project code is licensed under the MIT License. Third-party
corpus files have separate notices under corpus/licenses/;
consult those notices before redistribution.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cq_acis-0.1.0.tar.gz.
File metadata
- Download URL: cq_acis-0.1.0.tar.gz
- Upload date:
- Size: 27.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93254a791ae634782a7bc0270b4da7e721598be7c6b6fb7a512e71a78c67702f
|
|
| MD5 |
1c6ed786036b5e63bd8212caa6055ff7
|
|
| BLAKE2b-256 |
520a853f7e8d884ccbfe270f47d67eb0a7c56da4547cfd1e9143aef50b4584a8
|
File details
Details for the file cq_acis-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cq_acis-0.1.0-py3-none-any.whl
- Upload date:
- Size: 23.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e82f1e325d0a5ab53c47a9c3a0df80d78cd47bb19c318f3f3996413a33112f4
|
|
| MD5 |
fec4ec1560eb6bc19986c768752c1c6d
|
|
| BLAKE2b-256 |
526d4496cdf2fec79c1050e4bce9f7e45cad3c5690cf4713b8b32848346ba173
|