meerk40t / meerk40t

Hackable Laser software for K40 / GRBL / Fibre Lasers
MIT License
233 stars 62 forks source link

Fix incorrect hatch orientation on special devices #2671

Closed jpirnay closed 1 week ago

jpirnay commented 1 week ago

Addresses issue #2664

Before the fix:

balor
m2nano

So in a nutshell: m2nano before the fix: correct hatch orientation for the non-orientated placements, an incorrect one (everything needs to be rotated) for the rotated one balor before the fix: all hatches are rotated by 90 deg compared to m2nano

After the fix:

balor
m2nano

Summary by Sourcery

Bug Fixes:

sourcery-ai[bot] commented 1 week ago

Reviewer's Guide by Sourcery

The PR fixes incorrect hatch orientation issues in special devices (balor and m2nano) by adjusting the angle calculation in the hatch effect preprocessing. The implementation calculates the correct angle based on the matrix transformation and adjusts the hatch angle accordingly.

Updated class diagram for effect_hatch.py

classDiagram
    class EffectHatch {
        - _distance
        - _angle
        + preprocess(context, matrix, plan)
        + recalculate()
        + as_geometry(**kws) : Geomstr
        + as_geometries(**kws)
        + can_drop(drag_node) : bool
        + drop(drag_node, modify=true, flag=false)
    }
    note for EffectHatch "The preprocess method now adjusts the hatch angle based on matrix transformation."

File-Level Changes

Change Details Files
Added matrix-space angle calculation and adjustment in hatch effect preprocessing
  • Calculate angle between transformed points (0,0) and (1,0) in matrix space
  • Subtract the calculated angle from the hatch angle to compensate for transformation
  • Maintain proper scaling using matrix determinant
meerk40t/core/node/effect_hatch.py

Possibly linked issues


Tips and commands #### Interacting with Sourcery - **Trigger a new review:** Comment `@sourcery-ai review` on the pull request. - **Continue discussions:** Reply directly to Sourcery's review comments. - **Generate a GitHub issue from a review comment:** Ask Sourcery to create an issue from a review comment by replying to it. - **Generate a pull request title:** Write `@sourcery-ai` anywhere in the pull request title to generate a title at any time. - **Generate a pull request summary:** Write `@sourcery-ai summary` anywhere in the pull request body to generate a PR summary at any time. You can also use this command to specify where the summary should be inserted. #### Customizing Your Experience Access your [dashboard](https://app.sourcery.ai) to: - Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others. - Change the review language. - Add, remove or edit custom review instructions. - Adjust other review settings. #### Getting Help - [Contact our support team](mailto:support@sourcery.ai) for questions or feedback. - Visit our [documentation](https://docs.sourcery.ai) for detailed guides and information. - Keep in touch with the Sourcery team by following us on [X/Twitter](https://x.com/SourceryAI), [LinkedIn](https://www.linkedin.com/company/sourcery-ai/) or [GitHub](https://github.com/sourcery-ai).