From 6084ce9cd3da528a7707a6110ea02b519d62e2a3 Mon Sep 17 00:00:00 2001 From: wes Date: Fri, 26 Apr 2024 17:32:48 -0400 Subject: [PATCH] make images to render a list --- planter.py | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/planter.py b/planter.py index a69ef55..53e321d 100644 --- a/planter.py +++ b/planter.py @@ -45,29 +45,30 @@ planter_polygon = result.workplane(offset=-36).makePolygon( result = planter_polygon.vertices().sphere(8, combine="cut") -gondor_paths, gondor_attributes = svg2paths("/home/deck/cad_files/tree_of_gondor_small.svg") +gondor_paths, gondor_attributes = svg2paths( + "/home/deck/cad_files/tree_of_gondor_small.svg" +) gandalf_paths, gandalf_attributes = svg2paths("/home/deck/cad_files/gandalf.svg") +mordor_paths, mordor_attributes = svg2paths("/home/deck/cad_files/mordor.svg") +svgs_to_render = [ + (gondor_paths, (95.03, -100, 0)), + (gandalf_paths, (-95.03, -14.5, 85)), +] if RENDER_TREES: - tree = ( - Workplane("YZ") - .center(0, 75) - .addSvgPath(gondor_paths[0]) - .extrude(-2.0) - .translate((95.03, -100, 0)) - ) - - gandalf = ( - Workplane("YZ") - .center(0, 75) - .addSvgPath(gandalf_paths[0]) - .extrude(2.0) - .translate((-95.03, -14.5, 85)) - ) + image_objects = [] + for svg_paths, translate_offsets in svgs_to_render: + image_objects.append( + Workplane("YZ") + .center(0, 75) + .addSvgPath(svg_paths[0]) + .extrude(-2.0) + .translate(translate_offsets) + ) - result = result.cut(tree, clean=False) - result = result.cut(gandalf, clean=False) + for image_object in image_objects: + result = result.cut(image_object, clean=False) cone = cq.Solid.makeCone(planter_radius, 33, planter_height + 95)