Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude Objects (Superscedes #4716) #5413

Merged
merged 4 commits into from
Jun 3, 2022

Conversation

kageurufu
Copy link
Contributor

module: Exclude Objects

Adding Klipper functionality to support cancelling objects while printing.

This module keeps track of motion in and out of objects and adjusts movements as needed. It also
tracks object status and provides that to clients.

The Klipper module is relatively simple, and only provides one piece of the workflow. Support from Moonraker is underway to pre-process gcode files from various slicers with the extended gcode commands supplied by this module. UI's such as Fluidd and Mainsail will provide the user facing controls.

There has been a small group sharing code. In addition to the Moonraker work, I have Fluidd code that will be submitted shortly. Mainsail support is also underway.

Signed-off-by: Troy Jacobson [email protected]
Co-authored-by: Franklyn [email protected]
Co-authored-by: Eric Callahan [email protected]

This PR superscedes #4716, has the requested changes from the prior PR, and fixes the failing test. Troy is currently busy, so I'm opening a new PR to push things along

Troy Jacobson and others added 4 commits April 11, 2022 10:03
Signed-off-by: Troy Jacobson <[email protected]>
Co-authored-by: Franklyn Tackitt <[email protected]>
Signed-off-by: Troy Jacobson <[email protected]>
Co-authored-by: Franklyn Tackitt <[email protected]>
Adding Klipper functionality to support cancelling objects while
printing.

This module keeps track of motion in and out of objects and adjusts
movements as needed.  It also tracks object status and provides that to
clients.

The Klipper module is relatively simple, and only provides one piece of
the workflow. Moonraker already supports processing uploaded files to
insert the required gcode markers for cancelling objects, using
https://github.com/kageurufu/cancelobject-preprocessor. This library is
also available as an executable for use in slicers, and pip
installations also include the script as a callable.

Mainsail has integrated support, and code changes for Fluidd are
available. Support in other interfaces is planned, and we've spoken to
several other developers about integrating frontend support in their
projects.

Signed-off-by: Troy Jacobson <[email protected]>
Co-authored-by: Franklyn Tackitt <[email protected]>
Co-authored-by: Eric Callahan <[email protected]>
Also include sample macros to add M486 compatibility.

Signed-off-by: Franklyn Tackitt <[email protected]>
Co-authored-by: Troy Jacobson <[email protected]>
@Arksine Arksine self-assigned this Apr 20, 2022
@maz0r maz0r mentioned this pull request Apr 23, 2022
@nightime7
Copy link

I've been running this for a couple of weeks now. seems to work quite well. is there any update regarding delivering this to the master repo? @Arksine @kageurufu

@maz0r maz0r mentioned this pull request May 7, 2022
@mjoconr
Copy link

mjoconr commented May 17, 2022

Has worked really well for me also. Be nice to know when it might be included in to Klipper.

@lbibass
Copy link

lbibass commented May 18, 2022

This has also been working very well for me. I would also like to see it merged soon so I can get back to mainline.

@JRHeaton
Copy link

JRHeaton commented May 25, 2022

Another +1 from me for seemingly stable working. Would love to see a review on this from @KevinOConnor and get it into main! This is one of those killer features for big bed batch printers. Great work

@batista16
Copy link

+1 been using it for months now.. let's get it merged? :)

@gurusonwheels
Copy link

+1 please merge soon . this is needed like yesterday .

@obamin
Copy link

obamin commented Jun 2, 2022

+1 please merge soon .

Copy link
Collaborator

@Arksine Arksine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found some minor issues that I do not believe would functionally impair the module, overall the implementation looks good to me. We could correct these after the merging, however I will leave that up to Kevin. I would be willing to submit a PR to do so at his request.

### Object Definitions

The `EXCLUDE_OBJECT_DEFINE` command is used to provide a summary of each object
in the gcode file to be printed. Provides a summary of an object in the file.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Provides a summary of an object in the file" appears to be stale documentation.

if not any(obj["name"] == name for obj in self.objects):
self._add_object_definition({"name": name})
self.current_object = name
self.was_excluded_at_start = self._test_in_excluded_region()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale attribute? It doesn't appear that was_excluded_at_start is accessed in the module.

" currently active")
return
name = gcmd.get('NAME', default=None)
if name != None and name.upper() != self.current_object:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally identity should be used when testing for a NoneType, ie:

if self.current_object is None and self.next_transform:
    gcmd.respond_info("EXCLUDE_OBJECT_END called, but no object is"
                                     " currently active")
    return
if name is not None and name.upper() != self.current_object:
     # rest of code

if center != None:
obj['center'] = json.loads('[%s]' % center)

if polygon != None:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The center and polygon conditions should test for identity.

@KevinOConnor
Copy link
Collaborator

Thanks. Looks good to me. I agree minor changes should just be made after merging. It's been a few weeks since this was submitted so I'd like confirmation from @kageurufu that everything is still good for committing and then I will commit.

-Kevin

@kageurufu
Copy link
Contributor Author

@KevinOConnor It's still working great on my machine, and a few others I know. I think we're good!

@KevinOConnor KevinOConnor merged commit 638cd4d into Klipper3d:master Jun 3, 2022
@KevinOConnor
Copy link
Collaborator

Thanks!

-Kevin

@lbibass
Copy link

lbibass commented Jun 3, 2022

Woohoo!!

@kageurufu kageurufu deleted the exclude-object-pr2 branch June 3, 2022 18:41
@gurusonwheels
Copy link

think its missing something console shows
14:51:03
Unknown command:"DEFINE_OBJECT"
and the icon that normally there next to stop and pause for selecting objects is missing .

@Arksine
Copy link
Collaborator

Arksine commented Jun 3, 2022

The gcode commands changed. You will need to make sure you are using a file processed by preprocess-cancellation version 0.2.0.

@gurusonwheels
Copy link

The gcode commands changed. You will need to make sure you are using a file processed by preprocess-cancellation version 0.2.0.

thanks . got you something . check discord .

@Lenbok
Copy link
Contributor

Lenbok commented Jun 3, 2022

Just curious, what is the use case for this feature? Is it that the user wants to slice a whole bunch of items and just select at print time which ones to actually print? Is it that midway through printing a plate of parts, some parts fail, so this lets you cancel the failed part (preventing collateral damage and filament waste)? (It would be nice if the documentation gave hints when you would want to do this, as it potentially allows new workflows that people aren't aware of.)

@clee
Copy link
Contributor

clee commented Jun 4, 2022

Is it that midway through printing a plate of parts, some parts fail, so this lets you cancel the failed part (preventing collateral damage and filament waste)?

This is the primary use case as far as I'm concerned.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.