openskp 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.
openskp-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,110 @@
1
+ Metadata-Version: 2.4
2
+ Name: openskp
3
+ Version: 0.1.0
4
+ Summary: Open-source SketchUp (.skp) binary file parser — extract geometry, metadata, layers, and materials
5
+ Author: Ahsan Mehmood
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/iamahsanmehmood/openskp
8
+ Project-URL: Repository, https://github.com/iamahsanmehmood/openskp
9
+ Project-URL: Issues, https://github.com/iamahsanmehmood/openskp/issues
10
+ Keywords: sketchup,skp,3d,parser,glb,gltf,bim,cad
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Multimedia :: Graphics :: 3D Modeling
19
+ Classifier: Topic :: Scientific/Engineering
20
+ Requires-Python: >=3.9
21
+ Description-Content-Type: text/markdown
22
+ Requires-Dist: numpy>=1.20
23
+ Requires-Dist: trimesh>=3.0
24
+ Requires-Dist: shapely>=1.8
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest>=7.0; extra == "dev"
27
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
28
+
29
+ # OpenSKP — Python Package
30
+
31
+ Open-source SketchUp (`.skp`) binary file parser. Extract geometry, metadata,
32
+ layers, and materials from SketchUp files without requiring SketchUp itself.
33
+
34
+ ## Installation
35
+
36
+ ```bash
37
+ pip install openskp
38
+ ```
39
+
40
+ Or install from source:
41
+
42
+ ```bash
43
+ git clone https://github.com/iamahsanmehmood/openskp.git
44
+ cd openskp/packages/python
45
+ pip install -e .
46
+ ```
47
+
48
+ ## Quick Start
49
+
50
+ ```python
51
+ from openskp import SkpFile
52
+
53
+ # Parse an SKP file
54
+ skp = SkpFile.open("model.skp")
55
+ model = skp.parse()
56
+
57
+ # Inspect layers
58
+ for layer in model.layers:
59
+ print(f"{layer.name}: rgb({layer.color_r}, {layer.color_g}, {layer.color_b})")
60
+
61
+ # Inspect definitions (component geometry)
62
+ for defn in model.definitions.values():
63
+ print(f"{defn.name}: {len(defn.faces)} faces, {len(defn.vertices)} vertices")
64
+
65
+ # Inspect scene hierarchy
66
+ for inst in model.scene_hierarchy:
67
+ print(f" {inst.name} → definition #{inst.ref_idx}")
68
+ ```
69
+
70
+ ## Exporting
71
+
72
+ ```python
73
+ from openskp.export import glb, obj, json_export
74
+
75
+ # Export to GLB (glTF 2.0 binary)
76
+ glb.export(model, "output.glb")
77
+
78
+ # Export to Wavefront OBJ
79
+ obj.export(model, "output.obj")
80
+
81
+ # Export metadata as JSON
82
+ meta = json_export.to_dict(model)
83
+ json_export.export(model, "output.json")
84
+ ```
85
+
86
+ ## Package Structure
87
+
88
+ | Module | Purpose |
89
+ |---|---|
90
+ | `openskp.parser` | TLV binary parser for SketchUp's internal format |
91
+ | `openskp.model` | Dataclasses for geometry, layers, materials |
92
+ | `openskp.vff` | VFF/ZIP container handling |
93
+ | `openskp.geometry` | Geometry extraction from parsed nodes |
94
+ | `openskp.triangulator` | 3D planar polygon triangulation |
95
+ | `openskp.materials` | Material and layer XML parsing |
96
+ | `openskp.metadata` | Dynamic properties and scene hierarchy |
97
+ | `openskp.transforms` | 3D matrix transforms and coordinate conversion |
98
+ | `openskp.export` | GLB, OBJ, and JSON exporters |
99
+
100
+ ## Requirements
101
+
102
+ - Python ≥ 3.9
103
+ - NumPy ≥ 1.20
104
+ - Trimesh ≥ 3.0
105
+ - Shapely ≥ 1.8
106
+
107
+ ## License
108
+
109
+ MIT — see the [root repository](https://github.com/iamahsanmehmood/openskp) for
110
+ full documentation and multi-language packages.
@@ -0,0 +1,82 @@
1
+ # OpenSKP — Python Package
2
+
3
+ Open-source SketchUp (`.skp`) binary file parser. Extract geometry, metadata,
4
+ layers, and materials from SketchUp files without requiring SketchUp itself.
5
+
6
+ ## Installation
7
+
8
+ ```bash
9
+ pip install openskp
10
+ ```
11
+
12
+ Or install from source:
13
+
14
+ ```bash
15
+ git clone https://github.com/iamahsanmehmood/openskp.git
16
+ cd openskp/packages/python
17
+ pip install -e .
18
+ ```
19
+
20
+ ## Quick Start
21
+
22
+ ```python
23
+ from openskp import SkpFile
24
+
25
+ # Parse an SKP file
26
+ skp = SkpFile.open("model.skp")
27
+ model = skp.parse()
28
+
29
+ # Inspect layers
30
+ for layer in model.layers:
31
+ print(f"{layer.name}: rgb({layer.color_r}, {layer.color_g}, {layer.color_b})")
32
+
33
+ # Inspect definitions (component geometry)
34
+ for defn in model.definitions.values():
35
+ print(f"{defn.name}: {len(defn.faces)} faces, {len(defn.vertices)} vertices")
36
+
37
+ # Inspect scene hierarchy
38
+ for inst in model.scene_hierarchy:
39
+ print(f" {inst.name} → definition #{inst.ref_idx}")
40
+ ```
41
+
42
+ ## Exporting
43
+
44
+ ```python
45
+ from openskp.export import glb, obj, json_export
46
+
47
+ # Export to GLB (glTF 2.0 binary)
48
+ glb.export(model, "output.glb")
49
+
50
+ # Export to Wavefront OBJ
51
+ obj.export(model, "output.obj")
52
+
53
+ # Export metadata as JSON
54
+ meta = json_export.to_dict(model)
55
+ json_export.export(model, "output.json")
56
+ ```
57
+
58
+ ## Package Structure
59
+
60
+ | Module | Purpose |
61
+ |---|---|
62
+ | `openskp.parser` | TLV binary parser for SketchUp's internal format |
63
+ | `openskp.model` | Dataclasses for geometry, layers, materials |
64
+ | `openskp.vff` | VFF/ZIP container handling |
65
+ | `openskp.geometry` | Geometry extraction from parsed nodes |
66
+ | `openskp.triangulator` | 3D planar polygon triangulation |
67
+ | `openskp.materials` | Material and layer XML parsing |
68
+ | `openskp.metadata` | Dynamic properties and scene hierarchy |
69
+ | `openskp.transforms` | 3D matrix transforms and coordinate conversion |
70
+ | `openskp.export` | GLB, OBJ, and JSON exporters |
71
+
72
+ ## Requirements
73
+
74
+ - Python ≥ 3.9
75
+ - NumPy ≥ 1.20
76
+ - Trimesh ≥ 3.0
77
+ - Shapely ≥ 1.8
78
+
79
+ ## License
80
+
81
+ MIT — see the [root repository](https://github.com/iamahsanmehmood/openskp) for
82
+ full documentation and multi-language packages.
@@ -0,0 +1,49 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "openskp"
7
+ version = "0.1.0"
8
+ description = "Open-source SketchUp (.skp) binary file parser — extract geometry, metadata, layers, and materials"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ requires-python = ">=3.9"
12
+ authors = [{name = "Ahsan Mehmood"}]
13
+ keywords = ["sketchup", "skp", "3d", "parser", "glb", "gltf", "bim", "cad"]
14
+ classifiers = [
15
+ "Development Status :: 3 - Alpha",
16
+ "Intended Audience :: Developers",
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3.9",
19
+ "Programming Language :: Python :: 3.10",
20
+ "Programming Language :: Python :: 3.11",
21
+ "Programming Language :: Python :: 3.12",
22
+ "Topic :: Multimedia :: Graphics :: 3D Modeling",
23
+ "Topic :: Scientific/Engineering",
24
+ ]
25
+ dependencies = [
26
+ "numpy>=1.20",
27
+ "trimesh>=3.0",
28
+ "shapely>=1.8",
29
+ ]
30
+
31
+ [project.optional-dependencies]
32
+ dev = [
33
+ "pytest>=7.0",
34
+ "pytest-cov>=4.0",
35
+ ]
36
+
37
+ [project.urls]
38
+ Homepage = "https://github.com/iamahsanmehmood/openskp"
39
+ Repository = "https://github.com/iamahsanmehmood/openskp"
40
+ Issues = "https://github.com/iamahsanmehmood/openskp/issues"
41
+
42
+ [project.scripts]
43
+ openskp = "openskp.__init__:main"
44
+
45
+ [tool.setuptools.packages.find]
46
+ where = ["src"]
47
+
48
+ [tool.pytest.ini_options]
49
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -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)