Non-driving dimensions [Pull request issued]

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!
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Non-driving dimensions [Request for Testing and User Input]]

Post by triplus »

I like the idea, except there is one problem. Often, adding a driving constraint causes redundancy, which can lock up FreeCAD for minutes on complex sketches (I hope we'll get it fixed, eventually).
Yes you are correct this needs to be taken into consideration and it complicates things.
So I add to your suggestion: make construction mode button toggleable, and when it's on, all that is created is construction (including geometry).
That is a good idea but that complicates current behaviour. That is selecting geometry/dimensions and to toggle it with one click on Construction Mode tool. It wouldn't work the same anymore. It looks like we won't be able to pull it off with just single click on one button (tool) as suggested.
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: Non-driving dimensions [Request for Testing and User Input]]

Post by sgrogan »

Hello abdullah,
It's good that you are back around :D, and thanks for this!
DeepSOIC wrote:I like the idea, except there is one problem. Often, adding a driving constraint causes redundancy, which can lock up FreeCAD for minutes on complex sketches (I hope we'll get it fixed, eventually). So I add to your suggestion: make construction mode button toggleable, and when it's on, all that is created is construction (including geometry).
I'm +1 on this. Now you must create the geometry and then toggle to construction. Making construction geometry available per-creation would be great.
Driving(Constraint) or Driven(Reference Dimensions) could work the same way on another toolbar button.
triplus wrote:That is a good idea but that complicates current behaviour. That is selecting geometry/dimensions and to toggle it with one click on Construction Mode tool. It wouldn't work the same anymore. It looks like we won't be able to pull it off with just single click on one button (tool) as suggested.
If the same toolbar buttons could work for this when a constraint is pre-selected, this would be the best of both worlds.

Unexpected behavior:
Conflicting.PNG
Conflicting.PNG (100.08 KiB) Viewed 2960 times
Conflicting.FCStd
(2.89 KiB) Downloaded 64 times
When adding the diagonal dimension it is reported that it is redundant which is good but when clicking OK it is reported as conflicting which it is not, A precision problem? The file is prior to applying the diagonal dimension constraint.

I posted some windows builds here:Win_Buildsfor testing.
"fight the good fight"
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Non-driving dimensions [Request for Testing and User Input]]

Post by abdullah »

sgrogan wrote:Hello abdullah,
It's good that you are back around :D, and thanks for this!
It is good to be back :D (or half-back, but actually finally coding). It has been a challenging start of the year.
sgrogan wrote:Now you must create the geometry and then toggle to construction. Making construction geometry available per-creation would be great.
Driving(Constraint) or Driven(Reference Dimensions) could work the same way on another toolbar button. If the same toolbar buttons could work for this when a constraint is pre-selected, this would be the best of both worlds.
I will modify my priority list for this. I think it is annoying. When I finish with non-driving dimensions, my next assignment will be to revisit this topic, for non-driving constraints, for construction lines and for external geometry (I hate to have to push the button, or the x shortcut for each element).
sgrogan wrote:Unexpected behavior:
Conflicting.PNG
Conflicting.FCStd
When adding the diagonal dimension it is reported that it is redundant which is good but when clicking OK it is reported as conflicting which it is not, A precision problem? The file is prior to applying the diagonal dimension constraint.
If you do this in the stock Freecad release (of course without the non-driving constraints of the picture), you end-up with the same behaviour. The sketch is full constraints, you add the diagonal, tells you it is redundant, you hit the ok for setting the datum and it goes to conflicting, shows you the pop-up, you click ok in the pop-up and it removes the constraint and goes to "Fully constrained" again.

I tend to think that it is related to the precision of the datum. The dialog for setting the datum shows you a truncated value of the real solver value. At that moment for the solver is redundant. However, when you hit ok on this "truncated value", the solver says it is conflicting because it is conflicting within the precision of the solver (it is maybe only 1e-8 difference between both values, but it is conflicting)...
sgrogan wrote:I posted some windows builds here:Win_Buildsfor testing.
This is very nice of you, it will surely increase the amount of feedback... Thanks!! :)
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Non-driving dimensions [Request for Testing and User Input]]

Post by abdullah »

DeepSOIC wrote: Bug2.
Cannot disable snell's law. It just remains enabled, after I right-click on it in constraints list and choose disable in the popup menu.
I have fixed this. Currently I am working on bug1.
DeepSOIC wrote:? Bug3.
When there is a non-driving constraint, after I move the sketch, the sketch jumps back slightly when I release LMB. This one will be a hard-to-fix one, I'm afraid.
Funny, it does not happen in horizontal, vertical or radius constraints, it does happen on an angle constraint between two lines. I will give it a further look after I am done with bug1...
User avatar
bejant
Veteran
Posts: 6075
Joined: Thu Jul 11, 2013 3:06 pm

Re: Non-driving dimensions [Request for Testing and User Input]]

Post by bejant »

Has anyone built the branch using Linux? I got this error:

Code: Select all

[ 60%] Building CXX object src/Mod/Sketcher/App/CMakeFiles/Sketcher.dir/SketchObjectSFPyImp.cpp.o
[ 60%] Building CXX object src/Mod/Sketcher/App/CMakeFiles/Sketcher.dir/SketchObjectPyImp.cpp.o
/home/myusername/Downloads/FreeCADGit/20150516Abdullah/FreeCAD_sf_master-857c701a6f525f7c2699a140a1df3f4d02f1a511/src/Mod/Sketcher/App/SketchObjectPyImp.cpp:571:52: error: no ‘PyObject* Sketcher::SketchObjectPy::setDriving(PyObject*)’ member function declared in class ‘Sketcher::SketchObjectPy’
 PyObject* SketchObjectPy::setDriving(PyObject *args)
                                                    ^
/home/myusername/Downloads/FreeCADGit/20150516Abdullah/FreeCAD_sf_master-857c701a6f525f7c2699a140a1df3f4d02f1a511/src/Mod/Sketcher/App/SketchObjectPyImp.cpp:589:52: error: no ‘PyObject* Sketcher::SketchObjectPy::getDriving(PyObject*)’ member function declared in class ‘Sketcher::SketchObjectPy’
 PyObject* SketchObjectPy::getDriving(PyObject *args)
                                                    ^
make[2]: *** [src/Mod/Sketcher/App/CMakeFiles/Sketcher.dir/SketchObjectPyImp.cpp.o] Error 1
make[1]: *** [src/Mod/Sketcher/App/CMakeFiles/Sketcher.dir/all] Error 2
make: *** [all] Error 2
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Non-driving dimensions [Request for Testing and User Input]]

Post by abdullah »

bejant wrote:Has anyone built the branch using Linux?
Yes. I develop in Linux. I do not have Windows.

It seems to me that somehow your system is not processing SketchObjectPy.xml, and it is therefore not getting the declarations of those two new functions. The building system should detect that the xml file has changed.

Anybody is familiar with this problem?
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Non-driving dimensions [Request for Testing and User Input]]

Post by DeepSOIC »

I think I had similar sort of a problem when I was exposing some new python functions, but it was on windows, and I don't remember, what did I do to fix it :? . General suggestions are: resave the xml to update its date; run cmake; clean build.
User avatar
bejant
Veteran
Posts: 6075
Joined: Thu Jul 11, 2013 3:06 pm

Re: Non-driving dimensions [Request for Testing and User Input]]

Post by bejant »

Thank you both for the compile advice, I did a fresh build and it worked fine.
DeepSOIC wrote:Bug3.
When there is a non-driving constraint, after I move the sketch, the sketch jumps back slightly when I release LMB.
I noticed that if I move a line segment by selecting an endpoint, the geometry jumps a little when I release LMB too. But I move that same segment by dragging the segment instead of an endpoint, no jumping when LMB is released (tested using both CAD and Gesture navigation styles).

Wish list:
  1. If I right-click on a constraint in the 3D window, could I get a pop-up menu, similar to (or even the same as) the the one I get upon right-clicking a constraint in the Constraints panel? So I don't have to mouse over to the Constraints panel, possibly change the Constraints Filter to Non-Driving, in order to Enable that constraint?
  2. Also, in the Constraints Filter could there be an "All" that shows both driving and non-driving constraints? I usually just set the filter to show All, so I don't have to keep changing the filter modes.
Looks good so far, I hope to experiment more in about 12 hours.

P.S.: Hi Abdullah, glad you're back! (I posted in your "Request For User Input and Testing" topic in the Help forum but thought I'd post here too.)
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Non-driving dimensions [Request for Testing and User Input]]

Post by abdullah »

DeepSOIC wrote: Cannot add a non-driving constraint to external geometry.
Example: select an external-geometry line, and click length constraint. A message pops up, as before, that it's impossible.
This has turned out to be more work that anticipated, but now it is fixed. Constraints that are not enforceable (can never be driving constraints due to the nature of the elements it involves, that combination of external geometry only, without any non-external), are created directly as non-driving constraints, and the constraint list has been modified to detect this situation and prevent the user from enabling (making driving) such a constraint. I like the functionality.

I also fixed a bug on angle constraint creation command using angle via point, that would add a driving constraint to two external geometry lines. I think I fix some other minor bugs too that I can not remember now.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Non-driving dimensions [Request for Testing and User Input]]

Post by abdullah »

DeepSOIC wrote: ? Bug3.
When there is a non-driving constraint, after I move the sketch, the sketch jumps back slightly when I release LMB. This one will be a hard-to-fix one, I'm afraid.
This "bug" is a consequence of the implementation of non-driving constraints using the solver and:

1) either we solve the problem in the solver that generates this behaviour.

or

2) we see which ones they are and hard-code the calculation (as in my original implementation)

Maybe I am mistaken (and please enlighten me if I am), but this slight jump-back should not pose a problem to the user. If the user does want to enforce the constraint to a given value, then he should change the constraint to driven and modify the value. Am I missing something?

For those reasons I vote for leaving it like this.
Post Reply