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

Re: PR #4835 New sketch object rounded rectangle

Post by chrisb »

M4x wrote: Wed Jun 09, 2021 9:04 pm I get that it might sound / feel like one is improving something and than people are jumping in and "knowing everything better"
There are different motivations behind developing new things for free software. One of them is to add something which the developer needs or wants himself.
If he augments only his own build, then there is nothing to be discussed. In a professional environment that would be individual software for an individual customer.

If the improvement is something of general interest - as it is in this case - then it is of course appreciated if it is added to the community version. In a professional environment that is where the product manager comes into play: He streamlines the new function so that all customers can benefit from it. The result may be something which is slightly different from what the requester has originally wanted.

In FreeCAD development there is no product manager, so things are left to the merger - or they are discussed with the community; and this can happen at different stages, which makes it more or less "cosy". If you look at the procedure of Abdullah's latest improvements, you see that he starts discussions way before creating a pull request. That makes it easier to develop a solution incorporating the ideas of different users with different workflows.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
Pauvres_honteux
Posts: 728
Joined: Sun Feb 16, 2014 12:05 am
Location: Far side of the moon

Re: PR #4835 New sketch object rounded rectangle

Post by Pauvres_honteux »

In some future scenario one could possibly couple this with some "snapping suggestions" as proposed here:
Pauvres_honteux wrote: Sat May 01, 2021 5:04 am
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: PR #4835 New sketch object rounded rectangle

Post by abdullah »

uwestoehr wrote: Mon Jun 07, 2021 2:02 pm
chrisb wrote: Mon Jun 07, 2021 6:33 am Wouldn't it better match the existing geometric constructors if you use the common vertical and horizontal constraints?
I purposely did not do this. It annoys me that I have these constraints by default for rectangles. When I want to create a rectangle, well then I want to get a rectangle, nothing else. It is time-consuming to replace the horizontal/vertical constraints of the rectangles by parallel and perpendicular ones to get the rectangle I need. That's why I don't use the rectangle feature rarely (and the consecutive lines feature instead).

With my implementation you can add just one single constraint and get the rectangle parallel to a sketch axis if you need this.

So for the user interface we may have a drop down menu with Rectangle - Rounded Rectangle - Tilted Rectangle - Tilted Rounded Rectangle.
Please not. The UI should be clean. When the difference is just a single constraint, it is not worth to stuff the UI with all these different cases.
I think the idea is great. Let's have a look.

Both of you have very valid points. As a user I would like to have one tool to rule them all. As a user I would like to have the most stable tool. Parallel and perpendicular are not as stable. Two tools is just another button...some parts of the sketcher start looking as "buttonland".

I am still to look at the code and give it a run. So I may change my mind after actually using it. I am probably biased by previous code.

My biased preconceived opinion is that:

Because most of the times I tend to have the axis parallel to sides, I would prefer to have the choice of the legacy behaviour for stability (horizontal/vertical). However, those times where I have to draw a rotated rectangle, FC looks to me rather primitive and click intensive, so I would definitely like to have the second behaviour "on click away". I would not like to pay an extra base line (as suggested a couple of posts after the one I am quoting) on each rectangle, this is "click overhead" for me.

Without extra clicking or extra buttons, I do not quite see how a computer may read my mind an know if I want a rotatable rectangle or an stable one. Here, I would try to leverage the knowledge from this thread. Some users do rotated rectangles 80% of the time, others do axis aligned ones 80% of the time. It is not that these users want to give away to have what the others want, rather they do not want the hassle to have to make a choice everytime... Maybe then, it is a good alternative to have both options (in general terms all options, rectangle, rotatable rectangle, rounded rectangle, rotatable rounded rectange), but have FreeCAD remember the user's last choice.

So:
1. People doing 3D printing but mostly using axis aligned rectangles, (...)
2. People doing 3D printing and using mostly rotatable rectangles, (...)
3. People who want to use Part Design to introduce this rounded edges and mostly using axis aligned rectangles, (...)
4. People who want to use Part Design to introduce this rounded edges and using mostly rotatable rectangles, (...)

(...) select this once and it becomes the default until the user changes it again.

Codewise, most of the code is common, so it should be possible to reuse a lot of code. But that is an implementation issue, not a user concern. First, let's see what makes sense from a user perspective.

Hopefully, I can take a look to the code tomorrow morning.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: PR #4835 New sketch object rounded rectangle

Post by abdullah »

Hi,

I looked at the code. Save for the handler/final result inconsistency, it is ok and it is very useful. I can tell you that the inconsistency is not due to the solver moving you result, so I guess it is in the drawing while moving. Maybe in the xi, yi. Not sure, did not have enough time to look into it.

I have some reflections before merge.

Is a slot a class of rounded rectangle? It is a rounded rectangle a class of rectangle? The current grouping of toolbar buttons is that the rounded rectangle goes together with the slot. Though I can see the geometric similarity, I am not sure it is where a user would expect it.

The other observation is about the discussion of "more buttons" vs "more complex constraints". Looking at the other PR about the slot, I think I am beginning to see a pattern. Composed shapes are generally best constrained using horizontal/vertical, but sometimes we want to make the rotatable.

It appears to be room for a new tool that "changes" the constraints of a composed shape to allow it to rotate. I did not give it enough thought, but it appears that it is all about changing horizontals with parallels, verticals with parallels and linking one vertical and one horizontal with a perpendicular constraint. So, it could work by selecting a bunch of geometries and operating the modifications on it.

This more general tool would be applicable not only to predefined composed geometries, but to user created geometries. This means that if a user made one composed/complex shape and then he or she must rotate it, FC takes care of the constraint modification.

If this tool is feasible, it would pay off to create complex shapes in the more stable form, and have those where a conversion is necessary to make them rotatable converted. This simplifies the code, reduces the code footprint, enhances code maintainability and avoids having to clutter the UI with buttons for combinations of desired results.

How does this sound? Could I have some feedback?
Svet
Posts: 42
Joined: Fri Feb 12, 2021 1:00 am
Location: USA, Texas

Re: PR #4835 New sketch object rounded rectangle

Post by Svet »

This more general tool would be applicable not only to predefined composed geometries, but to user created geometries. This means that if a user made one composed/complex shape and then he or she must rotate it, FC takes care of the constraint modification.
It will be GREAT improvement to sketcher that will save a lot of time in some workflows!
User avatar
Pauvres_honteux
Posts: 728
Joined: Sun Feb 16, 2014 12:05 am
Location: Far side of the moon

Re: PR #4835 New sketch object rounded rectangle

Post by Pauvres_honteux »

abdullah wrote: Sun Jun 13, 2021 6:08 am
This more general tool would be applicable not only to predefined composed geometries, but to user created geometries.
... and avoids cluttering the UI with buttons ...
Extra big +1 from me! ;)
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 »

abdullah wrote: Sun Jun 13, 2021 6:08 am This more general tool would be applicable not only to predefined composed geometries, but to user created geometries. This means that if a user made one composed/complex shape and then he or she must rotate it, FC takes care of the constraint modification.
+1, perfect combination IMHO
chrisb
Veteran
Posts: 53785
Joined: Tue Mar 17, 2015 9:14 am

Re: PR #4835 New sketch object rounded rectangle

Post by chrisb »

Above all I want to have the best sketches possible and not the best user interface. The reasons are simple: I want maximum stability and I want to be able to look at the sketch in 5 or 10 years from now and still say it is perfectly constraint. And then I will not think about how the UI was and how many buttons there were.

That having said, I nevertheless want a comfortable UI too :mrgreen: .

Your approach definitely fulfilles the first requirement. And if the second works it would be great! I cannot really say if such a make-rotatable function wouldn't do too much fancy tricks in the background so that I have the feeling of loosing control.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
C_h_o_p_i_n
Posts: 225
Joined: Fri Apr 26, 2019 3:14 pm

Re: PR #4835 New sketch object rounded rectangle

Post by C_h_o_p_i_n »

Hi All,

imho any geometrical objects (primitives) should/might be intrinsic constrained:

a rectangle e.g. using coincidence,parallel,orthogonal and length constraints.
a paralleogram using coincidence parallel, length an angle constraints.
a circle by radius or diameter. ( the mentioned slot by coincidence, prallel & length constraints and identical radius on both sides ) .
a poligon using coincidence, angle, parallel,.... length constraints.

and so on ...

"horizontal", "vertical" are imho just special named cases of "parallel" referring to a coordinate origin.

one could think of using them only to lock an vertex of an the already constrained objects to an coordinate.

Just as idea.

Regards, Stefan
edi
Posts: 481
Joined: Fri Jan 17, 2020 1:32 pm

Re: PR #4835 New sketch object rounded rectangle

Post by edi »

chrisb wrote: Mon Jun 07, 2021 4:59 am We may hear edi's comments, athor of the original macro CenteredFiguresInSketcher.FCMacro
edi wrote: Thu Aug 13, 2020 2:41 pm Attached the latest revised version of the script.
IMO desirable features are a centered rectangle and a centered rounded corner rectangle. Unfortunately the "Create regular polygon" feature is not able to do this.

Attached find a macro creating a centered rounded corner rectangle. (A preversion working only in the x/y plane, showing no special cursor). The edges are horizontal and vertical.

freeCad_small_600ms.gif
freeCad_small_600ms.gif (71.23 KiB) Viewed 2797 times
PointSymetricRoundedRectangle01.FCMacro
(5.91 KiB) Downloaded 60 times
Workflow:
- open a sketch in the x/y plane
- start the macro
- select the center of the rounded rectangle
- select a fictive corner of the rounded rectangle

Benefits:
- the figure can be streched keeping the contraints
- the figure can be moved and/or fixed using the center point
- fictive corners can be fixed using two times the "PointOnObject" constraint (as shown in the post above)
Post Reply