[Feature Request] Rectangle from 3 corners

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
User avatar
paddle
Veteran
Posts: 1364
Joined: Mon Feb 03, 2020 4:47 pm

Re: [Feature Request] Rectangle from 3 corners

Post by paddle »

NewJoker wrote: Fri Aug 05, 2022 12:44 pm Looks really great, I can't wait to test it :-)

The frame mode will utilize your new offset tool to provide a predefined rectangle with offset ?
No it doesn't actually. It's a very simple case of offset, so it's done manually for simplicity.

The corner math problem is solved. Tool is working as expected. I'm currently debugging edge cases, which there are a lot. Rectangle tool has now 4 construction mode and 2 options (+ 1 hidden, when frame of round corner rectangle is normal rectangle because it's too small). Making a total of 32 cases, so there are a lot of debugging to do!
balrobs
Posts: 449
Joined: Fri Apr 24, 2020 8:58 pm

Re: [Feature Request] Rectangle from 3 corners

Post by balrobs »

paddle wrote: Sat Aug 06, 2022 10:40 am
The corner math problem is solved. Tool is working as expected.
Great to hear that :D
paddle wrote: Sat Aug 06, 2022 10:40 am
Making a total of 32 cases
I am just imagining what it would mean for the FreeCad UI to realize all these cases without your new Tool settings :shock:
User avatar
NewJoker
Veteran
Posts: 2977
Joined: Sun Oct 11, 2020 7:49 pm

Re: [Feature Request] Rectangle from 3 corners

Post by NewJoker »

balrobs wrote: Sat Aug 06, 2022 12:24 pm I am just imagining what it would mean for the FreeCad UI to realize all these cases without your new Tool settings :shock:
Exactly, those modes and options are really convenient. They can even reduce the current number of tools in the Sketcher while adding lots of new functionalities. That’s the way to go.
User avatar
paddle
Veteran
Posts: 1364
Joined: Mon Feb 03, 2020 4:47 pm

Re: [Feature Request] Rectangle from 3 corners

Post by paddle »

I just pushed the new 3 points rectangle.
If someone wants to test and repport any bug, you can build my 'paddle_widget_testing' branch :
https://github.com/PaddleStroke/FreeCAD ... et_testing

Alternatively if you already have Abdullah 'paddle_widget_testing' branch, you can just cherry pick the last 7 commits of my branch.

I mostly debugged it, but wouldn't be surprised that some are to be found yet. I'll make a deeper testing session asap.

Edit: Now 7 last commits
Last edited by paddle on Sun Aug 14, 2022 12:40 pm, edited 3 times in total.
balrobs
Posts: 449
Joined: Fri Apr 24, 2020 8:58 pm

Re: [Feature Request] Rectangle from 3 corners

Post by balrobs »

paddle wrote: Sun Aug 07, 2022 1:20 pm If someone wants to test and repport any bug, you can build my 'paddle_widget_testing' branch :
Hi @paddle,
I tried to compile on Ubuntu but couldn't succeed due to the following errors:

Code: Select all

...
[ 69%] Building CXX object src/Mod/Sketcher/Gui/CMakeFiles/SketcherGui.dir/CommandCreateGeo.cpp.o
In file included from /home/balrobs/Desktop/freecad-source/src/Mod/Sketcher/Gui/DrawSketchDefaultWidgetHandler.h:29,
                 from /home/balrobs/Desktop/freecad-source/src/Mod/Sketcher/Gui/DrawSketchHandlerLine.h:27,
                 from /home/balrobs/Desktop/freecad-source/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp:71:
/home/balrobs/Desktop/freecad-source/src/Mod/Sketcher/Gui/SketcherToolDefaultWidget.h:196:10: error: extra qualification ‘SketcherGui::SketcherToolDefaultWidget::’ on member ‘setModeToolTips’ [-fpermissive]
  196 |     void SketcherToolDefaultWidget::setModeToolTips(QStringList& names);
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~
/home/balrobs/Desktop/freecad-source/src/Mod/Sketcher/Gui/SketcherToolDefaultWidget.h:259:18: error: extra qualification ‘SketcherGui::SketcherToolDefaultWidget::’ on member ‘getMode’ [-fpermissive]
  259 |     QPushButton* SketcherToolDefaultWidget::getMode(int modeindex);
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/balrobs/Desktop/freecad-source/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp:72:
/home/balrobs/Desktop/freecad-source/src/Mod/Sketcher/Gui/DrawSketchHandlerRectangle.h: In member function ‘void SketcherGui::DrawSketchDefaultWidgetHandler<HandlerT, SelectModeT, PEditCurveSize, PAutoConstraintSize, WidgetParametersT, WidgetCheckboxesT, WidgetComboboxesT, ConstructionMethodT, PFirstComboboxIsConstructionMethod>::ToolWidgetManager::doEnforceWidgetParameters(Base::Vector2d&) [with HandlerT = SketcherGui::DrawSketchHandlerRectangle; SelectModeT = SketcherGui::StateMachines::FiveSeekEnd; int PEditCurveSize = 5; int PAutoConstraintSize = 3; WidgetParametersT = SketcherGui::WidgetParameters<6, 6, 8, 8>; WidgetCheckboxesT = SketcherGui::WidgetCheckboxes<2, 2, 2, 2>; WidgetComboboxesT = SketcherGui::WidgetComboboxes<0, 0, 0, 0>; ConstructionMethodT = SketcherGui::ConstructionMethods::RectangleConstructionMethod; bool PFirstComboboxIsConstructionMethod = true]’:
/home/balrobs/Desktop/freecad-source/src/Mod/Sketcher/Gui/DrawSketchHandlerRectangle.h:1274:28: warning: unused variable ‘angle412’ [-Wunused-variable]
 1274 |                     double angle412 = (dHandler->secondCornerInitial - dHandler->firstCorner).Angle() - M_PI - toolWidget->getParameter(WParameter::Sixth) * M_PI / 180;
      |                            ^~~~~~~~
/home/balrobs/Desktop/freecad-source/src/Mod/Sketcher/Gui/DrawSketchHandlerRectangle.h: In member function ‘void SketcherGui::DrawSketchDefaultWidgetHandler<HandlerT, SelectModeT, PEditCurveSize, PAutoConstraintSize, WidgetParametersT, WidgetCheckboxesT, WidgetComboboxesT, ConstructionMethodT, PFirstComboboxIsConstructionMethod>::ToolWidgetManager::adaptWidgetParameters(Base::Vector2d) [with HandlerT = SketcherGui::DrawSketchHandlerRectangle; SelectModeT = SketcherGui::StateMachines::FiveSeekEnd; int PEditCurveSize = 5; int PAutoConstraintSize = 3; WidgetParametersT = SketcherGui::WidgetParameters<6, 6, 8, 8>; WidgetCheckboxesT = SketcherGui::WidgetCheckboxes<2, 2, 2, 2>; WidgetComboboxesT = SketcherGui::WidgetComboboxes<0, 0, 0, 0>; ConstructionMethodT = SketcherGui::ConstructionMethods::RectangleConstructionMethod; bool PFirstComboboxIsConstructionMethod = true]’:
/home/balrobs/Desktop/freecad-source/src/Mod/Sketcher/Gui/DrawSketchHandlerRectangle.h:1397:16: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else]
 1397 |             if (!toolWidget->isParameterSet(WParameter::Fifth))
      |                ^
make[2]: *** [src/Mod/Sketcher/Gui/CMakeFiles/SketcherGui.dir/build.make:502: src/Mod/Sketcher/Gui/CMakeFiles/SketcherGui.dir/CommandCreateGeo.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:5788: src/Mod/Sketcher/Gui/CMakeFiles/SketcherGui.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
Cheers
User avatar
paddle
Veteran
Posts: 1364
Joined: Mon Feb 03, 2020 4:47 pm

Re: [Feature Request] Rectangle from 3 corners

Post by paddle »

balrobs wrote: Tue Aug 09, 2022 5:38 pm Hi @paddle,
I tried to compile on Ubuntu but couldn't succeed due to the following errors:
I just fixed those.
I soft-reset the last commit and force pushed with the new changes.
So you have to 'git reset --soft HEAD~1', revert changes, then re-cherry pick the new commit (which is the last of the branch).
balrobs
Posts: 449
Joined: Fri Apr 24, 2020 8:58 pm

Re: [Feature Request] Rectangle from 3 corners

Post by balrobs »

paddle wrote: Wed Aug 10, 2022 5:17 am I just fixed those.
Now I succeeded in compiling for Ubuntu 22.04 :D
In the coming days I will test your branch and let you know if I find something worth mentioning
Here a screen cast of the first issue I discovered related to the creation of a 3 rim point arc:
Peek 2022-08-10 21-38.gif
Peek 2022-08-10 21-38.gif (542.13 KiB) Viewed 722 times
As you can see the second arc is created on the wrong side!
Cheers
User avatar
paddle
Veteran
Posts: 1364
Joined: Mon Feb 03, 2020 4:47 pm

Re: [Feature Request] Rectangle from 3 corners

Post by paddle »

balrobs wrote: Wed Aug 10, 2022 7:58 pm
paddle wrote: Wed Aug 10, 2022 5:17 am I just fixed those.
Now I succeeded in compiling for Ubuntu 22.04 :D
In the coming days I will test your branch and let you know if I find something worth mentioning
Here a screen cast of the first issue I discovered related to the creation of a 3 rim point arc:
Peek 2022-08-10 21-38.gif
As you can see the second arc is created on the wrong side!
Cheers
I solved this issue and fixed the preview line of the arc to be meaningful in 3p mode.

You can try picking the additional 2 commits that I pushed.
balrobs
Posts: 449
Joined: Fri Apr 24, 2020 8:58 pm

Re: [Feature Request] Rectangle from 3 corners

Post by balrobs »

paddle wrote: Fri Aug 12, 2022 7:02 am I solved this issue and fixed the preview line of the arc to be meaningful in 3p mode.
Issue solved :D
How about the shortened radii. Is this a deliberate change with respect to master?
master_paddle.png
master_paddle.png (21.37 KiB) Viewed 594 times
Many many thanks for working on FreeCAD!
User avatar
paddle
Veteran
Posts: 1364
Joined: Mon Feb 03, 2020 4:47 pm

Re: [Feature Request] Rectangle from 3 corners

Post by paddle »

Yes it was a deliberate choice. It looks better imo.
Post Reply