openskp 0.1.0__py3-none-any.whl

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.
openskp/__init__.py ADDED
@@ -0,0 +1,47 @@
1
+ """OpenSKP — Open-source SketchUp binary file parser.
2
+
3
+ This is the public entry point for the ``openskp`` package. Import
4
+ :class:`SkpFile` to open and parse ``.skp`` files, and :class:`SkpModel`
5
+ to work with the resulting data.
6
+
7
+ Example::
8
+
9
+ from openskp import SkpFile
10
+
11
+ skp = SkpFile.open("building.skp")
12
+ model = skp.parse()
13
+
14
+ for layer in model.layers:
15
+ print(layer.name)
16
+ """
17
+
18
+ from __future__ import annotations
19
+
20
+ from .model import SkpFile, SkpModel
21
+
22
+ __version__: str = "0.1.0"
23
+ __all__: list[str] = ["SkpFile", "SkpModel", "__version__"]
24
+
25
+
26
+ def main() -> None:
27
+ """CLI entry point (placeholder).
28
+
29
+ Prints version information. A richer CLI may be added in future
30
+ releases.
31
+ """
32
+ import sys
33
+
34
+ print(f"openskp {__version__}")
35
+ if len(sys.argv) > 1:
36
+ filepath = sys.argv[1]
37
+ try:
38
+ skp = SkpFile.open(filepath)
39
+ model = skp.parse()
40
+ print(f"Version: {model.version}")
41
+ print(f"Definitions: {len(model.definitions)}")
42
+ print(f"Layers: {len(model.layers)}")
43
+ print(f"Materials: {len(model.materials)}")
44
+ print(f"Instances: {len(model.scene_hierarchy)}")
45
+ except Exception as exc:
46
+ print(f"Error: {exc}", file=sys.stderr)
47
+ sys.exit(1)