[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!
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 »

Because of beeing afraid of beeing misunderstood:

imho a object ( special case rectangle - here ) could always be intrinsic constraint ... the (intrinisc) constrains force the vertexes among themselves into a certian relationship.

... while some (rather) extrinsic constraints define the relative position of the given Object in relation to the origin or other objects of the 3d space the object is exsitng in.

What will happen if a vertex in the e.g. rectangle get's deleted or split ... ?

Just to keep in Mind.

Regards,
Stefan
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: PR #4835 New sketch object rounded rectangle

Post by abdullah »

Well, this is a first approximation to what can be the tool to remove the axis alignment:
RemoveAxesAlignment.gif
RemoveAxesAlignment.gif (325.91 KiB) Viewed 4685 times
bitacovir wrote: Sun Apr 04, 2021 1:00 pm Would you save this community from having to see once again one of my low quality icons? :D :D :D :mrgreen:
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: PR #4835 New sketch object rounded rectangle

Post by abdullah »

C_h_o_p_i_n wrote: Fri Jun 18, 2021 4:30 pm Because of beeing afraid of beeing misunderstood:

imho a object ( special case rectangle - here ) could always be intrinsic constraint ... the (intrinisc) constrains force the vertexes among themselves into a certian relationship.

... while some (rather) extrinsic constraints define the relative position of the given Object in relation to the origin or other objects of the 3d space the object is exsitng in.

What will happen if a vertex in the e.g. rectangle get's deleted or split ... ?

Just to keep in Mind.

Regards,
Stefan
There are some corners of what exactly to do with some constraints, but I think that what is shown above is in line with what you say.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: PR #4835 New sketch object rounded rectangle

Post by abdullah »

Of course, the commitment is not "make it rotatable by guessing what the user may want to constraint", but just "remove alignment to axes". This weaker commitment appears to match user expectations without too much automation.

So that not all are cheers:
RemoveAxesAlignment2.gif
RemoveAxesAlignment2.gif (406.17 KiB) Viewed 4662 times
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 14, 2021 7:14 pm Good point. Geometrically a rounded rectangle is a special case of a rectangle, and thus should maybe appear under the rectangle icon, not the slot.
However, the slot is a special case of a rounded rectangle, there 2 parallel lines have the length zero. And a circle is a special case of a slot :lol:
So you are right, maybe we don't group the rounded rectangle under the slot but under the rectangle.
Ok. Today I coded this tool to remove alignment with axes on a selection. It may not be absolutely polished yet, but it works nice with your rounded rectangle that I have modified to use horizontal/vertical constraints.

I do not have much time. If you could modify the PR (or make a new PR if you want to keep that one for the moment), so that:
1. The rounded rectangle is under the rectangle.
2. The rounded rectangle is created with horizontal/vertical constraints instead of parallel/perpendicular

then, I could merge this PR and my tool one after the other. What do you think?
chrisb
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Re: PR #4835 New sketch object rounded rectangle

Post by chrisb »

abdullah wrote: Sat Jun 19, 2021 7:06 am What do you think?
This is a very good balance between convenience and not too much automation. What would happen if you have a vertical constraint between two or all three of the arc centers?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: PR #4835 New sketch object rounded rectangle

Post by abdullah »

chrisb wrote: Sat Jun 19, 2021 8:34 am
abdullah wrote: Sat Jun 19, 2021 7:06 am What do you think?
This is a very good balance between convenience and not too much automation. What would happen if you have a vertical constraint between two or all three of the arc centers?
As for now, alignment constraints (vertical/horizontal on points) are left in the model unchanged. I do not think there is "a way" to handle these constraints transparently in a general case. I think this belongs to the user.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: PR #4835 New sketch object rounded rectangle

Post by abdullah »

chrisb wrote: Sat Jun 19, 2021 8:34 am
abdullah wrote: Sat Jun 19, 2021 7:06 am What do you think?
This is a very good balance between convenience and not too much automation. What would happen if you have a vertical constraint between two or all three of the arc centers?
My idea ATM is to merge it and let you guys play with it. You will tell me how it goes.

Of course we can improve it. There will be corner cases (there might be a huge corner I did not test too :lol: ).

For me it was sufficient that it covers the general case of existing complex geometries, as this enables to split creation following stable constraints from creation following convenient constraints and avoid having to provide specific code for each.

If there is demand from users wanting the convenient as default, we can add a preference to run the tool just after the creation of the complex geometry. However, the tool works in one direction only, from stable to convenient...
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 »

abdullah wrote: Fri Jun 18, 2021 12:46 pm The "issue" (very small one):Arcs represented when creating (drawsketchhandler) are not the same size as the arcs that appear after hitting the mouse button.
Yes, this the issue I am aware of and which I cannot resolve and thus requested for help. I must have a thinko somewhere in my code. I had now a look again but still cannot find out what I am doing wrong.
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 »

abdullah wrote: Sat Jun 19, 2021 7:06 am I do not have much time. If you could modify the PR (or make a new PR if you want to keep that one for the moment), so that:
1. The rounded rectangle is under the rectangle.
2. The rounded rectangle is created with horizontal/vertical constraints instead of parallel/perpendicular
then, I could merge this PR and my tool one after the other.
Very good. I will start doing this hopefully tomorrow.

And your rotateable tool is very nice!
Post Reply