FreeCAD-Gridfinity-Workbench icon indicating copy to clipboard operation
FreeCAD-Gridfinity-Workbench copied to clipboard

Add scoop functionality to EcoBin classes

Open graelo opened this issue 3 months ago • 4 comments

Hi, many thanks for this Addon, I love it. I was just missing the scoop for EcoBins.

This PR extends scoop support to both EcoBin and CustomEcoBin classes, bringing feature parity with standard storage bins.

Changes

  • EcoBin: Added scoop properties and shape generation logic
  • CustomEcoBin: Added scoop properties with proper custom shape integration (scoop is trimmed by inside_wall_negative

Both classes now expose Scoop (boolean) and ScoopRadius (length) properties in the UI. Default scoop value set to False for backward compatibility

Implementation

The implementation reuses the existing make_scoop() function and follows established patterns used by other features like label shelves. For CustomEcoBin, the scoop is properly cut by the inside wall negative to handle custom shapes correctly.

Testing

  • Code passes linting (ruff) and type checking (mypy)
  • I could not identify any breaking changes to existing functionality
  • Maintains backward compatibility with existing EcoBin objects

This addresses the feature gap where scoops were available in standard bins but missing from eco bins.

Here's an EcoBin with a scoop (radius: 12mm)

image

The underside is unaffected: image

It also works for 1x1 EcoBins image

and custom EcoBins image

graelo avatar Sep 28 '25 06:09 graelo

~~Question for you @greg19:~~

~~I'm getting this FA100 warning from Ruff, and I'm wondering what's the most appropriate way for this repo to fix it:~~

freecad/gridfinity_workbench/feature_construction.py:196:58: FA100 Add `from __future__ import annotations` to simplify `typing.Optional`
    |
196 | def make_scoop(obj: fc.DocumentObject, *, usable_height: Optional[int] = None) -> Part.Shape:
    |                                                          ^^^^^^^^ FA100

~~I think we have to keep it work for Python 3.10 because I believe that's what FreeCAD still uses, so I went for Optional for the type hint. Would you prefer me to apply the advice for FA100?~~

Sorry, FreeCAD uses 3.11, I can go with the new notation.

graelo avatar Sep 28 '25 08:09 graelo

Thanks for the feedback, it's indeed better now.

graelo avatar Sep 28 '25 09:09 graelo

Hello @Stu142, a kind ping for this PR. In any case, take care.

graelo avatar Oct 10 '25 06:10 graelo

@graelo thanks for the contribution I'll have time to take a look at it this weekend, I've been unable to find time over the summer but things are cooling down now and I have some catching up to do.

Stu142 avatar Oct 10 '25 13:10 Stu142