Sketcher: Ellipse support

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
abdullah
Posts: 3582
Joined: Sun May 04, 2014 3:16 pm

Re: Sketcher: Ellipse support

Postby abdullah » Mon Oct 27, 2014 4:06 pm

jmaustpc wrote: The only question that leaves is should the conics drop down show just the default most common geometry initially and move the last used to the top in the same way as the other grouped drop down icons work? presumably, yes. Or should should there be a conics icon to click on to get to the list, thus always forcing two clicks, presumably not.
As I just implemented it (as far as I can see or not the icons) and you will see after compilation, by default it is the default conics icon that if press executes Marktaff's ellipse creation method. From that moment on, the last used icon is shown. This behaviour can be changed (it is not a big deal)...

...happy testing!! :)
User avatar
saso
Posts: 1586
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Sketcher: Ellipse support

Postby saso » Mon Oct 27, 2014 5:30 pm

jmaustpc wrote:The only question that leaves is should the conics drop down show just the default most common geometry initially and move the last used to the top in the same way as the other grouped drop down icons work? presumably, yes.
+1
User avatar
DeepSOIC
Posts: 7829
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Sketcher: Ellipse support

Postby DeepSOIC » Mon Oct 27, 2014 5:49 pm

OK. Compiled, run and immediately something popped out. some expected, some not.
1. Mark's creation method still limits itself to a circle when I try to draw b>a. Such a circular ellipse with all internal geometry often becomes locked and confuses the solver.
2. It is funny that when I delete the ellipse, the internal geometry remains. But it's not a big deal. I just didn't anticipate that.
3. (totally IMHO!) Those volcano-like icons are poorly visible in the dropdown menu (they are apparently 16*16). Especially the one for Mark's construction. I think the old icons were better, and I think the cone should appear only as a general icon for the dropdown, and the dropdown should always invoke a dropdown (conic sections will not be used too often anyway).
It may be a good idea to have 16*16 versions without the cone, if that's possible.
Attachments
volcano-too-small.png
volcano-too-small.png (104.34 KiB) Viewed 1363 times
User avatar
DeepSOIC
Posts: 7829
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Sketcher: Ellipse support

Postby DeepSOIC » Mon Oct 27, 2014 6:21 pm

Looks like we have an arc-of-ellipse creation bug. When I create it with b>a, it jumps.. i.e. appears not exactly where I have drawn it.
User avatar
DeepSOIC
Posts: 7829
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Sketcher: Ellipse support

Postby DeepSOIC » Mon Oct 27, 2014 8:25 pm

Found the cause for jumping arc of ellipse. I had disabled the constraints to see where the internal geometry is initialized, and sure enough...
arc_creation_bug.png
arc_creation_bug.png (73.42 KiB) Viewed 1342 times
I wonder, why didn't you reuse the restore/hide internal geometry sketcher tool?

EDIT: quick fix: git commit 896372cbae2d5667f72f6ee9e628eea482846156
Last edited by DeepSOIC on Mon Oct 27, 2014 9:14 pm, edited 1 time in total.
User avatar
DeepSOIC
Posts: 7829
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Sketcher: Ellipse support

Postby DeepSOIC » Mon Oct 27, 2014 8:51 pm

When dragging ellipse/arc by edge, center is being dragged instead. Dislike.
User avatar
bejant
Posts: 6076
Joined: Thu Jul 11, 2013 3:06 pm

Re: Sketcher: Ellipse support

Postby bejant » Mon Oct 27, 2014 10:41 pm

DeepSOIC wrote:3. (totally IMHO!) Those volcano-like icons are poorly visible in the dropdown menu (they are apparently 16*16). Especially the one for Mark's construction. I think the old icons were better, and I think the cone should appear only as a general icon for the dropdown, and the dropdown should always invoke a dropdown (conic sections will not be used too often anyway).
It may be a good idea to have 16*16 versions without the cone, if that's possible.
I have to agree; after seeing your screen grab it is difficult to distinguish one icon from another with the cone.
abdullah
Posts: 3582
Joined: Sun May 04, 2014 3:16 pm

Re: Sketcher: Ellipse support

Postby abdullah » Tue Oct 28, 2014 1:06 am

DeepSOIC wrote:1. Mark's creation method still limits itself to a circle when I try to draw b>a. Such a circular ellipse with all internal geometry often becomes locked and confuses the solver.
Well, Mark's method defines the major axis, so it is to be expected that you can not "change mind" when setting the 3rd point. I have set the default to my method as this b>a seems to be a big deal (I remember the same problem when I created my method some 50 pages of thread ago). Honestly I have never tried to create a b>a ellipse using Mark's method...

I would not know how to improve the behaviour when locking to a circle. What I do is select the ellipse, hide the internal geometry, resize from edge and show the internal geometry again.
DeepSOIC wrote:2. It is funny that when I delete the ellipse, the internal geometry remains. But it's not a big deal. I just didn't anticipate that.
Yes, it is. This is a drawback of using construction lines instead of another special type of lines (internal geometry lines, if you wish). I mean, the user does not expect construction lines to be deleted. But he would expect internal geometry lines to be deleted. This, of course can be implemented in the future if we feel the need (it should not be a big effort anyway).
DeepSOIC wrote:3. (totally IMHO!) Those volcano-like icons are poorly visible in the dropdown menu (they are apparently 16*16). Especially the one for Mark's construction. I think the old icons were better, and I think the cone should appear only as a general icon for the dropdown, and the dropdown should always invoke a dropdown (conic sections will not be used too often anyway).
It may be a good idea to have 16*16 versions without the cone, if that's possible.
bejant wrote:I have to agree; after seeing your screen grab it is difficult to distinguish one icon from another with the cone.
I have integrated old icons under the conics.

This is a request for Jim: Please make an icon like the one you did before (without the cone) for Mark's method. I hope we are not drawing you crazy with the icons!!! :)
DeepSOIC wrote: Looks like we have an arc-of-ellipse creation bug. When I create it with b>a, it jumps.. i.e. appears not exactly where I have drawn it.
DeepSOIC wrote:I wonder, why didn't you reuse the restore/hide internal geometry sketcher tool?
I wanted to. Apparently internal geometry is a UI command and you can not call a UI command from within another command. This we have to revisit because I hate having partially repeated code in two places. It makes maintaining it cumbersome and is not a good coding practice. I think the solution should be general as to allow to call from one command another....

I have integrated your patch. Thanks!! It works perfect now! :D

BTW, I am proud of myself that git starts to like me, I just had to:
git fetch DeepSOIC
git cherry-pick -x 896372cbae2d5667f72f6ee9e628eea482846156

Note: I have DeepSOIC as a remote of my local repo.
DeepSOIC wrote:When dragging ellipse/arc by edge, center is being dragged instead. Dislike.
I shortly talked about this before. For a circle it is easy due to its circular symmetry, but for an ellipse you would not know what to change (major, minor,...). Because the dragging is effectively a dragging from the center (not a change in the shape), the choice of "jumping to center" is a deliberate decision so that the user is aware that a dragging of the center is what he gets. If someone can come with a better solution that works both, with an ellipse with internal geometry and one without, I would be more than happy to integrate it.

All this fixed/integrated in:

https://github.com/abdullahtahiriyo/Fre ... master.git
b1b3673..5f6cede skt2_marktaff_creation

https://github.com/abdullahtahiriyo/Fre ... f_creation
User avatar
marktaff
Posts: 47
Joined: Sun Sep 21, 2014 3:25 pm
Location: Seattle, Washington, USA

Re: Sketcher: Ellipse support

Postby marktaff » Tue Oct 28, 2014 3:56 am

I have fixed the minor bug I spoke about earlier, and also begun debugging the constraint conflicts on small circular ellipse.

https://github.com/marktaff/FreeCAD_sf_ ... a99778bc3a
See the commit message and grep for "@bug" in the diff for an overview of the issues as I currently understand them, to wit:

Code: Select all

There seem to be two issues currently in major/minor internal geometry lines:
  1) Sometimes minorLength > majorLength due to round-tripping doubles, and
  2) Constraint conflicts when majorLength > minorLength by an epsilon on the order of 1e-6

<snip>

+ /// @bug small circular ellipses have conflicting minor and major axis constraints.
+ /// May be the same issue with floating point and round-tripping doubles when making lines
+ /// as with GC_MakeEllipse
+ /// Conflict occurs when major > minor by 1e-6: 2.0658824836106
+ ///                                             2.0658817202241
+ /// This case is probably a bug in the constaint solver.
+ /// Also we can create major line slightly smaller than minor line: major: 1.4808106044856
+ ///                                                                 minor: 1.4808111779494
+ /// This case is likely due to round-tripping doubles when making lines.
+ /// @see LinePy::PyInit(...) in LinePyImp.cpp
ETA: I'm done for the night, I'll dig into this more tomorrow.
Available on chat.freenode.net#freecad while working on FreeCad
User avatar
marktaff
Posts: 47
Joined: Sun Sep 21, 2014 3:25 pm
Location: Seattle, Washington, USA

Re: Sketcher: Ellipse support

Postby marktaff » Tue Oct 28, 2014 4:27 am

While debugging, I noticed that the constraint solver seems to use only one core (I have eight available).

In Solid Edge v20, on my old intel core duo laptop, constraints solve nearly instantly, far faster than FreeCAD on my i7 with eight cores, even when things go right (about 1/2 second). When they don't go right, it can take 10-20 seconds for even a failed 'solution' to finish, depending on how complex the sketch is.

So we may want to check out the math, and perhaps consider some type of threading.
Available on chat.freenode.net#freecad while working on FreeCad