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 #4716

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
feature: Exclude Objects
A final cleanup pass as I hope this feature is getting close to
being merged.  Documentation update and some other tweaks.

Signed-off-by: Troy Jacobson <troy.d.jacobson@gmail.com>
  • Loading branch information
troy-jacobson committed Feb 22, 2022
commit 4c5e052d46f875a52da18b59f77bba99a1789bbd
4 changes: 4 additions & 0 deletions docs/Config_Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1433,6 +1433,10 @@ See the [exclude objects guide](Exclude_Object.md) and
[command reference](G-Codes.md#exclude-object)
for additional information.

```
[exclude_object]
```

## Resonance compensation

### [input_shaper]
Expand Down
4 changes: 2 additions & 2 deletions docs/Exclude_Object.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The `[exclude_object]` module allows Klipper to exclude objects while a print is
To enable this feature include an [exclude_object config section](Config_Reference.md#exclude_object)
(also see the [command reference](G-Codes.md#exclude-object).)

Unlike other 3D printer firmware options, a printer running Klipper is utilizing a suite of
Unlike other 3D printer firmware options, a printer running Klipper utilizes a suite of
components and users have many options to choose from. Therefore, in order to provide a
a consistent user experience, the `[exclude_object]` moudle will establish a contract or API
of sorts. The contract covers the contents of the gcode file, how the internal state of the
Expand Down Expand Up @@ -89,7 +89,7 @@ The state of this module is provided to clients by the [exclude_object status](S

The status is reset when:
- The Klipper firmware is restarted.
- There is a reset of the `[virtual_sdcard]`. Notable, this is reset by Klipper at the start of a print.
- There is a reset of the `[virtual_sdcard]`. Notably, this is reset by Klipper at the start of a print.
- When an `EXCLUDE_OBJECT_RESET` command is issued.

The list of defined objects is represented in the `exclude_object.objects` status field. In a well defined
Expand Down
8 changes: 2 additions & 6 deletions klippy/extras/exclude_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ def __init__(self, config):
self.printer.register_event_handler("sdcard:reset_file",
self._reset_file)
self.next_transform = None
self.log_next_moves = 0
self.objects = {}
self.excluded_objects = []
self.current_object = None
Expand Down Expand Up @@ -51,7 +50,7 @@ def __init__(self, config):
desc=self.cmd_LIST_EXCLUDED_OBJECTS_help)
def _setup_transform(self):
if not self.next_transform:
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's preferable to use if self.next_transform is None when checking an external object because the external object could override the truth check.

tuning_tower = self.printer.lookup_object('tuning_tower', None)
tuning_tower = self.printer.lookup_object('tuning_tower')
if tuning_tower.is_testing():
logging.info('The ExcludeObject move transform is not being '
'loaded due to Tuning tower being Active')
Expand All @@ -78,7 +77,7 @@ def _reset_file(self):
self.excluded_objects = []
self.current_object = None
if self.next_transform:
tuning_tower = self.printer.lookup_object('tuning_tower', None)
tuning_tower = self.printer.lookup_object('tuning_tower')
if tuning_tower.is_testing():
logging.info('The Exclude Object move transform was not '
'unregistered because it is not at the head of the '
Expand Down Expand Up @@ -106,8 +105,6 @@ def get_position(self):

def _normal_move(self, newpos, speed):
offset = self.extrusion_offsets[self.extruder_idx]
if self.log_next_moves > 0:
self.log_next_moves -= 1

self.last_position[:] = newpos
self.last_position_extruded[:] = self.last_position
Expand Down Expand Up @@ -158,7 +155,6 @@ def _move_into_excluded_region(self, newpos, speed):
def _move_from_excluded_region(self, newpos, speed):
self.in_excluded_region = False
offset = self.extrusion_offsets[self.extruder_idx]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Dead code?

self.log_next_moves = 10

# This adjustment value is used to compensate for any retraction
# differences between the last object printed and excluded one.
Expand Down
1 change: 0 additions & 1 deletion scripts/klippy-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ pyserial==3.4
greenlet==1.1.2
Jinja2==2.11.3
python-can==3.3.4
markupsafe<2.1