Little stuff: show polygon assembly errors only for draw-in-plane
groups, rename "drawing" groups to "sketch" groups, and keep assembling even after finding an open curve. [git-p4: depot-paths = "//depot/solvespace/": change = 1835]solver
parent
6269d702fb
commit
36870360cb
2
file.cpp
2
file.cpp
|
@ -13,7 +13,7 @@ hGroup SolveSpace::CreateDefaultDrawingGroup(void) {
|
|||
g.predef.q = Quaternion::From(1, 0, 0, 0);
|
||||
hRequest hr = Request::HREQUEST_REFERENCE_XY;
|
||||
g.predef.origin = hr.entity(1);
|
||||
g.name.strcpy("draw-in-plane");
|
||||
g.name.strcpy("sketch-in-plane");
|
||||
group.AddAndAssignId(&g);
|
||||
SS.GetGroup(g.h)->activeWorkplane = g.h.entity(0);
|
||||
return g.h;
|
||||
|
|
|
@ -42,8 +42,8 @@ const GraphicsWindow::MenuEntry GraphicsWindow::menu[] = {
|
|||
{ 1, "Dimensions in &Millimeters", MNU_UNITS_MM, 0, mView },
|
||||
|
||||
{ 0, "&New Group", 0, 0, NULL },
|
||||
{ 1, "&Drawing in 3d\tShift+D", MNU_GROUP_3D, 'D'|S, mGrp },
|
||||
{ 1, "Drawing in Workplane\tShift+W", MNU_GROUP_WRKPL, 'W'|S, mGrp },
|
||||
{ 1, "Sketch In &3d\tShift+3", MNU_GROUP_3D, '3'|S, mGrp },
|
||||
{ 1, "Sketch In New &Workplane\tShift+W", MNU_GROUP_WRKPL, 'W'|S, mGrp },
|
||||
{ 1, NULL, 0, NULL },
|
||||
{ 1, "Step &Translating\tShift+T", MNU_GROUP_TRANS, 'T'|S, mGrp },
|
||||
{ 1, "Step &Rotating\tShift+R", MNU_GROUP_ROT, 'R'|S, mGrp },
|
||||
|
@ -96,7 +96,7 @@ const GraphicsWindow::MenuEntry GraphicsWindow::menu[] = {
|
|||
{ 0, "&Help", 0, NULL },
|
||||
{ 1, "&Load License...", 0, NULL },
|
||||
{ 1, NULL, 0, NULL },
|
||||
{ 1, "Open &Website", 0, NULL },
|
||||
{ 1, "&Website / Manual", 0, NULL },
|
||||
{ 1, "&About", 0, NULL },
|
||||
{ -1 },
|
||||
};
|
||||
|
|
|
@ -32,12 +32,12 @@ void Group::MenuGroup(int id) {
|
|||
switch(id) {
|
||||
case GraphicsWindow::MNU_GROUP_3D:
|
||||
g.type = DRAWING_3D;
|
||||
g.name.strcpy("draw-in-3d");
|
||||
g.name.strcpy("sketch-in-3d");
|
||||
break;
|
||||
|
||||
case GraphicsWindow::MNU_GROUP_WRKPL:
|
||||
g.type = DRAWING_WORKPLANE;
|
||||
g.name.strcpy("draw-in-plane");
|
||||
g.name.strcpy("sketch-in-plane");
|
||||
if(gs.points == 1 && gs.n == 1) {
|
||||
g.subtype = WORKPLANE_BY_POINT_ORTHO;
|
||||
|
||||
|
|
|
@ -612,30 +612,37 @@ void Group::Draw(void) {
|
|||
// And finally show the polygons too
|
||||
if(!SS.GW.showShaded) return;
|
||||
if(polyError.how == POLY_NOT_CLOSED) {
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glxColor4d(1, 0, 0, 0.2);
|
||||
glLineWidth(10);
|
||||
glBegin(GL_LINES);
|
||||
glxVertex3v(polyError.notClosedAt.a);
|
||||
glxVertex3v(polyError.notClosedAt.b);
|
||||
glEnd();
|
||||
glLineWidth(1);
|
||||
glxColor3d(1, 0, 0);
|
||||
glPushMatrix();
|
||||
glxTranslatev(polyError.notClosedAt.b);
|
||||
glxOntoWorkplane(SS.GW.projRight, SS.GW.projUp);
|
||||
glxWriteText("not closed contour!");
|
||||
glPopMatrix();
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
// Report this error only in sketch-in-workplane groups; otherwise
|
||||
// it's just a nuisance.
|
||||
if(type == DRAWING_WORKPLANE) {
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glxColor4d(1, 0, 0, 0.2);
|
||||
glLineWidth(10);
|
||||
glBegin(GL_LINES);
|
||||
glxVertex3v(polyError.notClosedAt.a);
|
||||
glxVertex3v(polyError.notClosedAt.b);
|
||||
glEnd();
|
||||
glLineWidth(1);
|
||||
glxColor3d(1, 0, 0);
|
||||
glPushMatrix();
|
||||
glxTranslatev(polyError.notClosedAt.b);
|
||||
glxOntoWorkplane(SS.GW.projRight, SS.GW.projUp);
|
||||
glxWriteText("not closed contour!");
|
||||
glPopMatrix();
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
} else if(polyError.how == POLY_NOT_COPLANAR) {
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glxColor3d(1, 0, 0);
|
||||
glPushMatrix();
|
||||
glxTranslatev(polyError.notCoplanarAt);
|
||||
glxOntoWorkplane(SS.GW.projRight, SS.GW.projUp);
|
||||
glxWriteText("points not all coplanar!");
|
||||
glPopMatrix();
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
// And this one too
|
||||
if(type == DRAWING_WORKPLANE) {
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glxColor3d(1, 0, 0);
|
||||
glPushMatrix();
|
||||
glxTranslatev(polyError.notCoplanarAt);
|
||||
glxOntoWorkplane(SS.GW.projRight, SS.GW.projUp);
|
||||
glxWriteText("points not all coplanar!");
|
||||
glPopMatrix();
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
} else {
|
||||
glxColor4d(0, 0.1, 0.1, 0.5);
|
||||
glxDepthRangeOffset(1);
|
||||
|
|
|
@ -105,6 +105,7 @@ bool SEdgeList::AssembleContour(Vector first, Vector last,
|
|||
bool SEdgeList::AssemblePolygon(SPolygon *dest, SEdge *errorAt) {
|
||||
dest->Clear();
|
||||
|
||||
bool allClosed = true;
|
||||
for(;;) {
|
||||
Vector first, last;
|
||||
int i;
|
||||
|
@ -117,14 +118,15 @@ bool SEdgeList::AssemblePolygon(SPolygon *dest, SEdge *errorAt) {
|
|||
}
|
||||
}
|
||||
if(i >= l.n) {
|
||||
return true;
|
||||
return allClosed;
|
||||
}
|
||||
|
||||
// Create a new empty contour in our polygon, and finish assembling
|
||||
// into that contour.
|
||||
dest->AddEmptyContour();
|
||||
if(!AssembleContour(first, last, &(dest->l.elem[dest->l.n-1]), errorAt))
|
||||
return false;
|
||||
allClosed = false;
|
||||
// But continue assembling, even if some of the contours are open
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue