Sketcher: Bezier curves

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

Re: Sketcher: Bezier curves

Postby abdullah » Tue Feb 21, 2017 11:11 pm

jean.thil wrote:Edit "sketch001". Push the "create edge link to external geometry" (I think this is the correct name in English). Click on the nurbs.

Code: Select all

FreeCAD: /home/alain/Documents/build_FreeCAD/freecad/FreeCAD/src/Mod/Sketcher/App/planegcs/GCS.cpp :3674 : int GCS::System::diagnose(GCS::Algorithm):  l'assertion « R(i,i) != 0 » a échoué.
It crashes also if I close the nurbs, extrude the area and try to link to the edge of the extruction.
I am doing exactly that and I do not get the crash.

I am using my development branch, as the freecad-daily is not yet published and I cannot "apt-get" it (yet).

In this branch:
https://github.com/abdullahtahiriyo/Fre ... iverable_2

you should not get a crash.

Now, tomorrow I will try to install the daily build and see if it crashes there.

Soon also I will pull master and start a new branch for further development. We can also check it there...

EDIT: Update. I have just pulled master and compiled it. I do not manage to get the crash there either. Can anybody confirm?
jean.thil
Posts: 191
Joined: Tue Jul 28, 2015 7:28 am

Re: Sketcher: Bezier curves

Postby jean.thil » Tue Feb 21, 2017 11:26 pm

I should have published it before.
OS: Debian GNU/Linux 8.7 (jessie)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.10232 (Git)
Build type: Unknown
Branch: master
Hash: 3136b42830f6da733cef1cc649760b97a6cdc836
Python version: 2.7.9
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 7.1.0
triplus
Posts: 8710
Joined: Mon Dec 12, 2011 4:45 pm

Re: Sketcher: Bezier curves

Postby triplus » Tue Feb 21, 2017 11:39 pm

CurvatureComb.png
CurvatureComb.png (39.26 KiB) Viewed 1029 times
As for some tests. I did a few basic tests and it works good. I like the view related control commands. I do have one question. Do you feel it would be possible and would make sense for the user being able to propagate curvature combs to the 3D View?
3DView.png
3DView.png (4.46 KiB) Viewed 1029 times
As if that would be possible. You can select such geometry directly after and create Drawing Views out of it:
Drawing.png
Drawing.png (10.56 KiB) Viewed 1029 times
As long as OCC version is high enough. That would therefore in addition enable the end user to observe the curvature combs in the 3D View and create drawings of splines with curvature combs.

P.S. On a bit unrelated note. And to break all this spline talk for a bit. Arc length constraint in Sketcher. Do you see something like that as a viable option in the future or as something impossible to achieve? ;)
User avatar
microelly2
Posts: 4404
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Sketcher: Bezier curves

Postby microelly2 » Wed Feb 22, 2017 5:41 am

triplus wrote:P.S. On a bit unrelated note. And to break all this spline talk for a bit. Arc length constraint in Sketcher. Do you see something like that as a viable option in the future or as something impossible to achieve? ;)
I did some investigation on the dependency of length of a curve depending on one point.
The result is not realy simple https://youtu.be/526SwK8JZnw
abdullah
Posts: 3174
Joined: Sun May 04, 2014 3:16 pm

Re: Sketcher: Bezier curves

Postby abdullah » Wed Feb 22, 2017 6:36 pm

jean.thil wrote:I should have published it before.
OS: Debian GNU/Linux 8.7 (jessie)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.10232 (Git)
Build type: Unknown
Branch: master
Hash: 3136b42830f6da733cef1cc649760b97a6cdc836
Python version: 2.7.9
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 7.1.0
Todays ubuntu daily has that git commit and hash. With it I can not reproduce the problem:

OS: Ubuntu 14.04.5 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.10232 (Git)
Build type: None
Branch: master
Hash: 3136b42830f6da733cef1cc649760b97a6cdc836
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17

I just load your file, double click sketch001 to enter edit mode, then I select the tool to link external geometry and just go to the X axis (because the BSpline is behind it), click and I get the imported geometry, which is a line on the X axis...
abdullah
Posts: 3174
Joined: Sun May 04, 2014 3:16 pm

Re: Sketcher: Bezier curves

Postby abdullah » Wed Feb 22, 2017 6:58 pm

triplus wrote:Do you feel it would be possible and would make sense for the user being able to propagate curvature combs to the 3D View?

As if that would be possible. You can select such geometry directly after and create Drawing Views out of it:

As long as OCC version is high enough. That would therefore in addition enable the end user to observe the curvature combs in the 3D View and create drawings of splines with curvature combs.
I see the usefulness of what you propose. However, for that, I do think it is not a sketcher visualization layer anymore. It must be something more general to work inter-workbenches. For that it should probably be real geometry and not just some lines pushed directly to coin3d. I believe that is in line with what Werner was explaining, that curvature combs have a more generalized scope that the one I was giving them. We arrived to a compromise, which allows us to have curvature combs for B-Splines today, but will eventually be made into a full breadth feature when somebody invests time in providing a general curvature comb support, likely as part of a surface WB.
triplus wrote:P.S. On a bit unrelated note. And to break all this spline talk for a bit. Arc length constraint in Sketcher. Do you see something like that as a viable option in the future or as something impossible to achieve? ;)
I agree to MicroElly's remark. It requires a very big investment for a teeny tiny benefit (IMO). What is possible today, is to ask the length of any curve from python with the GeometryCurvePy::length command. An in-the-middle idea, could be to allow a geometry information overlay for curves indicating in text their lengths. Such a tool would not be Bspline specific. Then you could make an angle constraint driven (reference constraint) and move it until you see in the information layer your wanted value and the make it driving again... I would like to know if there is interest and/or potential conflict with such an idea.
jean.thil
Posts: 191
Joined: Tue Jul 28, 2015 7:28 am

Re: Sketcher: Bezier curves

Postby jean.thil » Wed Feb 22, 2017 8:23 pm

I just load your file, double click sketch001 to enter edit mode, then I select the tool to link external geometry and just go to the X axis (because the BSpline is behind it), click and I get the imported geometry, which is a line on the X axis...
Very strange indeed. The failed assert is the the code that resolves the sketcher. It fails both in a release build and a debug build. Gonna try a full reset of the code.

Edit : still crashes
abdullah
Posts: 3174
Joined: Sun May 04, 2014 3:16 pm

Re: Sketcher: Bezier curves

Postby abdullah » Wed Feb 22, 2017 8:55 pm

jean.thil wrote:Very strange indeed. The failed assert is the the code that resolves the sketcher. It fails both in a release build and a debug build. Gonna try a full reset of the code.

Edit : still crashes
Yes, the assert is in the solver. May I suggest that you download the file you uploaded to the forum and try again, just in case the file somehow is different?

Can anybody please try to reproduce this crash?
jean.thil
Posts: 191
Joined: Tue Jul 28, 2015 7:28 am

Re: Sketcher: Bezier curves

Postby jean.thil » Wed Feb 22, 2017 8:57 pm

Further investigation.
If I lock the point in the sketch, I can project the nurbs. It is thus a sketcher solver bug.
(Edit : and yes, it crashes also with the file downloaded from the forum)

BTW, one can't constrain a point to the projection of the nurbs... :oops:
abdullah
Posts: 3174
Joined: Sun May 04, 2014 3:16 pm

Re: Sketcher: Bezier curves

Postby abdullah » Wed Feb 22, 2017 9:07 pm

jean.thil wrote:Further investigation.
If I lock the point in the sketch, I can project the nurbs. It is thus a sketcher solver bug.
(Edit : and yes, it crashes also with the file downloaded from the forum)

BTW, one can't constrain a point to the projection of the nurbs... :oops:
I wait for further confirmation, because I can not make it crash.

I can constraint a point to the projection :
constraintNURBSProj.png
constraintNURBSProj.png (11.02 KiB) Viewed 936 times
The first constraint is a vertical length between one endpoint of the projected bspline and the center of a circle, the second is a point of projected bspline on circle edge (Point on object)...