# Build132d Shape History
A tool to manage and visualize the modification history of Build123D objects.
## Installation
This package is [published on Pypi](https://pypi.org/project/bd_shape_history/):
```
pip install bd_shape_history
```
## Usage
Assuming a simple part created in 3 steps:
```py
box = _.Box(3, 3, 1)
cbox = _.chamfer(box.edges()[0], 0.5)
cboxh = cbox - _.Cylinder(0.75, 1)
```
We can build the history with:
```py
hm = ShapeHistory.from_globals()
```
And then display it `diff()` (here with [VScode OCP CAD viewer](https://github.com/bernhard-42/vscode-ocp-cad-viewer/)):
```py
ov.set_defaults(render_edges=False)
ov.show(*hm.diff(), names=hm.labels())
```
This shows a visual diff between each step:
![](./docs/images/step1.png) ![](./docs/images/step2.png) ![](./docs/images/step3.png)
Notice how the object is colored:
- new faces and edges are green and light green;
- unchanged faces and edges are gray and black;
- modified faces and edges are dark green and olive
See the `examples` folder for more details.
## Command line interface
You can compare two files and export the diff as an image using the `ocp_diff` script. For instance:
ocp_diff ./examples/a.py:box ./examples/b.py:box img.png
## How does it work
ShapeHistory compares the hash of faces, edges and vertices between each steps:
- a face or edge whose hash is found on the previous step is considered unmodified;
- a face whose all edges are not found in the previous step is considered added (and same for edge / vertices);
- otherwise the face or edge is considered modified.
Raw data
{
"_id": null,
"home_page": "https://codeberg.org/roipoussiere/bd_shape_history",
"name": "bd_shape_history",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.13,>=3.11",
"maintainer_email": null,
"keywords": "cad, build123d, history",
"author": "Nathana\u00ebl Jourdane",
"author_email": "njourdane@protonmail.com",
"download_url": "https://files.pythonhosted.org/packages/c2/db/0db016e239b3f2c6b85708fc7b3f7607c73918d5af66f80edde1478e1c62/bd_shape_history-0.1.1.tar.gz",
"platform": null,
"description": "# Build132d Shape History\n\nA tool to manage and visualize the modification history of Build123D objects.\n\n## Installation\n\nThis package is [published on Pypi](https://pypi.org/project/bd_shape_history/):\n\n```\npip install bd_shape_history\n```\n\n## Usage\n\nAssuming a simple part created in 3 steps:\n\n```py\nbox = _.Box(3, 3, 1)\ncbox = _.chamfer(box.edges()[0], 0.5)\ncboxh = cbox - _.Cylinder(0.75, 1)\n```\n\nWe can build the history with:\n\n```py\nhm = ShapeHistory.from_globals()\n```\n\nAnd then display it `diff()` (here with [VScode OCP CAD viewer](https://github.com/bernhard-42/vscode-ocp-cad-viewer/)):\n\n```py\nov.set_defaults(render_edges=False)\nov.show(*hm.diff(), names=hm.labels())\n```\n\nThis shows a visual diff between each step:\n\n![](./docs/images/step1.png) ![](./docs/images/step2.png) ![](./docs/images/step3.png)\n\nNotice how the object is colored:\n- new faces and edges are green and light green;\n- unchanged faces and edges are gray and black;\n- modified faces and edges are dark green and olive\n\nSee the `examples` folder for more details.\n\n## Command line interface\n\nYou can compare two files and export the diff as an image using the `ocp_diff` script. For instance:\n\n ocp_diff ./examples/a.py:box ./examples/b.py:box img.png\n\n## How does it work\n\nShapeHistory compares the hash of faces, edges and vertices between each steps:\n\n- a face or edge whose hash is found on the previous step is considered unmodified;\n- a face whose all edges are not found in the previous step is considered added (and same for edge / vertices);\n- otherwise the face or edge is considered modified.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A tool to manage and visualize the modification history of Build123D objects.",
"version": "0.1.1",
"project_urls": {
"Homepage": "https://codeberg.org/roipoussiere/bd_shape_history",
"Repository": "https://codeberg.org/roipoussiere/bd_shape_history"
},
"split_keywords": [
"cad",
" build123d",
" history"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0132eb71a54cd436a8d2aa54f1788e0d242d6639194f1ced304fa6ec82e421df",
"md5": "81d9198f447440d90b5d87264f1be178",
"sha256": "1da9450a189eeef4886f9487dee1a0f9858844677cc1d04fb3fa39c6de2f500c"
},
"downloads": -1,
"filename": "bd_shape_history-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "81d9198f447440d90b5d87264f1be178",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.13,>=3.11",
"size": 6204,
"upload_time": "2024-12-13T17:39:58",
"upload_time_iso_8601": "2024-12-13T17:39:58.596826Z",
"url": "https://files.pythonhosted.org/packages/01/32/eb71a54cd436a8d2aa54f1788e0d242d6639194f1ced304fa6ec82e421df/bd_shape_history-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c2db0db016e239b3f2c6b85708fc7b3f7607c73918d5af66f80edde1478e1c62",
"md5": "a30088413c67f547aa5eeb33750126ea",
"sha256": "40e50bcacb34e3ec5105a28659735104ca79dcea7164766643a080e9b7b3bf1f"
},
"downloads": -1,
"filename": "bd_shape_history-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "a30088413c67f547aa5eeb33750126ea",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.13,>=3.11",
"size": 4823,
"upload_time": "2024-12-13T17:40:00",
"upload_time_iso_8601": "2024-12-13T17:40:00.622094Z",
"url": "https://files.pythonhosted.org/packages/c2/db/0db016e239b3f2c6b85708fc7b3f7607c73918d5af66f80edde1478e1c62/bd_shape_history-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-13 17:40:00",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": true,
"codeberg_user": "roipoussiere",
"codeberg_project": "bd_shape_history",
"lcname": "bd_shape_history"
}