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!
Post Reply
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Sketcher: Ellipse support

Post by abdullah »

A fifth, and I hope last, user input request: To set an ellipse angle constraint (phi constraint). Does it make sense any other combination of elements, other than ellipse and line (e.g. ellipse and cicle, ellipse and arc,...)? I think it does not, but I am newbie to CAD systems, so I ask...
ulrich1a
Veteran
Posts: 1957
Joined: Sun Jul 07, 2013 12:08 pm

Re: Sketcher: Ellipse support

Post by ulrich1a »

abdullah wrote:A fifth, and I hope last, user input request: To set an ellipse angle constraint (phi constraint). Does it make sense any other combination of elements, other than ellipse and line (e.g. ellipse and cicle, ellipse and arc,...)? I think it does not, but I am newbie to CAD systems, so I ask...
My two cents: only ellipse and line (axis).
abdullah wrote:A forth user input request: Does it make sense to select an ellipse and press the symmetry constraint? if yes, what should it do?
My first answer: No. The symmetry constraint asks about two points and the centre of symmetry (either third point or line). But then I thought about, if I want to make two points symmetric to the major axis, in this case it may be useful to select an ellipse as last input for a symmetry constraint.
I would expect the center point of the ellipse to be selectable. So the center point can be also used as input for the symmetry constraint. So it is possible to select either the center point (symmetric to point) or the whole ellipse (symmetric to major axis) as last input in the symmetry constraint. (Switching major and minor axis may then have unexpected results for the user. This point may need some more discussion.)
abdullah wrote:An a third user input request: What should the equality constraint do when selecting two ellipses? Same radii for both, same radii and same orientation (phi)?
I would use only same radii. This would allow easy construction of more than one ellipses with different orientation. This could be used for example for construction of wheels with elliptic holes.
abdullah wrote:Does it make sense to do equality constraint of an ellipse and other element ? I suppose it does not, but let me know.
No. If I want something like this, I would construct a construction line between center and circumference of the ellipse and use this construction line for an equality constraint.

I did not test your branch. My question: does the ellipse have a point on its circumference or in its focus? This may be useful.

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

Re: Sketcher: Ellipse support

Post by jmaustpc »

Edit: Ulrich posted while I was typing, I agree with him.
abdullah wrote:This auto-resize functionality helps there, so for example in a, the minor would be resized to the new value for the major (the new value being less than the original major and minor),
I can see what you are saying...on the one hand a user can just be expected to enter them in the correct order but on the other hand I can see your point...I would have to think more one this...I just worry that resizing the other radius might cause more confusion or issues ....if no one else has a definitive answer then I would say lets leave the auto resizing in there for now and only if it does become a problem later, then consider removing it or what else to do.
abdullah wrote:An a third user input request: What should the equality constraint do when selecting two ellipses? Same radii for both, same radii and same orientation (phi)?

Does it make sense to do equality constraint of an ellipse and other element ? I suppose it does not, but let me know.
To me I would suggest the behaviour should be similar to circle in which "equals" works on the radius, so the similar for ellipse is to equalise BOTH radii.
abdullah wrote:A forth user input request: Does it make sense to select an ellipse and press the symmetry constraint? if yes, what should it do?
Yes, but only in the same way as circle again, which means only by selecting the centre point...therefore it becomes a point symmetry rather than truly an ellipse symmetry.
abdullah wrote:A fifth, and I hope last, user input request: To set an ellipse angle constraint (phi constraint). Does it make sense any other combination of elements, other than ellipse and line (e.g. ellipse and cicle, ellipse and arc,...)? I think it does not, but I am newbie to CAD systems, so I ask...
I think it does for ellipse on ellipse, Ellipse on of course line and axis, I am not sure but I was thinking it could make sense to have angle able to reference two points (although this can be done now by inserting a construction line between the two points)....... from here my answer gets a bit complex......

I was talking to an advanced professional CAD user the other day about ellipse in sketcher. His general comment was that he thought (as much as is possible or sensible) we should have general constraints rather than too many geometry specific constraints. So for this philosophy you would perhaps from a users perspective just have one angle constraint that worked as angle currently does now but also provided phi for the ellipse. Do you think we really need phi and angle constraints as two different constraint icons or would just a simple angle suffice?

So this also leads into the next bit :-)
abdullah wrote:A fifth, and I hope last, user input request:
I can think of another....Parallel constraint...it should align phi for an Ellipse with reference to a line or axis or phi of another Ellipse...although being parallel gives two solutions, being symmetrical it would, I imagine, not make any difference for ellipse. :)

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

Re: Sketcher: Ellipse support

Post by jmaustpc »

ulrich1a wrote:I did not test your branch. My question: does the ellipse have a point on its circumference or in its focus? This may be useful.

Ulrich
Hi Ulrich

It has only a selectable point at centre.

it looks like this
ellipsetests4.jpg
ellipsetests4.jpg (79.82 KiB) Viewed 1692 times


regarding your comments on using the major axis for a symmetry, this and other reference to it (and for that matter also the minor axis), might be more intuitive if ellipse showed its own local major and minor axis that function in the gui a bit like the current global axes but not of infinite length. Hence you would then select the Ellipse axes rather than the ellipse its self.



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

Re: Sketcher: Ellipse support

Post by jmaustpc »

If an ellipse had its own local major/minor axes then when the sketch was in edit mode perhaps it could look something like this.
ellipsetests5.jpg
ellipsetests5.jpg (100.04 KiB) Viewed 1688 times
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Sketcher: Ellipse support

Post by jmaustpc »

Regarding the xpm icon for sketcher when in create ellipse mode...would you like this better? the ellipse major axis is angled about 45 degrees to the top right...looks more like an ellipse I think. Any opinions?

if anyone else want to see what this looks like, copy all the text at the end of this post starting at /* XPM */ and paste into a text editor then "save as", name it something and ad ".xpm" (dot xpm) to the name...then it will open as an xpm image file in any capable image application.

@ norm and yorik can we add xpm to either or both the allowed file types and image types in PHPBB?



here is the text...

/* XPM */
static const char *cursor_createellipse[]={
"32 32 3 1",
"+ c white",
"# c red",
". c None",
"......+.........................",
"......+.........................",
"......+.........................",
"......+.........................",
"......+.........................",
"................................",
"+++++...+++++...................",
"................................",
"......+.........................",
"......+.........................",
"......+.........................",
"......+.........................",
"......+.........................",
"......+..............#####......",
"..................###.....#.....",
"...............###.......##.....",
".............##..........##.....",
"...........##............##.....",
"..........##.....###....##......",
".........##.....#.#.....#.......",
"........##.....###....##........",
"........##...........##.........",
".......##..........###..........",
"......##........####............",
"......#.....####................",
"......######....................",
"................................",
"................................",
"................................",
"................................",
"................................",
"................................"};
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Sketcher: Ellipse support

Post by NormandC »

Sorry guys,

I have not taken the time to read the whole topic. I'll try to, but for now I'll share my opinion on this matter.

I am not too keen on adding ellipse-specific constraints. In my opinion all constraints should be as generic as possible and not be limited to a single type of geometry.

I understand that there may be no way to constrain an ellipse with the current set of constraints. But I wonder if it would not be best to add new sets of constraints that could be used for ellipse as well as for other types of geometry.

In the commercial parametric CAD packages I know of, you typically constrain an ellipse using its quadrants. Circle and arc quadrants can also be constrained. You can align quadrants of an ellipse or a circle using a vertical or horizontal align constraint. Those types of constraints can work on any points.

The length constraints can be set to quadrants of ellipses, circles and arcs. And the angle constraint can be applied to three points or two lines.

Now I understand that implementing such constraints in the Sketcher may be a major undertaking. Maybe a current compromise would be to add major and minor axes to the ellipse like Jim suggests, but have them be construction lines that cross the center point and have a "point on object" constraint on the quadrants of the ellipse? Would it actually be possible to constrain the end points to the quadrants of the ellipse?
ulrich1a
Veteran
Posts: 1957
Joined: Sun Jul 07, 2013 12:08 pm

Re: Sketcher: Ellipse support

Post by ulrich1a »

jmaustpc wrote:If an ellipse had its own local major/minor axes then when the sketch was in edit mode perhaps it could look something like this.
There could be two different approaches for this:
- red and green axis lines. Could give unexpected behavior for the user, if major and minor axis do exchange. (Should those local axes be available for constraints? Such a solution offers some possibilities and is more thats need to be programmed. :) )
- two blue construction lines. So major and minor axis does not play a role. (But then there is an additional construction line, which can be used for constraints.)

Ulrich
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Sketcher: Ellipse support

Post by NormandC »

normandc wrote:Maybe a current compromise would be to add major and minor axes to the ellipse like Jim suggests, but have them be construction lines
ulrich1a wrote:- two blue construction lines.
Great minds think alike. :ugeek: :D
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Sketcher: Ellipse support

Post by jmaustpc »

Hi Ulrich :)
one point on this
ulrich1a wrote:Could give unexpected behavior for the user, if major and minor axis do exchange.
the way Abdullah has coded it, it is not possible to exchange the major and minor axes.

At initial ellipse construction time
  • first click give the centre
  • the second click defines the major axis/radius
He has written code to not allow a minor radius to be larger than the major.

The user must rotate the major axis of the ellipse by 90 degrees if they want to switch orientation of the ellipse.

This gives a definitive solution to the ellipse and I though seemed to work well...but I would be happy to change to some other paradigm if all parties think its needed.

Jim
Post Reply