From edf1dbdaa1fdfa0fcf7ae811a8b55c023fa65a2f Mon Sep 17 00:00:00 2001 From: Victor Poughon Date: Tue, 21 Jan 2025 18:39:40 +0100 Subject: [PATCH] jupyter_tools: use uuid for unique shape id --- src/build123d/jupyter_tools.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/build123d/jupyter_tools.py b/src/build123d/jupyter_tools.py index 0b3884c4..1299a73f 100644 --- a/src/build123d/jupyter_tools.py +++ b/src/build123d/jupyter_tools.py @@ -26,6 +26,7 @@ # pylint: disable=no-name-in-module from json import dumps import os +import uuid from string import Template from typing import Any, Dict, List from IPython.display import HTML @@ -92,7 +93,7 @@ def shape_to_html(shape: Any) -> HTML: ) # A new div with a unique id, plus the JS code templated with the id - div_id = "shape-" + str(id(shape)) + div_id = 'shape-' + uuid.uuid4().hex[:8] code = Template(TEMPLATE_JS).substitute(data=dumps(payload), div_id=div_id, ratio=0.5) html = HTML(f"
")