Feature request : round corner rectangle

About the development of the Part Design module/workbench. PLEASE DO NOT POST HELP REQUESTS HERE!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
paddle
Veteran
Posts: 1413
Joined: Mon Feb 03, 2020 4:47 pm

Feature request : round corner rectangle

Post by paddle »

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: 482
Joined: Fri Jan 17, 2020 1:32 pm

Re: Feature request : round corner rectangle

Post by edi »

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 150 times
.
fc_tofu
Posts: 653
Joined: Sun Jan 05, 2020 4:56 pm

Re: Feature request : round corner rectangle

Post by fc_tofu »

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
Veteran
Posts: 54201
Joined: Tue Mar 17, 2015 9:14 am

Re: Feature request : round corner rectangle

Post by chrisb »

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 3999 times
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
leoheck
Veteran
Posts: 1225
Joined: Tue Mar 13, 2018 5:56 pm
Location: Coffee shop

Re: Feature request : round corner rectangle

Post by leoheck »

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

Re: Feature request : round corner rectangle

Post by adrianinsaval »

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 3670 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 3670 times
I attach the modified macro.
Attachments
CenteredFiguresInSketcher.FCMacro
(17.05 KiB) Downloaded 92 times
fc_tofu
Posts: 653
Joined: Sun Jan 05, 2020 4:56 pm

Re: Feature request : round corner rectangle

Post by fc_tofu »

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: 653
Joined: Sun Jan 05, 2020 4:56 pm

Re: Feature request : round corner rectangle

Post by fc_tofu »

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
Veteran
Posts: 54201
Joined: Tue Mar 17, 2015 9:14 am

Re: Feature request : round corner rectangle

Post by chrisb »

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.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
chrisb
Veteran
Posts: 54201
Joined: Tue Mar 17, 2015 9:14 am

Re: Feature request : round corner rectangle

Post by chrisb »

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 3399 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 86 times
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply