Skip to content

Builder mode part / sketch names do not propagate #1357

Description

@fpfcmsr

when using

with BuildPart() as partName:
with BuildSketch() as sketchName:

the following do not work:

partName.label
sketchName.label
sketchName.sketch.label

code to test:

from build123d import *

# Testing BuildPart()
with BuildPart() as box:
    Box(10, 10, 10)

with BuildPart() as sphere:
    Sphere(7)


# BuildPart() no renaming
box.label = "box1"
sphere.part.label = "sphere1"
assembly1 = Compound(
    label="assembly1",
    children=[box.part, sphere.part]
)

print(assembly1.show_topology())


# BuildPart() with renaming 
child_box = box.part
child_box.label = "box2"
child_sphere = sphere.part
child_sphere.label = "sphere2"
assembly2 = Compound(
    label="assembly2",
    children=[child_box, child_sphere]
)

print(assembly2.show_topology())




# Testing BuildSketch() 
with BuildSketch() as square:
    Rectangle(
        10, 10
    )

with BuildSketch() as circle:
    Circle(
        7
    )


# BuildSketch() no renaming
square.label = "square3"
circle.sketch.label = "circle3" 
assembly3 = Compound(
    label="assembly3",
    children=[square.sketch, circle.sketch]
)

print(assembly3.show_topology())


# BuildSketch() with renaming
child_square = square.sketch
child_square.label = "square4" 
child_circle = circle.sketch
child_circle.label = "circle4"
assembly4 = Compound(
    label="assembly4",
    children=[child_square, child_circle]
)

print(assembly4.show_topology())

output:

assembly1   Compound at 0x7f7a69a288a0, Location((0, 0, 0), (0, 0, 0))
├──         Part     at 0x7f7a69a2c440, Location((0, 0, 0), (0, 0, 0))
└── sphere1 Part     at 0x7f7a69977390, Location((0, 0, 0), (0, 0, 0))

assembly2   Compound at 0x7f7a69c6a690, Location((0, 0, 0), (0, 0, 0))
├── box2    Part     at 0x7f7a69a2c440, Location((0, 0, 0), (0, 0, 0))
└── sphere2 Part     at 0x7f7a69977390, Location((0, 0, 0), (0, 0, 0))

assembly3 Compound at 0x7f7a69a12350, Location((0, 0, 0), (0, 0, 0))
├──       Sketch   at 0x7f7a69c6a330, Location((0, 0, 0), (0, 0, 0))
└──       Sketch   at 0x7f7a699c5150, Location((0, 0, 0), (0, 0, 0))

assembly4   Compound at 0x7f7a6999ce90, Location((0, 0, 0), (0, 0, 0))
├── square4 Sketch   at 0x7f7a699e4c50, Location((0, 0, 0), (0, 0, 0))
└── circle4 Sketch   at 0x7f7a699d96d0, Location((0, 0, 0), (0, 0, 0))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions