Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 26 additions & 13 deletions src/gflabel/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,23 +435,35 @@ def run(argv: list[str] | None = None):
add(body.part)

logger.debug("Extruding labels")
is_embossed = args.style == LabelStyle.EMBOSSED
extrude(
label_sketch.sketch,
amount=args.depth if is_embossed else -args.depth,
mode=(Mode.ADD if is_embossed else Mode.SUBTRACT),
)

if args.style in [LabelStyle.DEBOSSED, LabelStyle.EMBEDDED]:
extrude(
label_sketch.sketch,
amount=-args.depth,
mode=Mode.SUBTRACT,
)

if not is_2d:
part.part.label = "Base"

if args.style == LabelStyle.EMBEDDED:
# We want to make new volumes for the label, making it flush
embedded_label = extrude(label_sketch.sketch, amount=-args.depth)
embedded_label.label = "Label"
assembly = Compound([part.part, embedded_label])
else:
assembly = Compound(part.part)
if args.style == LabelStyle.EMBEDDED:
embedded_label = extrude(label_sketch.sketch, amount=-args.depth)
embedded_label.label = "Label"

assembly = Compound([part.part, embedded_label])

elif args.style == LabelStyle.EMBOSSED:
embossed_label = extrude(label_sketch.sketch, amount=args.depth)
embossed_label.label = "Label"

assembly = Compound([part.part, embossed_label])

elif args.style == LabelStyle.DEBOSSED:
assembly = Compound(part.part)

else:
logger.error(f"Error: Unknown label style '{args.style}'")
sys.exit(1)

assembly = scale(assembly, (args.xscale, args.yscale, args.zscale))

Expand Down Expand Up @@ -496,6 +508,7 @@ def run(argv: list[str] | None = None):
show_cols.append((0.2, 0.2, 0.2))
else:
# Split the base for display as two colours
is_embossed = args.style == LabelStyle.EMBOSSED
top = part.part.split(
Plane.XY if is_embossed else Plane.XY.offset(-args.depth),
keep=Keep.TOP,
Expand Down