diff --git a/constraint.cpp b/constraint.cpp index 0d81c23..48ae3c4 100644 --- a/constraint.cpp +++ b/constraint.cpp @@ -6,11 +6,10 @@ char *Constraint::DescriptionString(void) { return ret; } -hConstraint Constraint::AddConstraint(Constraint *c) { +void Constraint::AddConstraint(Constraint *c) { SS.constraint.AddAndAssignId(c); SS.GW.GeneratePerSolving(); - return c->h; } void Constraint::Constrain(int type, hEntity ptA, hEntity ptB, hEntity entityA) diff --git a/graphicswin.cpp b/graphicswin.cpp index f17fc62..fbc637a 100644 --- a/graphicswin.cpp +++ b/graphicswin.cpp @@ -237,11 +237,20 @@ void GraphicsWindow::EnsureValidActives(void) { } // The active coordinate system must also exist. - if(activeWorkplane.v != Entity::FREE_IN_3D.v && - !SS.entity.FindByIdNoOops(activeWorkplane)) - { - activeWorkplane = Entity::FREE_IN_3D; - change = true; + if(activeWorkplane.v != Entity::FREE_IN_3D.v) { + Entity *e = SS.entity.FindByIdNoOops(activeWorkplane); + if(e) { + hGroup hgw = e->group; + if(hgw.v != activeGroup.v && SS.GroupsInOrder(activeGroup, hgw)) { + // The active workplane is in a group that comes after the + // active group; so any request or constraint will fail. + activeWorkplane = Entity::FREE_IN_3D; + change = true; + } + } else { + activeWorkplane = Entity::FREE_IN_3D; + change = true; + } } bool in3d = (activeWorkplane.v == Entity::FREE_IN_3D.v); @@ -322,7 +331,6 @@ void GraphicsWindow::MenuRequest(int id) { SS.GW.GroupSelection(); if(SS.GW.gs.n == 1 && SS.GW.gs.workplanes == 1) { SS.GW.activeWorkplane = SS.GW.gs.entity[0]; - SS.GW.ClearSelection(); } if(SS.GW.activeWorkplane.v == Entity::FREE_IN_3D.v) { @@ -335,7 +343,7 @@ void GraphicsWindow::MenuRequest(int id) { Quaternion quatf = e->Normal()->NormalGetNum(); Vector offsetf = (e->WorkplaneGetOffset()).ScaledBy(-1); SS.GW.AnimateOnto(quatf, offsetf); - SS.GW.EnsureValidActives(); + SS.GW.ClearSuper(); SS.TW.Show(); break; } diff --git a/sketch.h b/sketch.h index 54d3786..831c2ab 100644 --- a/sketch.h +++ b/sketch.h @@ -372,7 +372,7 @@ public: char *DescriptionString(void); - static hConstraint AddConstraint(Constraint *c); + static void AddConstraint(Constraint *c); static void MenuConstrain(int id); struct { diff --git a/textwin.cpp b/textwin.cpp index fbf15b4..66f254e 100644 --- a/textwin.cpp +++ b/textwin.cpp @@ -292,6 +292,7 @@ void TextWindow::ScreenActivateGroup(int link, DWORD v) { // workplane too. SS.GW.activeWorkplane = g->h.entity(0); } + SS.GW.ClearSuper(); } void TextWindow::ShowListOfGroups(void) { Printf(true, "%Ftactive show group-name%E");