cq-acis 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
cq_acis-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 cq-acis contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
cq_acis-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,175 @@
1
+ Metadata-Version: 2.4
2
+ Name: cq-acis
3
+ Version: 0.1.0
4
+ Summary: ACIS SAT/SAB parsing experiments for CadQuery
5
+ License: MIT License
6
+
7
+ Copyright (c) 2026 cq-acis contributors
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
26
+
27
+ Requires-Python: >=3.10
28
+ Description-Content-Type: text/markdown
29
+ License-File: LICENSE
30
+ Requires-Dist: cadquery>=2.4
31
+ Dynamic: license-file
32
+
33
+ # cq-acis
34
+
35
+ Parse ACIS SAT/SAB data and convert the supported analytic B-rep subset to
36
+ CadQuery/OpenCascade shapes.
37
+
38
+ 日本語版: [README.ja.md](README.ja.md)
39
+
40
+ > This project is experimental. ACIS SAT versions and producer-specific
41
+ > records vary, so unsupported entities are preserved as raw records and
42
+ > conversion fails explicitly when an exact shape cannot be built.
43
+
44
+ ## Features
45
+
46
+ - SAT container detection and ASCII record framing
47
+ - Legacy one-line and modern three-line SAT headers
48
+ - Counted `@<length>` strings used by SAT 7 and later
49
+ - SAB and Autodesk ShapeManager SAB preamble detection
50
+ - Entity-reference graph validation for `$n` pointers
51
+ - Typed decoding for SAT save versions 105, 400, 600, and 700
52
+ - Typed topology and analytic geometry entities:
53
+ `body`, `lump`, `shell`, `face`, `loop`, `coedge`, `edge`, `vertex`,
54
+ `point`, `straight-curve`, `ellipse-curve`, `plane-surface`,
55
+ `cone-surface`, and `transform`
56
+ - Exact CadQuery conversion for line, circular/elliptical edge, plane,
57
+ cylindrical, and circular-conical geometry
58
+ - Splitting of non-manifold ACIS shells into valid CadQuery solids and
59
+ compounds
60
+ - Preservation of unsupported records as `RawEntity`
61
+
62
+ Elliptical cones, elliptical cylinders, sheared placements, and unsupported
63
+ surface/curve types are rejected rather than approximated.
64
+
65
+ ## Installation
66
+
67
+ The CadQuery converter is installed with the default dependencies:
68
+
69
+ ```bash
70
+ python -m pip install cq-acis
71
+ ```
72
+
73
+ For a source checkout:
74
+
75
+ ```bash
76
+ python -m pip install -e .
77
+ ```
78
+
79
+ ## Quick start
80
+
81
+ Parse SAT records and resolve topology references:
82
+
83
+ ```python
84
+ from cq_acis import BodyEntity, parse_sat_model
85
+
86
+ with open("model.sat", "rb") as source:
87
+ model = parse_sat_model(source.read())
88
+
89
+ for body in model.bodies():
90
+ assert isinstance(body, BodyEntity)
91
+ lump = model.resolve(body.lump)
92
+ print(body.index, lump.index if lump else None)
93
+ ```
94
+
95
+ Convert the bodies to a CadQuery `Workplane`:
96
+
97
+ ```python
98
+ from cq_acis import import_sat_file
99
+
100
+ result = import_sat_file("model.sat")
101
+ shape = result.val()
102
+ assert shape.isValid()
103
+ print(shape.Volume())
104
+ ```
105
+
106
+ ## Example and visual inspection
107
+
108
+ [`examples/parse_sat.py`](examples/parse_sat.py) parses a SAT file, prints body
109
+ statistics, and exports STEP, STL, and SVG files.
110
+
111
+ ```bash
112
+ PYTHONPATH=src python examples/parse_sat.py
113
+ PYTHONPATH=src python examples/parse_sat.py path/to/model.sat \
114
+ --output-dir /tmp/cq-acis-output
115
+ ```
116
+
117
+ Open the generated STL or STEP in any 3D CAD viewer. With the optional
118
+ `ocp_vscode` viewer installed, try:
119
+
120
+ ```bash
121
+ PYTHONPATH=src python examples/parse_sat.py --show
122
+ ```
123
+
124
+ ## Supported entities and conversion scope
125
+
126
+ The parser currently has typed support for:
127
+
128
+ ```text
129
+ body, lump, shell, face, loop, coedge, edge, vertex,
130
+ point, straight-curve, ellipse-curve,
131
+ plane-surface, cone-surface, transform
132
+ ```
133
+
134
+ Typed support does not imply that every entity can already be converted to a
135
+ CadQuery shape. Conversion is exact-only and raises `CadQueryConversionError`
136
+ for unsupported geometry.
137
+
138
+ ## Development corpus
139
+
140
+ The pinned development corpus is not included in the Python wheel. It is kept
141
+ in this repository for parser and conversion regression tests. Sources,
142
+ upstream commits, and SHA-1 values are recorded in
143
+ [`corpus/sources.lock.json`](corpus/sources.lock.json); downloaded file hashes
144
+ and SAT metadata are recorded in
145
+ [`corpus/manifest.jsonl`](corpus/manifest.jsonl).
146
+
147
+ ```bash
148
+ python scripts/fetch_corpus.py
149
+ python scripts/fetch_corpus.py --check
150
+ ```
151
+
152
+ Review [`corpus/README.md`](corpus/README.md) and `corpus/licenses/` before
153
+ redistributing third-party files.
154
+
155
+ ## Testing
156
+
157
+ Run the full test suite from a source checkout:
158
+
159
+ ```bash
160
+ PYTHONPATH=src python -m unittest discover -s tests -v
161
+ ```
162
+
163
+ The pinned corpus currently covers 25 artifacts, including 23 SAT files and 2
164
+ SAB files. CadQuery regression tests convert 23 SAT artifacts and 147 bodies.
165
+
166
+ ## Project status
167
+
168
+ The package is under active development. The public API and supported SAT
169
+ subset may change while broader producer/version coverage is added.
170
+
171
+ ## License
172
+
173
+ The project code is licensed under the [MIT License](LICENSE). Third-party
174
+ corpus files have separate notices under [`corpus/licenses/`](corpus/licenses/);
175
+ consult those notices before redistribution.
@@ -0,0 +1,143 @@
1
+ # cq-acis
2
+
3
+ Parse ACIS SAT/SAB data and convert the supported analytic B-rep subset to
4
+ CadQuery/OpenCascade shapes.
5
+
6
+ 日本語版: [README.ja.md](README.ja.md)
7
+
8
+ > This project is experimental. ACIS SAT versions and producer-specific
9
+ > records vary, so unsupported entities are preserved as raw records and
10
+ > conversion fails explicitly when an exact shape cannot be built.
11
+
12
+ ## Features
13
+
14
+ - SAT container detection and ASCII record framing
15
+ - Legacy one-line and modern three-line SAT headers
16
+ - Counted `@<length>` strings used by SAT 7 and later
17
+ - SAB and Autodesk ShapeManager SAB preamble detection
18
+ - Entity-reference graph validation for `$n` pointers
19
+ - Typed decoding for SAT save versions 105, 400, 600, and 700
20
+ - Typed topology and analytic geometry entities:
21
+ `body`, `lump`, `shell`, `face`, `loop`, `coedge`, `edge`, `vertex`,
22
+ `point`, `straight-curve`, `ellipse-curve`, `plane-surface`,
23
+ `cone-surface`, and `transform`
24
+ - Exact CadQuery conversion for line, circular/elliptical edge, plane,
25
+ cylindrical, and circular-conical geometry
26
+ - Splitting of non-manifold ACIS shells into valid CadQuery solids and
27
+ compounds
28
+ - Preservation of unsupported records as `RawEntity`
29
+
30
+ Elliptical cones, elliptical cylinders, sheared placements, and unsupported
31
+ surface/curve types are rejected rather than approximated.
32
+
33
+ ## Installation
34
+
35
+ The CadQuery converter is installed with the default dependencies:
36
+
37
+ ```bash
38
+ python -m pip install cq-acis
39
+ ```
40
+
41
+ For a source checkout:
42
+
43
+ ```bash
44
+ python -m pip install -e .
45
+ ```
46
+
47
+ ## Quick start
48
+
49
+ Parse SAT records and resolve topology references:
50
+
51
+ ```python
52
+ from cq_acis import BodyEntity, parse_sat_model
53
+
54
+ with open("model.sat", "rb") as source:
55
+ model = parse_sat_model(source.read())
56
+
57
+ for body in model.bodies():
58
+ assert isinstance(body, BodyEntity)
59
+ lump = model.resolve(body.lump)
60
+ print(body.index, lump.index if lump else None)
61
+ ```
62
+
63
+ Convert the bodies to a CadQuery `Workplane`:
64
+
65
+ ```python
66
+ from cq_acis import import_sat_file
67
+
68
+ result = import_sat_file("model.sat")
69
+ shape = result.val()
70
+ assert shape.isValid()
71
+ print(shape.Volume())
72
+ ```
73
+
74
+ ## Example and visual inspection
75
+
76
+ [`examples/parse_sat.py`](examples/parse_sat.py) parses a SAT file, prints body
77
+ statistics, and exports STEP, STL, and SVG files.
78
+
79
+ ```bash
80
+ PYTHONPATH=src python examples/parse_sat.py
81
+ PYTHONPATH=src python examples/parse_sat.py path/to/model.sat \
82
+ --output-dir /tmp/cq-acis-output
83
+ ```
84
+
85
+ Open the generated STL or STEP in any 3D CAD viewer. With the optional
86
+ `ocp_vscode` viewer installed, try:
87
+
88
+ ```bash
89
+ PYTHONPATH=src python examples/parse_sat.py --show
90
+ ```
91
+
92
+ ## Supported entities and conversion scope
93
+
94
+ The parser currently has typed support for:
95
+
96
+ ```text
97
+ body, lump, shell, face, loop, coedge, edge, vertex,
98
+ point, straight-curve, ellipse-curve,
99
+ plane-surface, cone-surface, transform
100
+ ```
101
+
102
+ Typed support does not imply that every entity can already be converted to a
103
+ CadQuery shape. Conversion is exact-only and raises `CadQueryConversionError`
104
+ for unsupported geometry.
105
+
106
+ ## Development corpus
107
+
108
+ The pinned development corpus is not included in the Python wheel. It is kept
109
+ in this repository for parser and conversion regression tests. Sources,
110
+ upstream commits, and SHA-1 values are recorded in
111
+ [`corpus/sources.lock.json`](corpus/sources.lock.json); downloaded file hashes
112
+ and SAT metadata are recorded in
113
+ [`corpus/manifest.jsonl`](corpus/manifest.jsonl).
114
+
115
+ ```bash
116
+ python scripts/fetch_corpus.py
117
+ python scripts/fetch_corpus.py --check
118
+ ```
119
+
120
+ Review [`corpus/README.md`](corpus/README.md) and `corpus/licenses/` before
121
+ redistributing third-party files.
122
+
123
+ ## Testing
124
+
125
+ Run the full test suite from a source checkout:
126
+
127
+ ```bash
128
+ PYTHONPATH=src python -m unittest discover -s tests -v
129
+ ```
130
+
131
+ The pinned corpus currently covers 25 artifacts, including 23 SAT files and 2
132
+ SAB files. CadQuery regression tests convert 23 SAT artifacts and 147 bodies.
133
+
134
+ ## Project status
135
+
136
+ The package is under active development. The public API and supported SAT
137
+ subset may change while broader producer/version coverage is added.
138
+
139
+ ## License
140
+
141
+ The project code is licensed under the [MIT License](LICENSE). Third-party
142
+ corpus files have separate notices under [`corpus/licenses/`](corpus/licenses/);
143
+ consult those notices before redistribution.
@@ -0,0 +1,19 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "cq-acis"
7
+ version = "0.1.0"
8
+ description = "ACIS SAT/SAB parsing experiments for CadQuery"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ dependencies = ["cadquery>=2.4"]
12
+ license = {file = "LICENSE"}
13
+
14
+ [tool.setuptools.packages.find]
15
+ where = ["src"]
16
+
17
+ [tool.pytest.ini_options]
18
+ pythonpath = ["src"]
19
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,107 @@
1
+ """Low-level ACIS container and SAT parsing helpers."""
2
+
3
+ from .sat import (
4
+ AcisContainer,
5
+ SatDocument,
6
+ SatHeader,
7
+ SatParseError,
8
+ SatRecord,
9
+ detect_container,
10
+ iter_sat_records,
11
+ parse_sat,
12
+ parse_sat_header,
13
+ )
14
+ from .tokens import CountedString, EntityRef, NULL_REF, SatToken, tokenize_record
15
+ from .graph import (
16
+ RawEntity,
17
+ SatEntityGraph,
18
+ SatGraphError,
19
+ build_entity_graph,
20
+ parse_sat_graph,
21
+ )
22
+ from .entities import (
23
+ SUPPORTED_ENTITY_TYPES,
24
+ BodyEntity,
25
+ ConeSurfaceEntity,
26
+ CoedgeEntity,
27
+ DecodedEntity,
28
+ EdgeEntity,
29
+ EllipseCurveEntity,
30
+ EntityDecodeError,
31
+ FaceEntity,
32
+ LoopEntity,
33
+ LumpEntity,
34
+ ParameterRange,
35
+ PlaneSurfaceEntity,
36
+ PointEntity,
37
+ SatModel,
38
+ ShellEntity,
39
+ StraightCurveEntity,
40
+ TransformEntity,
41
+ Vec3,
42
+ VertexEntity,
43
+ decode_entity,
44
+ decode_sat_model,
45
+ parse_sat_model,
46
+ )
47
+ from .cadquery import (
48
+ CadQueryConversionError,
49
+ CadQueryConverter,
50
+ CadQueryDependencyError,
51
+ convert_sat_model,
52
+ import_sat_data,
53
+ import_sat_file,
54
+ to_cadquery,
55
+ )
56
+
57
+ __all__ = [
58
+ "AcisContainer",
59
+ "BodyEntity",
60
+ "CadQueryConversionError",
61
+ "CadQueryConverter",
62
+ "CadQueryDependencyError",
63
+ "ConeSurfaceEntity",
64
+ "CoedgeEntity",
65
+ "CountedString",
66
+ "DecodedEntity",
67
+ "EdgeEntity",
68
+ "EllipseCurveEntity",
69
+ "EntityDecodeError",
70
+ "EntityRef",
71
+ "FaceEntity",
72
+ "LoopEntity",
73
+ "LumpEntity",
74
+ "NULL_REF",
75
+ "ParameterRange",
76
+ "PlaneSurfaceEntity",
77
+ "PointEntity",
78
+ "RawEntity",
79
+ "SUPPORTED_ENTITY_TYPES",
80
+ "SatDocument",
81
+ "SatEntityGraph",
82
+ "SatGraphError",
83
+ "SatHeader",
84
+ "SatModel",
85
+ "SatParseError",
86
+ "SatRecord",
87
+ "SatToken",
88
+ "ShellEntity",
89
+ "StraightCurveEntity",
90
+ "TransformEntity",
91
+ "Vec3",
92
+ "VertexEntity",
93
+ "build_entity_graph",
94
+ "convert_sat_model",
95
+ "decode_entity",
96
+ "decode_sat_model",
97
+ "detect_container",
98
+ "iter_sat_records",
99
+ "import_sat_data",
100
+ "import_sat_file",
101
+ "parse_sat",
102
+ "parse_sat_graph",
103
+ "parse_sat_header",
104
+ "parse_sat_model",
105
+ "tokenize_record",
106
+ "to_cadquery",
107
+ ]