Skip to content
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

switch to "Anywhere in 3d" can cause confusion #193

Open
wpwrak opened this issue Feb 8, 2017 · 14 comments
Open

switch to "Anywhere in 3d" can cause confusion #193

wpwrak opened this issue Feb 8, 2017 · 14 comments

Comments

@wpwrak
Copy link
Contributor

wpwrak commented Feb 8, 2017

SolveSpace sometimes unexpectedly switches from "In Workplane" to "Anywhere in 3d". This can cause user-machine coordination issues, similar to the "autopilot disconnected but the pilots didn't notice" kind of problems in aviation.

This can often be detected early when SolveSpace complains about the lack of a workplane when trying to set a H or V constraint, but sometimes the transition can go unnoticed for a while. More subtly, this also affects how some constraints can be used. E.g., a point coincidence that works in 2D can produce an error when in 3D.

Here is a particularly entertaining example of what one can end up drawing:

uncommanded-transition-to-3d

The rightmost point on the white line should be projected on the workplane, roughly where I put a yellow circle. Below, the outline got interrupted (I've turned off that warning, since it causes nearly constant nagging). Needless to say, all this chaos looks perfectly fine when viewed at the workplane.

I'm not sure when or why SolveSpace decides to change to 3D mode, but it would be good if it either didn't do that automatically, or if it would at least indicate more clearly when an uncommanded transition has occurred.

@whitequark
Copy link
Contributor

The "unexpectedly" part is not actionable without a way to reproduce. In general SolveSpace switches to the free in 3d mode by itself in one case: when there isn't a workplane available.

@wpwrak
Copy link
Contributor Author

wpwrak commented Feb 8, 2017

Okay, I found one case where this happens: I have a sketch without issues (that I know of). In this sketch there is an arc with both endpoints fixed. I set the center with a point-to-point coincidence, which over-constrains the sketch and I get an error. At this point I'm still in the workplane.

Now I undo. After the undo, I'm in 3D.

There must be some additional condition to make this happen, since I get the uncommanded transition to 3D under the above circumstances when deep in editing an-top.slvs, but not when I try this on a new sketch.

@wpwrak
Copy link
Contributor Author

wpwrak commented Feb 8, 2017

The plot thickens: the "undo" also changed the group (from g01f-sk-minus-base waaay out to g02d-balance). No surprise it doesn't find my old workplane there. The group change may in turn have been caused by reporting a transient SOLVE FAILURE of the #182 type.

@whitequark
Copy link
Contributor

Yes, that seems likely.

@whitequark whitequark added bug and removed question labels Feb 8, 2017
@whitequark
Copy link
Contributor

What are the exact steps to reproduce?

@wpwrak
Copy link
Contributor Author

wpwrak commented Feb 8, 2017

I put a snapshot where I stopped editing at the right moment into
https://gitlab.com/anelok/mexp.git at ebb4a394 (branch "193")

  • solvespace alt13/an-top.slvs
  • select g01f-sk-minus-base
  • activate sk-minus-base workplane
  • find r0b7-arc-of-circle (selected in picture)
  • make center coincide (O) with "center of everything" (seleced in picture)
    193-the-beginning
  • sketch is now over-constrained: SOLVE FAILED!
  • check that Sketch > still says "In Workplane"
  • undo
  • we're now greeted by a undo deletion leads to alarming complaints #182 type SOLVE FAILED!
    In the text window, we have transitioned to group g02d-balance (which is probably okay).
    In the group list, g01f-sk-minus-base is still active (also okay).
    And we're in Sketch > Workplane in 3d (surprise !)

@whitequark
Copy link
Contributor

whitequark commented Feb 8, 2017

Can you try this patch?

diff --git a/src/generate.cpp b/src/generate.cpp
index 00ec3708..9d62199c 100644
--- a/src/generate.cpp
+++ b/src/generate.cpp
@@ -499,6 +499,7 @@ void SolveSpaceUI::SolveGroupAndReport(hGroup hg, bool andFindFree) {
     bool isOkay = g->solved.how == SolveResult::OKAY ||
                   (g->allowRedundant && g->solved.how == SolveResult::REDUNDANT_OKAY);
     if(!isOkay || (isOkay && !g->IsSolvedOkay())) {
+        g->Activate();
         TextWindow::ReportHowGroupSolved(g->h);
     }
 }

@wpwrak
Copy link
Contributor Author

wpwrak commented Feb 8, 2017

Seems to have no effect. I.e., sk-minus-base is still the active group after the "undo" and #182.

@whitequark
Copy link
Contributor

Sorry, incomplete patch.

diff --git a/src/generate.cpp b/src/generate.cpp
index 00ec3708..8498033d 100644
--- a/src/generate.cpp
+++ b/src/generate.cpp
@@ -499,6 +499,8 @@ void SolveSpaceUI::SolveGroupAndReport(hGroup hg, bool andFindFree) {
     bool isOkay = g->solved.how == SolveResult::OKAY ||
                   (g->allowRedundant && g->solved.how == SolveResult::REDUNDANT_OKAY);
     if(!isOkay || (isOkay && !g->IsSolvedOkay())) {
+        SS.GW.activeGroup.v = hg.v;
+        g->Activate();
         TextWindow::ReportHowGroupSolved(g->h);
     }
 }

@wpwrak
Copy link
Contributor Author

wpwrak commented Feb 8, 2017

Now it works, thanks ! However, it makes #182 also a little weirder:

Activating the problem group (g02d-balance here) also clears the transient errors of #182 (all of them in this case, though I don't know if this would always be the reason). So the poor user gets teleported to another group for no apparent reason, i.e., there is no error page or any other indication anymore.

Upon returning to sk-minus-base, the workplane is set properly. So, while still confusing while #182 is around, it is an improvement.

@whitequark
Copy link
Contributor

@wpwrak Does this still happen after #182 is fixed? I'm not sure if this will ever appear without some other underlying bug.

@Evil-Spirit can you chime in?

@Evil-Spirit
Copy link
Collaborator

Evil-Spirit commented Feb 17, 2017

@whitequark, ofc. Also, I have an opinion what we should not change 2d/3d (by pressing 2-3 keys) for the current group once we have choosen this.

Evil-Spirit added a commit to Evil-Spirit/solvespace-master that referenced this issue Feb 17, 2017
@Evil-Spirit
Copy link
Collaborator

Evil-Spirit commented Feb 17, 2017

@whitequark, this happens because of graphicswin.cpp:657. This is called from GenerateAll->SolveGroupAndReport->ReportHowGroupSolved->ClearSuper. It seems there is no reason to call EnsureValidActivities here. This function looks strange and perfrom a lot of strange things. I think this function needs to be refactored/split/renamed. At least one of part can be called "UpdateMenuCheckboxes". For now I have no idea how to properly fix it.

@Evil-Spirit Evil-Spirit self-assigned this Feb 18, 2017
@Evil-Spirit Evil-Spirit added this to indev in Evil-Spirit tasks Feb 18, 2017
@whitequark whitequark moved this from indev to todev in Evil-Spirit tasks Mar 12, 2017
@whitequark whitequark assigned whitequark and unassigned Evil-Spirit Mar 12, 2017
@whitequark
Copy link
Contributor

@Evil-Spirit thanks for investigation, I'll handle this from now on.

@whitequark whitequark added this to the 3.0 milestone Mar 12, 2017
@whitequark whitequark removed this from todev in Evil-Spirit tasks Mar 12, 2017
@whitequark whitequark added the UI label Jul 12, 2018
@whitequark whitequark removed their assignment May 23, 2019
@phkahler phkahler removed this from the 3.0 milestone Oct 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants