Sketcher: Ellipse support

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
ulrich1a
Veteran
Posts: 1957
Joined: Sun Jul 07, 2013 12:08 pm

Re: Sketcher: Ellipse support

Post by ulrich1a »

abdullah wrote:2. Still unimplemented: Select Ellipse, select line => set an angle relationship with this line. Do you think this constraint should be absolute (the 30º) or relative (any 30 degrees, even the extended also 150, -150,...)??
Here is clearly preferred the absolute angle. The sketcher tends to have multiple solutions for many type of constraints. This causes flipping the sketch to something totally unusable at changing constraints values over a broader range. The absolute angle is one of the few constraints that can be used to get stable sketches.

You may have a look into the sketcher tutorial. It shows some of the issues, the user has to deal with, at making reusable designs with the sketcher.

Ulrich
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Sketcher: Ellipse support

Post by jmaustpc »

I have been trying the think what I would prefer and have not replied as I was not sure.

At first I agreed with Ulrich, then I changed then I agreed again. Now I have decided.

I like absolute and consistent behaviour. I have in the past come across annoying constraints with two solutions, like Ulrich said, that when you later edit one constraint the sketch suddenly decided to take the "other" solution and flip the sketch or place something just wrong in some way or another.

I have a suggestion, what if we changed it from working like the current "internal" angle to an absolute something like Part wb, where 0 is 3 o'clock position relative to the first selection and the angle increases anti-clock wise all the way around to 360 degrees. Further, I suggest that we also take into account the selection order (like Part Cut), so the angle is always from first selection anti clockwise to the second selection. Then the user has complete control over if they want an internal or external angle, without any need for a specific internal and external angle constraint.

If everyone agrees to this, then I would definitely also vote to change the current angle constraint to work as I have suggested here for the Ellipse axis constraint, as well. I think it removes sketch flipping and inconsistent unreliable/undefined behaviour.

what do you all think?

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

Re: Sketcher: Ellipse support

Post by abdullah »

I have a suggestion, what if we changed it from working like the current "internal" angle to an absolute something like Part wb, where 0 is 3 o'clock position relative to the first selection and the angle increases anti-clock wise all the way around to 360 degrees. Further, I suggest that we also take into account the selection order (like Part Cut), so the angle is always from first selection anti clockwise to the second selection. Then the user has complete control over if they want an internal or external angle, without any need for a specific internal and external angle constraint. 
Sorry Jim, I do not fully understand... think you are explaining it to someone that has never used FreeCAD!! :lol:

0 is 3:00 with respect to first selection... and where is the first selection? At 00:00, at 06:00? No -30º, if I understand ok, but 330º. I understood the part of selection dependent...

Do you mean that angles are always positive in the range 0-360º, always counterclockwise and always measured from the first element selected? This makes sense to me... what you other users think?

Where may I find that sketcher tutorial?
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Sketcher: Ellipse support

Post by jmaustpc »

abdullah wrote:Sorry Jim, I do not fully understand... think you are explaining it to someone that has never used FreeCAD!! :lol:

0 is 3:00 with respect to first selection... and where is the first selection? At 00:00, at 06:00? No -30º, if I understand ok, but 330º. I understood the part of selection dependent...
I don't mean pu the clock positions in the gui or anything, just explaining where they are in general terms.
abdullah wrote:Do you mean that angles are always positive in the range 0-360º, always counterclockwise and always measured from the first element selected? This makes sense to me... what you other users think?
Yes that's what I mean :)
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Sketcher: Ellipse support

Post by jmaustpc »

This is Part Circle, its angles are relative to the x axis by default, the ellipse axis would be relative to the second selection .... but it demonstrates what we are talking about here.

The first Circle is 360 degrees the second is 10 and the last is 80 degrees. These would be similar to a representation of the Ellipse axis constraint.
Partcircle4.jpg
Partcircle4.jpg (54.93 KiB) Viewed 1749 times
ulrich1a
Veteran
Posts: 1957
Joined: Sun Jul 07, 2013 12:08 pm

Re: Sketcher: Ellipse support

Post by ulrich1a »

abdullah wrote:Where may I find that sketcher tutorial?
The FreeCAD-Tutorials have a page in the Wiki: http://www.freecadweb.org/wiki/index.ph ... =Tutorials
The Sketcher Tutorial is here: http://www.freecadweb.org/wiki/index.ph ... r_Tutorial

Ulrich
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Sketcher: Ellipse support

Post by jmaustpc »

He is a quick demo of what I am thinking with ellipse axis constraint. I have posted the svg file in case someone might find it useful, I thought some one might was to modify it to demonstrate what they are thinking. I will post some other scenarios tomorrow but I have to go now.

One of the things about this is that using selection order allows you to define via the external or internal angle easily. In this simple example the angle is more obvious, but if the reference line continued well to the left and right of the ellipse it might be more complex to decide where to show the angle if it was relative and not absolute.

Ellipse_demos.png
Ellipse_demos.png (9.96 KiB) Viewed 1742 times
and here is the SVG file from which the above was exported.
Ellipse_demos.svg
(10.82 KiB) Downloaded 57 times
Jim
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Sketcher: Ellipse support

Post by abdullah »

The FreeCAD-Tutorials have a page in the Wiki: http://www.freecadweb.org/wiki/index.ph ... =Tutorials
The Sketcher Tutorial is here: http://www.freecadweb.org/wiki/index.ph ... r_Tutorial
Thanks!! I did not know there was such a compilation of "problems with constraints". I had a fast look at it. But I plan to revisit it in the future (specially if I decide to look further into the solver).
He is a quick demo of what I am thinking with ellipse axis constraint. I have posted the svg file in case someone might find it useful, I thought some one might was to modify it to demonstrate what they are thinking. I will post some other scenarios tomorrow but I have to go now.
I thought I had understood you, but after seen the pictures I think I haven't.

In case 1, by clicking the ellipse first then the line and entering 45 degrees, I would have understood that you wanted to have the line 45 degrees counterclockwise with respect to the ellipse (so actually what you show in case 2).

In case 2, by click the line first then the ellipse and entering 45 degrees, I would have understood that you wanted a 45 counterclockwise angle with respect to the line, so like in the figure of case 1...
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Sketcher: Ellipse support

Post by jmaustpc »

abdullah wrote:I thought I had understood you, but after seen the pictures I think I haven't.

In case 1, by clicking the ellipse first then the line and entering 45 degrees, I would have understood that you wanted to have the line 45 degrees counterclockwise with respect to the ellipse (so actually what you show in case 2).

In case 2, by click the line first then the ellipse and entering 45 degrees, I would have understood that you wanted a 45 counterclockwise angle with respect to the line, so like in the figure of case 1...
Hi Abdullah

My logic for case 1 went like this below, remember that I am talking about a reference line but that "line" could have been an axis.

To me it follows the same logic as most things....select the thing you want to do something to and then tell FreeCAD what to do with it.

Its the same logic with symmetry constraint. If you have three points, you first select the "things" to be constrained ...and the third selection is the centre point of the symmetry.

1) select the "thing" (in this case Ellipse) that you want to do something with (in this case constrain)
2) tell the computer what you want to do (in this case apply "Ellipse axis constraint" but it could have been delete for example) with the thing (ellipse) you have selected.
3) the job to do here selected in 2) is apply an "ellipse axis constraint" which then requires the further input of a reference (which in this case is the line) so you would then select the reference line

In case 1) you are doing something to the ellipse ....conversely by my logic in case 2 you are in effect "doing something" to the reference line ...because the end result is that the reference line in case 2 ends up on the anti-clockwise side of the Ellipse.

My logic of angles is based around Part Circle where angles move anti clockwise and the number gets bigger, and zero by default is at the 3 o'clock position, 90 degrees is at 12 o'clock 180 degrees is at 9 o'clock, 270 goes around 3/4 of the way around to the 6 o'clock position.

Does it sound logical to you now with my explanation?

But all of the above is my opinion, I would not say I am definitely correct. :)


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

Re: Sketcher: Ellipse support

Post by abdullah »

Does it sound logical to you now with my explanation?
It is logical...
My logic of angles is based around Part Circle where angles move anti clockwise and the number gets bigger, and zero by default is at the 3 o'clock position, 90 degrees is at 12 o'clock 180 degrees is at 9 o'clock, 270 goes around 3/4 of the way around to the 6 o'clock position.
This part is extremely logic to me. I always would want it counter-clock-wise, and my zero, from elemental geometry, is always in the X axis. Forcing it to be definite positive [0,360] is not much of a deal (yes, I like -180, 180), but I can certainly live with it, specially if it is convenient to avoid lines from flipping...
Let's say that pushing the button means "hey! constraint A with reference to B using the positive angle I am giving you, so that A will end in a counter-clock-wise position relative to B, the relative position therebetween corresponding to that positive angle
Case 1: I select the ellipse first so I constraint it with respect to the reference line. So for example if I would start with an original situation as the second figure, I select first the ellipse and then the line and give 45º, I will get to an end result of figure 1.

The "problem" (more of an inconvenience to the user) is adapting to this way of working... but this is certainly not for me to decide (I am such a newbie that I can adapt to anything).

Lets restrict to ellipse angles (not normal angles). I will (try to) implement this. Then I will release the code. Then I would ask the good people of the FreeCAD community, users and lead developers and everything in between for feedback on this feature. Then it is also for then to decide if they want to move to this way of working also for normal angles or not (and also if I change the ellipse angle constraint or not, of course).

Now changing the topic. I have this (which was an xpm of a circle that I tried to convert to an ellipse using a text editor with not much luck or with better said with much lack, of skills). It is the image you see during creation of an element on the inventor view. I could certainly use the help of a more skilled artist:

static const char *cursor_createellipse[]={
"32 32 3 1",
"+ c white",
"# c red",
". c None",
"......+.........................",
"......+.........................",
"......+.........................",
"......+.........................",
"......+.........................",
"................................",
"+++++...+++++...................",
"................................",
"......+.........................",
"......+.........................",
"......+.........................",
"......+.........................",
"......+.........................",
"......+........#######..........",
"..............#.......#.........",
"............##.........##.......",
"..........##.............##.....",
"........##.................##...",
"......##.........###.........##.",
"......#..........#.#..........#.",
"......##.........###.........##.",
"........##.................##...",
"..........##.............##.....",
"............##.........##.......",
"..............#.......#.........",
"...............#######..........",
"................................",
"................................",
"................................",
"................................",
"................................",
"................................"};
Post Reply