Request for testing: sketcher fix

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
triplus
Posts: 8835
Joined: Mon Dec 12, 2011 4:45 pm

Re: Request for testing: sketcher fix

Postby triplus » Wed Oct 07, 2015 1:38 am

eivindkvedalen wrote:Thanks for testing and reporting back!
You're welcome.
abdullah wrote:English translation: When using horizontal or vertical distance constraints (not distance constraint), anybody sees a problem if instead of showing the value in absolute value, the value shown on the screen is signed (e.g. -30 mm), meaning that the point to the right (in horizontal distance constraint) is the one taken as reference for then definition of the "distance"? Anybody thinks that there is an advantage for the user if the sign is shown?
It probably isn't crucial the end user has - sign visible on the screen (3D View) at all times. Its main purpose from user perspective after all is to insert it once and to flip sketcher geometry if desired. Beyond that user has little value in knowing if in the background the value is positive/negative?

Or i could be wrong and there are use cases. Maybe expression support will introduce a need for the end user to be more aware of the value sign.
1) Fix: Sketcher constraints assigned by an expression will now keep its original sign. This makes using expressions much more predictable and nicer, imo.
If sketcher constraints set by expression will keep whatever sign the expression produces i am guessing what could happen is sketcher geometry could flip more often but then again the user can control this by multiplying the expression by -1 if needed.
2) Feature: A new spreadsheet command has been added, accessible with Ctrl+Shift+A by default. This should bring up the alias page of a cell's properties directly with focus on the line edit, making it more convenient to add aliases.
The keyboard combination shortcut didn't work for me as it selects all cells instead. I can investigate that tomorrow on why that happens. Instead i noticed you added set alias toolbar button and that works good.
3) Feature: Aliased cells will change their default background to light yellow, and get a tooltip when the mouse is over them.
Nice.
eivindkvedalen
Posts: 598
Joined: Tue Jan 29, 2013 10:35 pm

Re: Request for testing: sketcher fix

Postby eivindkvedalen » Wed Oct 07, 2015 9:02 am

triplus wrote: If sketcher constraints set by expression will keep whatever sign the expression produces i am guessing what could happen is sketcher geometry could flip more often but then again the user can control this by multiplying the expression by -1 if needed.
Multiplying the expression by -1 will not flip the constraint in my branch. Today negative expressions make the constraints unstable, as they are evaluated and assigned automatically when any of its dependencies are changed. Today, assigning a negative value _once_ to a constraint will flip it, and assigning it once more will flip it back. That makes negative values from expressions unstable. My current suggestion, which is in the branch you used, discards the sign of the expression when assigning it to the constraint, and uses the initial sign of the constraint value when it was first created. I think this is the best solution, at least for the time being.

Another option would be to always use the expression output with sign and all, but that introduces some very awkward behavior when the constraint initially is negative, but that could be solved by swapping the input points so that it initially always is positive. I think this is was what DeepSOIC suggested. If we implement that, then we can always keep the sign, and also expose it to the user.

Eivind
triplus
Posts: 8835
Joined: Mon Dec 12, 2011 4:45 pm

Re: Request for testing: sketcher fix

Postby triplus » Wed Oct 07, 2015 6:23 pm

I compiled the branch once more as i noticed mentioned commit probably wasn't included in the build i made yesterday. Therefore indeed yesterday i could multiply the expression by -1 and sketcher geometry flip happened. Therefore the constraint value did get the sign from expression. Indeed before testing the branch (just reading the description) i was under the impression that should not happen and the sign should stay the same regardless of the sign returned in expression result. As for the build i made today it does work like that!

To be honest i don't know what would be preferred solution.
  • From sketcher point of view user usually doesn't care about the sign and only uses - sign to flip geometry. The concept of for example negative distance of a line has little value to end user ATM. But when setting the value with expression there might be use cases where user would actually like to define the distance in negative direction looking from the relative "coordinate system" represented as one end point of a line.
  • Just from expression point of view the sign is important as different result is presented if positive/negative value is used.
Therefore as we started to mix sketcher constraints values with expressions i guess we don't have much use cases ATM. For best solution therefore i am guessing more users will need to give feedback. For example feature properties probably won't hide the sign. Therefore i would wait a bit to hear what more end users have to say about current implementation.


P.S. But doing that and making changes after will probably break all the files made in between? Maybe we could start showing the sign in 3D View and in constraint pop-up and the expression should just take and give back the value with the sign. From expression point of view that makes sense but from current sketcher workflow it looks a bit cluttered.

But if i am not mistaken not all constraints are "signed" and some of them can't take negative values in the first place? Therefore showing the sign only solves the issue partially.
eivindkvedalen
Posts: 598
Joined: Tue Jan 29, 2013 10:35 pm

Re: Request for testing: sketcher fix

Postby eivindkvedalen » Wed Oct 07, 2015 7:50 pm

triplus wrote: The keyboard combination shortcut didn't work for me as it selects all cells instead. I can investigate that tomorrow on why that happens. Instead i noticed you added set alias toolbar button and that works good.
I noticed this evening that the Spreadsheet workbench has to be activated. Could this be the case for you?

Eivind
triplus
Posts: 8835
Joined: Mon Dec 12, 2011 4:45 pm

Re: Request for testing: sketcher fix

Postby triplus » Wed Oct 07, 2015 7:53 pm

eivindkvedalen wrote:
triplus wrote: The keyboard combination shortcut didn't work for me as it selects all cells instead. I can investigate that tomorrow on why that happens. Instead i noticed you added set alias toolbar button and that works good.
I noticed this evening that the Spreadsheet workbench has to be activated. Could this be the case for you?

Eivind
Yes i can confirm this behavior.