New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sketcher_Dimension: Enable the user to select what angle he wants. #10657
Sketcher_Dimension: Enable the user to select what angle he wants. #10657
Conversation
@chennes this one is pretty cool :) |
Hmm, i'm getting quite unexpected results: pr_10657.webmOS: Fedora Linux 38 (Workstation Edition) (GNOME/gnome) |
Tried on X11 instead of wayland with a clean/default setup. (The cursor is hidden, sorry) pr_10657_x11.webm |
@chennes what did you meant by misrendered? Is it that the value is writen on top of the arc. Or is it that you expected the complementary angle (ie 360 - angle)? In this PR the goal was to make the supplementary angle (180-angle). @howie-j you are right, I tested only on crossing lines. The two other cases don't work, I can reproduce the same as in your video. I will investigate |
I think that without rendering the connecting lines, showing the supplementary angle doesn't make any sense -- in the animation shown in this post there are lines indicating what angle is being displayed. In this case, the angle is just floating out in space, with no clear reference. |
It might also make sense to implement this for the normal Angle tool as well when it's stable. For the users who prefer the separate toolset |
You are right @chennes. I was planning to try to improve the connecting lines for angles. Though I don't know if this belong to this PR as it's quite a separate part of the code. |
@qewer33 the normal angle tool does not offer a moment to do that. As it's a one shot command. No mouse move time to do it. |
4b69642
to
2958882
Compare
Very nice, almost all bugs fixed in the last commit. The only bug i could find now is when creating an angle between a line and X or Y axis: dim_angle_bug.webm(the blue construction line normal to the regular line is just for illustration) |
Fair enough -- once @howie-j is satisfied with the PR I'll merge it. |
After a long fruitless investigation, I finally found that this bug is not due to my PR. It is in fact a bug of moving the constraint. But this is not due to sketcher_dimension : Make the angle and validate it first. Then try to click and drag the constraint as you did, the described behavior is achieved. So I'm not sure what to do here. Do I have to fix it in this PR ? The angle constraint 'drag and move' could benefit from a rework as we could work to enable the angle flipping during the mouse move rather than in sketcher dimension... Which would make this PR useless. I will check tomorrow if I can move this code out of sketcher_dimension and into the moving of angle constraint |
No, certainly not -- if the fix were obvious and simple it would be fine for you to do so, but if it's not a regression due to this PR, there's no requirement that you fix it. You might consider submitting an Issue about it, though. Do you want to merge this as-is then? |
For me it's more than fine to merge as-is, as long as we create an issue we can point to regarding the constraint flipping. |
2958882
to
4cdb9e8
Compare
Ok so the good news is that it was fairly easy to move to 'moveConstraint' so that it now works not only on angle creation, but also when you move an angle around.
@wwmayer do you perhaps know if there is an easy way to access the constraint expression? I tried to follow the logic in EditDatumDialog but I'm having trouble as it seems it use an expression binding to the widget there. |
@abdullahtahiriyo is there no method to get the index (int) for a given constraint? Assuming you know the index of the constraint then you can access a possible associated expression via the sketch object:
I don't know if there is a better way than this but it works.
Manipulating the expression this way is fragile because you don't know how the expression looks like. Better do Another thing to check is whether the old expression uses the degree symbol to avoid a unit mismatch when changing the expression. |
Yes I have the index. Thanks very much, I was in down the rabbit hole and came up with the following but I was stuck then
Yes you are right, it needs paranthesis indeed. |
|
Some general remarks:
|
|
Do you think I should rather make a 'hasExpression' 'getExpression' and 'setExpression' into Sketcher::Constraint ? The issue I see is that the constraint object currently doesn't have access to sketch object. |
Sketcher::Constraint looks like the wrong place to me. Better put it into SketchObject or where it makes sense to DocumentObject. |
Moving to Draft. Please reset when ready. |
498686a
to
253669e
Compare
Ok so I have split the move constraint function. And moved some code into SketchObject. Side note: The problem raised by @howie-j is solved. |
Tested, could not detect any misbehavior. Very nice work 🥇 |
Damn this is cool movable.webm |
… its supplementary.
…r to switch of supplementary angle.
253669e
to
55420d9
Compare
Typo fixed + typeId test replaced by isLineSegment(*geo1) (line 1779, 1850, 1854). |
@PaddleStroke shouldn't errors presented to the user be made available for translation? |
This error is not a user-facing error. It's not supposed to ever appear so I think it's not worth translating. |
Fixes #10603
In Sketcher_Dimension and also in general moving the constraint : Enable the user to select the complementary angle he wants based on the position of the mouse. Similarly as how he can choose distance/DistanceX/Y.
Forum discussions :
https://forum.freecad.org/viewtopic.php?t=28321
https://forum.freecad.org/viewtopic.php?t=80994