bernhard-42 / jupyter-cadquery

An extension to render cadquery objects in JupyterLab via pythreejs
Apache License 2.0
326 stars 45 forks source link

jcv - naming items in the tree #54

Closed jchidley closed 3 years ago

jchidley commented 3 years ago

I'm sure that it's obvious to some but how do you name items in the tree view, currently mine are named Group, Part_0, Parent_1, Edges_1, Part_2 etc.

jchidley commented 3 years ago

Answer: turn it into a Part

import cadquery
from jupyter_cadquery.viewer.client import (Part, show)
result = cadquery.Workplane("front").box(2.0, 2.0, 0.5)
box = Part(result, "Box")
show(box)
bernhard-42 commented 3 years ago

Correct, Part and PartGroup are the containers of jupyter-cadquery. You can also use a CadQuery Assemblyand jupyter-cadquery will transform it to a PartGroup hierarchy using the names given in the Assembly.