Skip to content

Sketcher: Polyline rework.#29336

Merged
maxwxyz merged 19 commits into
FreeCAD:mainfrom
PaddleStroke:sk_polyline
May 18, 2026
Merged

Sketcher: Polyline rework.#29336
maxwxyz merged 19 commits into
FreeCAD:mainfrom
PaddleStroke:sk_polyline

Conversation

@PaddleStroke
Copy link
Copy Markdown
Contributor

@PaddleStroke PaddleStroke commented Apr 13, 2026

This PR adds a new command Sketcher_CreatePolyline2
Why? Because I am sure many people will yell murder if their polyline tool is removed and I don't want to deal with it.

So this PR is not touching the existing tool and adds another tool. In the toolbar, we are replacing the command in the line command group. The individual command remain untouched.

This PR also adds autoconstraints such as tangent, parallel and perpendicular.

Fix #12462

@github-actions github-actions Bot added the Mod: Sketcher Related to the Sketcher Workbench label Apr 13, 2026
@maxwxyz maxwxyz added Type: Feature FR for improvements or new features Requires: UI/UX review Issue/PR to be reviewed in terms of UI/UX by the Design Working Group or under refinement. labels Apr 13, 2026
@maxwxyz maxwxyz added this to the 1.2 milestone Apr 13, 2026
@maxwxyz maxwxyz moved this from Queue to Merge Meeting in Merge Queue Apr 13, 2026
@tigert
Copy link
Copy Markdown
Contributor

tigert commented Apr 13, 2026

can you post a demonstration video of the features?

edit: https://www.youtube.com/watch?v=18WdpAEWxRg < is this it?

@PaddleStroke
Copy link
Copy Markdown
Contributor Author

Yes this is the video

@FEA-eng
Copy link
Copy Markdown
Contributor

FEA-eng commented Apr 13, 2026

CI failed and I keep getting these warnings after starting FreeCAD compile with this PR:

QPixmap::scaled: Pixmap is a null pixmap

@FEA-eng
Copy link
Copy Markdown
Contributor

FEA-eng commented Apr 13, 2026

In the toolbar, we are replacing the command in the line command group. The individual command remain untouched.

So the new polyline is available only if the line grouping preference is enabled?

This PR also adds autoconstraints such as tangent, parallel and perpendicular.

This is even better for me. But I know that some users don't like autoconstraints. How about a preference to disable them? #21761

@PaddleStroke
Copy link
Copy Markdown
Contributor Author

So the new polyline is available only if the line grouping preference is enabled?

Yes current code is like this.
Although we can change that to whatever DWG wants.

@PaddleStroke
Copy link
Copy Markdown
Contributor Author

CI failed and I keep getting these warnings after starting FreeCAD compile with this PR:

QPixmap::scaled: Pixmap is a null pixmap

Hmm CI failure is probably unrelated because it doesn't make sense.

I don't know what is this warning about pixmap I don't think I used scaled there.

The PR was opened at 5:38 so during the merge meeting so maybe I rebased on main at the wrong time.

@PaddleStroke
Copy link
Copy Markdown
Contributor Author

This is even better for me. But I know that some users don't like autoconstraints. How about a preference to disable them?

Sounds good. But perhaps not in this huge PR

@FEA-eng
Copy link
Copy Markdown
Contributor

FEA-eng commented Apr 13, 2026

The new tool has the same problem as the Text tool used to have: #28363

But not just for Y coordinate - the angle input also has it. Although it blends with #29248, so it's hard to say.

@PaddleStroke
Copy link
Copy Markdown
Contributor Author

Thanks @FEA-eng I fixed it

@FEA-eng
Copy link
Copy Markdown
Contributor

FEA-eng commented Apr 14, 2026

There's still something off with the OVPs (apart from the known jumping cursor issue):

polyline ovps

Notice two things:

  • the line can be extended/shortened even after entering its length
  • at the end, some OVP with 0 appears at the origin

@PaddleStroke
Copy link
Copy Markdown
Contributor Author

Let's see. The bug where the line changes length, I remember the line tool had the same regresion following earlier OVP changes.
I'll check how to fix that regression

@PaddleStroke
Copy link
Copy Markdown
Contributor Author

Indeed that regression has been fixed by #24904
So looks like I have to study that PR which is not straight forward and apply the same to the new polyline.

@PaddleStroke
Copy link
Copy Markdown
Contributor Author

It appears to be fixed

@FEA-eng
Copy link
Copy Markdown
Contributor

FEA-eng commented Apr 18, 2026

It appears to be fixed

Indeed, the length change is fixed, but I still see this weird OVP at the origin (and can even switch to it):

image

@PaddleStroke
Copy link
Copy Markdown
Contributor Author

PaddleStroke commented Apr 20, 2026

Can you please describe precise reproduction steps for the additional spinbox? I can't seem to reproduce it now.

@FEA-eng
Copy link
Copy Markdown
Contributor

FEA-eng commented Apr 20, 2026

Can you please describe precise reproduction steps for the additional spinbox? I can't seem to reproduce it now.

Sure:

  1. Enter some values for the two position OVPs for the starting point. I used X=40 mm and Y=50 mm
  2. Click or press Enter to confirm.
  3. Now move or rotate the view. The additional OVP should appear at the origin.
extra OVP

@maxwxyz maxwxyz added Requires: UI/UX review Issue/PR to be reviewed in terms of UI/UX by the Design Working Group or under refinement. Approved: UI/UX The Issue/PR was reviewed in terms of UI/UX and approved by the Design Working Group and removed Requires: UI/UX review Issue/PR to be reviewed in terms of UI/UX by the Design Working Group or under refinement. labels May 10, 2026
@obelisk79
Copy link
Copy Markdown
Contributor

obelisk79 commented May 15, 2026

I got to work with this earlier today after building it locally, and I have to say this imo offers a very noteworthy UX improvement to this tool. I hope we can nest the regular line tool under this one on the toolbar like we did with the new coincident constraint tool in the very near future. These changes make polyline a far superior tool in the overwhelming majority of cases where lines and arcs will be needed. Well done @PaddleStroke !

@kadet1090 kadet1090 self-assigned this May 18, 2026
@kadet1090 kadet1090 added the Requires: Code Review The PR requires code to be reviewed label May 18, 2026
Copy link
Copy Markdown
Contributor

@maxwxyz maxwxyz left a comment

Choose a reason for hiding this comment

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

Merge after these changes

Comment thread src/Mod/Sketcher/Gui/CommandCreateGeo.cpp Outdated
Comment thread src/Mod/Sketcher/Gui/CommandCreateGeo.cpp Outdated
Comment thread src/Mod/Sketcher/Gui/DrawSketchHandlerLineSet.h Outdated
Comment thread src/Mod/Sketcher/Gui/DrawSketchHandlerLineSet.h Outdated
Comment thread src/Mod/Sketcher/Gui/DrawSketchHandlerLineSet.h Outdated
PaddleStroke and others added 5 commits May 18, 2026 18:27
Co-authored-by: Max Wilfinger <6246609+maxwxyz@users.noreply.github.com>
Co-authored-by: Max Wilfinger <6246609+maxwxyz@users.noreply.github.com>
Co-authored-by: Max Wilfinger <6246609+maxwxyz@users.noreply.github.com>
Co-authored-by: Max Wilfinger <6246609+maxwxyz@users.noreply.github.com>
Co-authored-by: Max Wilfinger <6246609+maxwxyz@users.noreply.github.com>
@PaddleStroke
Copy link
Copy Markdown
Contributor Author

@maxwxyz your changes are commited

@kadet1090 kadet1090 added Approved: Code Quality The PR was checked for code quality and approved and removed Requires: Code Review The PR requires code to be reviewed labels May 18, 2026
@maxwxyz maxwxyz enabled auto-merge (squash) May 18, 2026 16:55
@maxwxyz maxwxyz merged commit d77c964 into FreeCAD:main May 18, 2026
24 checks passed
@github-project-automation github-project-automation Bot moved this from Approved to Done in Merge Queue May 18, 2026
Alex-2Code added a commit to Alex-2Code/FreeCAD-Documentation-Project that referenced this pull request May 19, 2026
Document the new reworked Polyline tool with OVP support and autoconstraints.

Source: FreeCAD/FreeCAD#29336
Refs: FreeCAD/FreeCAD#12462
@TomPcz
Copy link
Copy Markdown
Contributor

TomPcz commented May 21, 2026

I might be missing something, but I think “R undoes the last point” does not seem to do anything.

M for mode works (well, only after the first line, I cannot start with an arc, but that makes sense). F for fillet works only before I start drawing (but I can still click on that option, and it works as expected). R does not.

@maxwxyz
Copy link
Copy Markdown
Contributor

maxwxyz commented May 21, 2026

Can conform @PaddleStroke FYI

@PaddleStroke
Copy link
Copy Markdown
Contributor Author

Thanks for the feedback. Hmm it must have broke during the various fixes we did in this PR. Let me check this.

@PaddleStroke
Copy link
Copy Markdown
Contributor Author

This is not specific to the polyline tool. All the tools are affected: shortcuts do not work (example rectangle tool U and J).
It is a focus issue. I will create an issue about it

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

Labels

Approved: Code Quality The PR was checked for code quality and approved Approved: Tested The PR was manually tested and approved Approved: UI/UX The Issue/PR was reviewed in terms of UI/UX and approved by the Design Working Group Mod: Sketcher Related to the Sketcher Workbench Type: Feature FR for improvements or new features

Projects

Status: Done
Status: Done

Development

Successfully merging this pull request may close these issues.

Sketcher: No OVP/Widget for Polyline Tool

9 participants