Feature request : round corner rectangle

About the development of the Part Design module/workbench. PLEASE DO NOT POST HELP REQUESTS HERE!
User avatar
paddle
Posts: 35
Joined: Mon Feb 03, 2020 4:47 pm

Feature request : round corner rectangle

Postby paddle » Thu Feb 06, 2020 9:49 am

Under the rectangle tool, adding a 'round corner rectangle' tool.

First and second click as in rectangle tool.
Openning a message-box to prompt for radius and preview of the fillet following mouse.
Optionally a tick box "Same radius for all corners". .
If this box is ticked then third click or pressing enter set the radius of the 4 fillets to the same dimensions with an egal constraint.
If this box is unticked, then third click set the angle of one corner, then message boxe prompt for next corner.

What do you think? It's a small tool, but could be usefull to make design faster.


Optionally a 'chamfered corner rectangle' tool could be also nice. Maybe less frequently of use, but it would not take much work to do as it would mostly be copy paste of the previous one.
edi
Posts: 51
Joined: Fri Jan 17, 2020 1:32 pm

Re: Feature request : round corner rectangle

Postby edi » Tue Feb 11, 2020 5:25 pm

Hello paddle,
I wrote a macro doing something similar to what you want.
The macro draws centered figures in sketcher: rectangle, square, rectangle with rounded corners, square with rounded corners, circle and hexagon.
Each figure can be drawn with or without constraints. If you coose "Add constraints" you can change the values of the constraints after drawing. The figures keep always centered.
How to use the macro:
1. Open a new sketch in SKETCHER or PART DESIGN
2. Start the macro
3. Select what you want to be drawn
4. Draw the figure by pressing "draw figure"
5. End the macro by pressing "close window"
CenteredFiguresInSketcher.FCMacro
(16.97 KiB) Downloaded 37 times
.
fc_tofu
Posts: 652
Joined: Sun Jan 05, 2020 4:56 pm

Re: Feature request : round corner rectangle

Postby fc_tofu » Fri Mar 20, 2020 8:05 pm

edi wrote:
Tue Feb 11, 2020 5:25 pm
Hello paddle,
I wrote a macro doing something similar to what you want.
The macro draws centered figures in sketcher: rectangle, square, rectangle with rounded corners, square with rounded corners, circle and hexagon.
Each figure can be drawn with or without constraints. If you coose "Add constraints" you can change the values of the constraints after drawing. The figures keep always centered.
How to use the macro:
1. Open a new sketch in SKETCHER or PART DESIGN
2. Start the macro
3. Select what you want to be drawn
4. Draw the figure by pressing "draw figure"
5. End the macro by pressing "close window"
CenteredFiguresInSketcher.FCMacro.
Thank you, guy.
I just tried you macro script. It prompted error message in Report View.
Traceback (most recent call last):
File "MacroUser/CenteredFiguresInSketcher.FCMacro", line 251, in <module>
rechteckSkizze() # Programm ausführen
File "MacroUser/CenteredFiguresInSketcher.FCMacro", line 18, in __init__
self.dialogFenster() # meine HauptFunktion
File "MacroUser/CenteredFiguresInSketcher.FCMacro", line 87, in dialogFenster
self.wait() # erzeugt eine Fehlermeldung, aber ohne diese Zeile bleibt das Fenster nicht offen
<class 'AttributeError'>: 'rechteckSkizze' object has no attribute 'wait'
Could you give it a look, please.

OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.20052 (Git)
Build type: Release
Branch: master
Hash: 6291921e9abe737e4440ff5814ca58547defadef
Python version: 3.8.2
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: Chinese/China (zh_CN)
chrisb
Posts: 25721
Joined: Tue Mar 17, 2015 9:14 am

Re: Feature request : round corner rectangle

Postby chrisb » Fri Mar 20, 2020 10:37 pm

Symmetry was quite often the cause of problems in the past. So I try to avoid them if possible. Here I need only one of them:
Attachments
Snip macro screenshot-592a88.png
Snip macro screenshot-592a88.png (8.03 KiB) Viewed 1166 times
leoheck
Posts: 375
Joined: Tue Mar 13, 2018 5:56 pm

Re: Feature request : round corner rectangle

Postby leoheck » Wed Apr 15, 2020 5:18 pm

I definitely agree in having this feature. The round corners square is something I always use.
adrianinsaval
Posts: 343
Joined: Thu Apr 05, 2018 5:15 pm

Re: Feature request : round corner rectangle

Postby adrianinsaval » Wed Apr 15, 2020 5:45 pm

edi wrote:
Tue Feb 11, 2020 5:25 pm
Hello paddle,
I wrote a macro doing something similar to what you want.
CenteredFiguresInSketcher.FCMacro.
Hi, this post made remember your macro so I tried it out today and I found it didn't work well when using stylesheets:
Anotación 2020-04-15 133737.png
Anotación 2020-04-15 133737.png (16.11 KiB) Viewed 837 times
So I added this line to it:

Code: Select all

         self.setPalette(FreeCADGui.getMainWindow().palette())
FreeCADGui was imported at the beginning as well.
And with that it looks fine:
Anotación 2020-04-15 133814.png
Anotación 2020-04-15 133814.png (14.89 KiB) Viewed 837 times
I attach the modified macro.
Attachments
CenteredFiguresInSketcher.FCMacro
(17.05 KiB) Downloaded 17 times
fc_tofu
Posts: 652
Joined: Sun Jan 05, 2020 4:56 pm

Re: Feature request : round corner rectangle

Postby fc_tofu » Sat Apr 18, 2020 3:40 pm

adrianinsaval wrote:
Wed Apr 15, 2020 5:45 pm
I attach the modified macro.
Great!
This tool is worth being known be more people.
fc_tofu
Posts: 652
Joined: Sun Jan 05, 2020 4:56 pm

Re: Feature request : round corner rectangle

Postby fc_tofu » Sat Apr 18, 2020 5:08 pm

edi wrote:
Tue Feb 11, 2020 5:25 pm
CenteredFiguresInSketcher.FCMacro.
I think you macro is a good replacement of the obsolete (and removed) Sketcher >Profile command.
How about changing your file name to:
Sketch_Proile.FCMacro
or,
Sketcher_Proile.FCMacro
chrisb
Posts: 25721
Joined: Tue Mar 17, 2015 9:14 am

Re: Feature request : round corner rectangle

Postby chrisb » Sat Apr 18, 2020 8:48 pm

fc_tofu wrote:
Sat Apr 18, 2020 5:08 pm
Sketch_Proile.FCMacro
or,
Sketcher_Proile.FCMacro
If at all you probably mean Sketch_Proifle.FCMacro or Sketcher_Profile.FCMacro. But for my taste that is far too global. Profiles are as far as I know used in lofts and sweeps, and can have arbitrary shapes. But using the prefix "Sketcher seems a good idea.
chrisb
Posts: 25721
Joined: Tue Mar 17, 2015 9:14 am

Re: Feature request : round corner rectangle

Postby chrisb » Sat Apr 18, 2020 9:09 pm

I just tested the macro and have the following remarks:
- The default should be AddConstraints checked.
- The constraints in the Rounded Rectangle should be revisited: The symmetry constraints consume only one DOF instead of two. That has lead in the past to troubles and if you generate them anyway you should avoid this. Using proper tangencies has turned out to work best if using such sketches in lofts and sweeps. I propose to constrain it like this, it means less constraints and less trouble:
Snip macro screenshot-5e2b7a.png
Snip macro screenshot-5e2b7a.png (10.44 KiB) Viewed 566 times
Similar holds for the rectangle, we recommend to use symmetry on the diagonal and you should do it in your macro as well.
Attachments
centered.FCStd
(5.45 KiB) Downloaded 12 times