Skip to content

Commit

Permalink
I got overzealous and removed the line of code that generated the she…
Browse files Browse the repository at this point in the history
…lf assembly for the rack, so I put it back
  • Loading branch information
jmwright committed Nov 6, 2024
1 parent 6f59ad7 commit 87aae21
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion mechanical/assembly_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from nimble_build_system.cad.shelf import create_shelf_for

assembly_definition_file = "../build/assembly-def.yaml"
render_destination = os.path.join(os.getcwd(), "assembly-docs")
render_destination = os.path.join(os.getcwd(), "assembly-docs", "renders")

class PartDefinition:
"""
Expand Down Expand Up @@ -70,12 +70,19 @@ def generate(self) -> cq.Assembly:
"""
Generate the assembly.
"""
# Make sure that the render destination exists
os.makedirs(render_destination, exist_ok=True)

assembly = cq.Assembly()
for part in self._parts:
if part.device:
# This is a shelf and we load it directly rather than from an STEP.
shelf_obj = create_shelf_for(part.device)

# Create the shelf that will go in the assembly
cq_part = shelf_obj.generate_assembly_model(
shelf_obj.renders["assembled"]["render_options"])

# Generate all render pngs for this shelf
shelf_obj.generate_renders(base_path=render_destination)
else:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cad.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def test_shelf_assembly_generation():

# Test exploded assembly
exploded_assy = rpi_shelf.generate_assembly_model(
rpi_shelf.renders["annotated"]["render_options"])
rpi_shelf.renders["annotated"]["render_options"])

# Make sure the assembly has the number of children we expect
assert len(assy.children) == 6

0 comments on commit 87aae21

Please sign in to comment.