Feature Request: Extend equality restriction in the sketcher.

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
chrisb
Veteran
Posts: 54311
Joined: Tue Mar 17, 2015 9:14 am

Re: Feature Request: Extend equality restriction in the sketcher.

Post by chrisb »

jruiz wrote: Thu Apr 16, 2020 9:13 pm ...Ah! and the sometimes discused inequality restrictions would no longer be needed...
I think that flipping sketches would not exist anymore...
That indeed would justify a lot of effort!
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
jruiz
Posts: 480
Joined: Tue Oct 28, 2014 1:07 pm
Contact:

Re: Feature Request: Extend equality restriction in the sketcher.

Post by jruiz »

chrisb wrote: Fri Apr 17, 2020 12:28 am
jruiz wrote: Thu Apr 16, 2020 9:13 pm ...Ah! and the sometimes discussed inequality restrictions would no longer be needed...
I think that flipping sketches would not exist anymore...
That indeed would justify a lot of effort!
What would be the next step(s) for this request to be considered for a possible implementation?
I have uploaded many FreeCAD video tutorials to my YouTube channel
chrisb
Veteran
Posts: 54311
Joined: Tue Mar 17, 2015 9:14 am

Re: Feature Request: Extend equality restriction in the sketcher.

Post by chrisb »

Let's discuss this here a bit further and then write a constructive feature request. Can you give examples where the new proportional constraint would prevent flipping?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
jruiz
Posts: 480
Joined: Tue Oct 28, 2014 1:07 pm
Contact:

Re: Feature Request: Extend equality restriction in the sketcher.

Post by jruiz »

chrisb wrote: Sat Apr 18, 2020 12:27 pm Let's discuss this here a bit further and then write a constructive feature request. Can you give examples where the new proportional constraint would prevent flipping?
Lets see if the attached files fulfill the the Idea (hipothesis).
Consider first the file equality.FCStd.
The fully constrained sketch severalLocalSolutionsSketch has several local solutions :), one of them is the shown one.
It has a constraint named totaLength.
Suppose that the length named aQuarterOfTotalLength is desired be equal to tolalLength/4.

If totalLength is modified from its initial value of 200mm to 20mm, the sketch flips and aQuarterOfTotalLength length would be equal to tolalLength/2 (=10 mm in this case)

Now consider the file proportionalTest.FCStd:
Three of four small horizontal lines have equality constraints and one of them has has a constraint aQuarterOfTotalLength equal to tolalLength/4.
  1. Now in the sketch proportionalitySketch, modify the constraint tolalLength from 200 mm to 20 (and recompute).
  2. We see that proportionalitySketch does not flips and we get the desired solution: aQuarterOfTotalLength keeps its value equal to (the current value of) tolalLength/4.
Attachments
equality.FCStd
(6.32 KiB) Downloaded 20 times
proportionality.FCStd
(6.34 KiB) Downloaded 22 times
Last edited by jruiz on Mon Apr 20, 2020 2:56 pm, edited 2 times in total.
I have uploaded many FreeCAD video tutorials to my YouTube channel
User avatar
jruiz
Posts: 480
Joined: Tue Oct 28, 2014 1:07 pm
Contact:

Re: Feature Request: Extend equality restriction in the sketcher.

Post by jruiz »

chrisb wrote: Sat Apr 18, 2020 12:27 pm Can you give examples where the new proportional constraint would prevent flipping?
With the attached file aSlightlyDifferentProportionalityTest.FCStd a slightly proportionality test from the one made before with proportionalityTest.FCStd file can done.
Modify again the constrained dimension totalLength from its current value of 200 mm to 20 mm and recompute the sketch: The sketch does not flip and the porportion between the dimension keep unaltered.
Just made this sketch to highlight a little more what this "proportionality" restriction could made for the sketches...
Attachments
aSlightlyDifferentProportionalityTest.FCStd
(6.56 KiB) Downloaded 20 times
I have uploaded many FreeCAD video tutorials to my YouTube channel
User avatar
jruiz
Posts: 480
Joined: Tue Oct 28, 2014 1:07 pm
Contact:

Re: Feature Request: Extend equality restriction in the sketcher.

Post by jruiz »

chrisb wrote: Sat Apr 18, 2020 12:27 pm Let's discuss this here a bit further and then write a constructive feature request. Can you give examples where the new proportional constraint would prevent flipping?
Reduced unit:
As I mentioned in a previous message, this "proportionality" restriction could be used for defining what is called in other fields of sciences, Reduced Units.
Adopting this way of working, by setting a reduced unit, the sketches can be resized immediately (modifying just one parameter) and without the risk for the skecth to flip.

In the attached file reducedUnits.FCStd, edit the sketch and modify several times the constraint named reducedUnit as you want, then recompute the sketch each time and watch the effect caused on the sketch.


As you see, there are several dimensions shown in the sketch. With the "proportionality" restriction just one dimension would be shown. The other ones would be replaced by a small symbol (i. e. like the one used for equality restriction) indicating that such restrictions are being used.
Attachments
reducedUnits.FCStd
(6.68 KiB) Downloaded 17 times
I have uploaded many FreeCAD video tutorials to my YouTube channel
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Feature Request: Extend equality restriction in the sketcher.

Post by DeepSOIC »

i'm all for.

I've been meaning to make it for a long time actually, along with equality/ratio constraint for arbitrary datums such as angles. Still haven't got to it =(
chrisb
Veteran
Posts: 54311
Joined: Tue Mar 17, 2015 9:14 am

Re: Feature Request: Extend equality restriction in the sketcher.

Post by chrisb »

Sorry for being late, but this topic deserves more than just a short reply.
jruiz wrote: Sat Apr 18, 2020 3:46 pm Now consider the file proportionalTest.FCStd:
Three of four small horizontal lines have equality constraints and one of them has has a constraint aQuarterOfTotalLength equal to tolalLength/4.
  1. Now in the sketch proportionalitySketch, modify the constraint tolalLength from 200 mm to 20 (and recompute).
  2. We see that proportionalitySketch does not flips and we get the desired solution: aQuarterOfTotalLength keeps its value equal to (the current value of) tolalLength/4.
I think you uploaded the wrong file, it doesn't have the promised 1/4 length and thus flips here as well, but I get the point. So in these cases a proportional constraint can help. However, it does not solve the flipping completely.

Consider a lid of a case.
Snip macro screenshot-a56fdb.png
Snip macro screenshot-a56fdb.png (5.63 KiB) Viewed 707 times
The width of a wall of the box is always 10mm. For different sized boxes I want to change the 200mm to some other value, e.g. 20. Then the Sketch can flip (alas, today it doesn't, but a flipped sketch would have the same set of constraints) and a proportional constraint would not help.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
jruiz
Posts: 480
Joined: Tue Oct 28, 2014 1:07 pm
Contact:

Re: Feature Request: Extend equality restriction in the sketcher.

Post by jruiz »

chrisb wrote: Mon Apr 20, 2020 7:19 am I think you uploaded the wrong file, it doesn't have the promised 1/4 length and thus flips here as well,
It was the file I wanted to send.
What length do you get when you change the value of totalLength constraint from 200 mm to 20 mm? (I get 5 mm here)
Did you recompute the sketch?
The sketch seems to be flipped before the recomputation is made.
chrisb wrote: Mon Apr 20, 2020 7:19 am So in these cases a proportional constraint can help.
I agree with you :)
chrisb wrote: Mon Apr 20, 2020 7:19 am However, it does not solve the flipping completely.
I agree with you again :)
I "knew"/felt that something was missing.
This "porportionality" restriction along does not make the whole work of preventing the flipping of the sketches.

Another restriction, call it by now appending restriction, to cover (I hope) all flanks in total, is needed.
Let me try to explain what I am talking about using your example:
chrisb wrote: Mon Apr 20, 2020 7:19 am The width of a wall of the box is always 10mm. For different sized boxes I want to change the 200mm to some other value, e.g. 20. Then the Sketch can flip (alas, today it doesn't, but a flipped sketch would have the same set of constraints) and a proportional constraint would not help.
In the sketch of attached file appendingConstraint.FCStd
There exist an appending constraint betwee totalWidth and partialWidth.
That is totalWidth = partialWidth + 10mm (10mm is what you want to keep as a constant )

So another feature request was born:

Feature request: Appending restriction.
How difficult would it be to implement an Appending restriction between to dimensions La, Lb and a third parameter P, so that La be equal to Lb + P?
La = Lb + P.

PS: Maybe these constraints could be combined in just one, call it linearity restriction ... but it seems not to be the right time to request for it now :)
Attachments
appendingConstraint.FCStd
(6.07 KiB) Downloaded 19 times
Last edited by jruiz on Mon Apr 20, 2020 1:31 pm, edited 1 time in total.
I have uploaded many FreeCAD video tutorials to my YouTube channel
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Feature Request: Extend equality restriction in the sketcher.

Post by DeepSOIC »

jruiz wrote: Mon Apr 20, 2020 1:21 pm So another feature request was born:

Feature request: Appending restriction.
At this point, i'd promote the request to expression-powered constraint. Adding more of these expression-like constraints is not looking productive to me.
Post Reply