[merged] PR #4835 New sketch object rounded rectangle

Post here if you have re-based and finalised code to integrate into master, which was discussed, agreed to and tested in other forums. You can also submit your PR directly on github.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: PR #4835 New sketch object rounded rectangle

Post by uwestoehr »

chrisb wrote: Mon Jun 07, 2021 10:00 pm I prefer to have my sketches as clean as possible, which includes to avoid more constraints than needed.
Exactly. So now you only get what you created - a rectangle.

When you need the rectangle parallel to a sketch axis, you only have to add one single constraint.
Having rectangles parallel to a sketch axis is an often use case but not the vast majority. With a preset horizontal constraint you are blocked by default and then have to remove these constraints and set the ones just to get a rectangle that is not parallel to an axis.

Therefore what I implemented is:
- in every case you get just a rectangle
- if you need it parallel to a sketch axis, add a constraint, these are 2 clicks more

What you want is the existing nasty behavior of the rectangle feature:
- you get always a rectangle parallel to a sketch axis
- if you don't want this, you need to remove 4 constraints and set 3 new constraints. These are in total 14 (sic!) clicks and keypresses.

The rounded rectangle is a feature whose aim is to speed up the construction work. Therefore it should really do this job by reducing the number of clicks and keypresses.
Last edited by uwestoehr on Wed Jun 09, 2021 11:14 am, edited 1 time in total.
chrisb
Veteran
Posts: 53785
Joined: Tue Mar 17, 2015 9:14 am

Re: PR #4835 New sketch object rounded rectangle

Post by chrisb »

How about this behaviour, which requires one additional click to satisfy both approaches:
- start with a first line defining the direction
- check if it is horizontal or vertical; this could be made dependent on having autoconstraints checked
- if so, use vertical and horizontal constraints
- if not, use orthogonal constraints

Please note that the vast majority of the models posted here in the forum, if using rectangles uses them with horizontal edges.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
doia
Posts: 251
Joined: Sat May 29, 2021 5:47 am
Location: Düsseldorf

Re: PR #4835 New sketch object rounded rectangle

Post by doia »

If I may add my 2 cents to this PR. I actually like a mix of your two approaches. Use a dropdown menu for a clean toolbar and provide options to create rectangles using different constrains as well as creating rectangles with rounded corners.

Here is my proposal for a possible dropdown menu with the following options:

- Rectangle
- Tilted Rectangle
- Rounded Rectangle
- Tilted Rounded Rectangle

FC_Sketcher_PR4835_menue-proposal_Zeichenfläche 1.png
FC_Sketcher_PR4835_menue-proposal_Zeichenfläche 1.png (42.91 KiB) Viewed 2899 times

The order would be to offer the standard rectangles with sharp corners first and after that rectangles with rounded corners.

Rectangle works as the current implementation with vertical/horizontal constraints, the rectangle is parallel to the origin axes. Creation of the rectangle is done with 2 clicks, start point and end point, which also sets the dimensions in x and y direction.

Tilted Rectangle uses the parallel and perpendicular constraints. This would align more to the mathematical definition of a rectangle, where each pair of adjacent sides is perpendicular and both pairs of opposite sides are parallel and equal in length.
The creation is done with 3 clicks:
1. Select start point (first click)
2. select the direction of the first side (second click), this would define the imaginary x axis of the rectangle and the length of the first pair of sides
3. select the length of the second pair of sides with the opposite side of the start point (third click)

Rounded Rectangle creation as default rectangle with v/h constraints, but uses third click to define radius of the corners.

Tilted Rounded Rectangle creation like tilted rectangle but with additional fourth step to define radius of corners.

I would avoid a „magical“ calculated switch between different constraint types on creation of the rectangle. I think this would confuse more than help, as the user might not get what her intend was.

Additional features could be:
- Cycle through the menu options with „M“ similar to the Polyline command (or other key), just press "R" and cycle through the options with "M"
- Have an option to input the desired dimension with values, e.g. for Rectangle set the start point and type „@12.5,34“ for dimensions in x and y direction -> similar to AutoCad functionality to quickly create rectangles with the desired dimensions
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: PR #4835 New sketch object rounded rectangle

Post by GeneFC »

We absolutely should NOT make the creation of a simple rectangle more complicated with extra drop-down menus, cycling through "M" keys, etc.

One simple scheme I have used and liked for decades is the drawing method in PowerPoint. If a line or rectangle is drawn with no extra action the shape is oriented exactly as drawn. If the Shift key is pressed during the mouse movement then the line or rectangle is oriented to an axis or 45 degrees to an axis.

I think this technique is also used in other drawing packages.

I do not know if this is easy or even possible in sketcher, but I would find it a lot more user friendly than complex menus and cycling keys.

Gene
User avatar
doia
Posts: 251
Joined: Sat May 29, 2021 5:47 am
Location: Düsseldorf

Re: PR #4835 New sketch object rounded rectangle

Post by doia »

GeneFC wrote: Tue Jun 08, 2021 2:02 pm We absolutely should NOT make the creation of a simple rectangle more complicated with extra drop-down menus, cycling through "M" keys, etc.
The creation of a simple rectangle as currently implemented would not change. The icon in the toolbar and shortcut key "R" would stay as is.

The dropdown menu and the possibility to tab through option via a second shortcut key would be added to allow for more flexibility during creation.
User avatar
M4x
Veteran
Posts: 1449
Joined: Sat Mar 11, 2017 9:23 am
Location: Germany

Re: PR #4835 New sketch object rounded rectangle

Post by M4x »

I think chrisbs proposal sounds like the way to go.
chrisb wrote: Tue Jun 08, 2021 4:10 am How about this behaviour, which requires one additional click to satisfy both approaches:
- start with a first line defining the direction
- check if it is horizontal or vertical; this could be made dependent on having autoconstraints checked
- if so, use vertical and horizontal constraints
- if not, use orthogonal constraints

[...]
user1234
Veteran
Posts: 3261
Joined: Mon Jul 11, 2016 5:08 pm

Re: PR #4835 New sketch object rounded rectangle

Post by user1234 »

M4x wrote: Tue Jun 08, 2021 8:46 pmI think chrisbs proposal sounds like the way to go.
+1
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: PR #4835 New sketch object rounded rectangle

Post by uwestoehr »

chrisb wrote: Tue Jun 08, 2021 4:10 am How about this behaviour, which requires one additional click to satisfy both approaches:
I'll have a look if this is feasible.

However, please note that I am proposing a new feature. Nobody is forced to use it or to change its actual habit.

Please also note why there was not such a feature and why I added it - it is a tool for power users:

I had to design 8 hours a day and this way learned how annoying it could be to make the same operations again and again while being under time pressure. Thus I came up with this quite selfish ;) - to speed up my designing. As 3D-printing guy, I need rounded rectangles all the time. Looking at the model I designed yesterday, it has exactly 4 rounded rectangles, 4 are parallel to the axes, while 4 are parallel to other lines which are not parallel to the axes. So we should not compare the use cases of rounded rectangles to normal rectangles.

Nevertheless, I like your idea for normal rectangles since this would enable me to use normal rectangles too when needing to be quick. Give me some days until I can have a look.
chrisb
Veteran
Posts: 53785
Joined: Tue Mar 17, 2015 9:14 am

Re: PR #4835 New sketch object rounded rectangle

Post by chrisb »

Thanks for considering. I see that it is a new feature, but as we see every now and then quite justified complaints about the UI, it would be good to handle all rectangles similarly, with or without rounded corners.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
M4x
Veteran
Posts: 1449
Joined: Sat Mar 11, 2017 9:23 am
Location: Germany

Re: PR #4835 New sketch object rounded rectangle

Post by M4x »

I get that it might sound / feel like one is improving something and than people are jumping in and "knowing everything better" (is it possible to say that in English? :roll: ). And of course everybody is free to work on something or not to.

To make it clear: I really love your engagement, especially regarding things you're working on because you've experienced something in your professional life.

I rather see this discussions as something to tweak already good ideas and make them even a little bit better, if possible :)
Post Reply