Skip to content

[QUESTION] push/pop ExtrusionGeometry #92

Description

@aavogt

I use two different extrusion widths. It looks like this will work:

w1 = fc.ExtrusionGeometry(width=0.4, height=0.28, units="mm")
w2 = fc.ExtrusionGeometry(width=0.8, height=0.28, units="mm")
r.append(w2)
r += wide_geom
r.append(w1)
r += narrow_geom

I would rather not have to override w1. The best I can do in my py file is:

class Lambda:
    def __init__(self, f):
        self.f = f
    def gcode(self, state):
        self.f(state)

w2 = fc.ExtrusionGeometry(width=0.8, height=0.28, units="mm")
w1 = None
r.append(Lambda(lambda state: (w1 := state.extrusion_geometry)))
r.append(w2)
r+= wide_geom
r.append(Lambda(lambda state: setattr(state,'extrusion_geometry',w1)))
r+= narrow_geom

The duplicate Lambda, := instead of =, setattr instead of state.extrusion_geometry = w1 make this "improvement" worse than the original problem.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions