Show a progress message when regenerating is slow. And update the

version number to 1.4, don't include force-hidden entities when
building the loops, and don't show force-hidden entities when that
entity gets copied.

[git-p4: depot-paths = "//depot/solvespace/": change = 1983]
solver
Jonathan Westhues 2009-06-13 20:36:38 -08:00
parent 3b3b7fe680
commit 7eefb79127
6 changed files with 75 additions and 14 deletions

View File

@ -170,9 +170,59 @@ void SolveSpace::GenerateAll(int first, int last, bool andFindFree) {
SK.param.MoveSelfInto(&prev);
SK.entity.Clear();
SDWORD inTime = GetMilliseconds();
bool displayedStatusMessage = false;
for(i = 0; i < SK.group.n; i++) {
Group *g = &(SK.group.elem[i]);
SDWORD now = GetMilliseconds();
// Display the status message if we've taken more than 400 ms, or
// if we've taken 200 ms but we're not even halfway done, or if
// we've already started displaying the status message.
if( (now - inTime > 400) ||
((now - inTime > 200) && i < (SK.group.n / 2)) ||
displayedStatusMessage)
{
displayedStatusMessage = true;
char msg[1024];
sprintf(msg, "generating group %d/%d", i, SK.group.n);
int w, h;
GetGraphicsWindowSize(&w, &h);
glDrawBuffer(GL_FRONT);
glViewport(0, 0, w, h);
glLoadIdentity();
glTranslated(-1, 1, 0);
glScaled(2.0/w, 2.0/h, 1.0);
glDisable(GL_DEPTH_TEST);
double left = 80, top = -20, width = 240, height = 24;
glColor3d(0.9, 0.8, 0.8);
glBegin(GL_QUADS);
glVertex2d(left, top);
glVertex2d(left+width, top);
glVertex2d(left+width, top-height);
glVertex2d(left, top-height);
glEnd();
glLineWidth(1);
glColor3d(0.0, 0.0, 0.0);
glBegin(GL_LINE_LOOP);
glVertex2d(left, top);
glVertex2d(left+width, top);
glVertex2d(left+width, top-height);
glVertex2d(left, top-height);
glEnd();
glColor3d(0, 0, 0);
glPushMatrix();
glRasterPos2d(left+8, top-17);
DrawWithBitmapFont(msg);
glPopMatrix();
glFlush();
glDrawBuffer(GL_BACK);
}
// The group may depend on entities or other groups, to define its
// workplane geometry or for its operands. Those must already exist
// in a previous group, so check them before generating.

View File

@ -734,7 +734,12 @@ void Group::CopyEntity(IdList<Entity,hEntity> *el,
default:
oops();
}
en.forceHidden = !ep->actVisible;
// If the entity came from an imported file where it was invisible then
// ep->actiVisble will be false, and we should hide it. Or if the entity
// came from a copy (e.g. step and repeat) of a force-hidden imported
// entity, then we also want to hide it.
en.forceHidden = (!ep->actVisible) || ep->forceHidden;
el->Add(&en);
}

View File

@ -11,6 +11,7 @@ bool Group::AssembleLoops(void) {
Entity *e = &(SK.entity.elem[i]);
if(e->group.v != h.v) continue;
if(e->construction) continue;
if(e->forceHidden) continue;
e->GenerateBezierCurves(&sbl);
}

View File

@ -65,7 +65,7 @@ void SolveSpace::Init(char *cmdLine) {
// Camera tangent (determines perspective)
cameraTangent = CnfThawFloat(0.0f, "CameraTangent");
// Color for edges (drawn as lines for emphasis)
edgeColor = CnfThawDWORD(RGB(0, 0, 0), "EdgeColor");
edgeColor = CnfThawDWORD(RGB(200, 200, 200), "EdgeColor");
// Export scale factor
exportScale = CnfThawFloat(1.0f, "ExportScale");
// Export offset (cutter radius comp)
@ -715,10 +715,10 @@ void SolveSpace::MenuHelp(int id) {
break;
case GraphicsWindow::MNU_ABOUT:
Message("This is SolveSpace version 1.3.\r\n\r\n"
Message("This is SolveSpace version 1.4.\r\n\r\n"
"For more information, see http://www.solvespace.com/\r\n\r\n"
"Built " __TIME__ " " __DATE__ ".\r\n\r\n"
"Copyright 2008 Jonathan Westhues, All Rights Reserved.");
"Copyright 2008-2009 Jonathan Westhues, All Rights Reserved.");
break;
case GraphicsWindow::MNU_LICENSE: {

View File

@ -976,7 +976,7 @@ static void CreateMainWindows(void)
HMENU top = CreateGraphicsWindowMenus();
GraphicsWnd = CreateWindowEx(0, "GraphicsWnd",
"SolveSpace (Graphics Window)",
"SolveSpace (not yet saved)",
WS_OVERLAPPED | WS_THICKFRAME | WS_CLIPCHILDREN | WS_MAXIMIZEBOX |
WS_MINIMIZEBOX | WS_SYSMENU | WS_SIZEBOX | WS_CLIPSIBLINGS,
50, 50, 900, 600, NULL, top, Instance, NULL);
@ -1053,6 +1053,16 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
ThawWindowPos(TextWnd);
ThawWindowPos(GraphicsWnd);
ShowWindow(TextWnd, SW_SHOWNOACTIVATE);
ShowWindow(GraphicsWnd, SW_SHOW);
glClearColor(0, 0, 0, 1);
glClear(GL_COLOR_BUFFER_BIT);
SwapBuffers(GetDC(GraphicsWnd));
glClearColor(0, 0, 0, 1);
glClear(GL_COLOR_BUFFER_BIT);
SwapBuffers(GetDC(GraphicsWnd));
// Create the heaps for all dynamic memory (AllocTemporary, MemAlloc)
InitHeaps();
@ -1073,9 +1083,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
// Call in to the platform-independent code, and let them do their init
SS.Init(file);
ShowWindow(TextWnd, SW_SHOWNOACTIVATE);
ShowWindow(GraphicsWnd, SW_SHOW);
// And now it's the message loop. All calls in to the rest of the code
// will be from the wndprocs.
MSG msg;

View File

@ -1,12 +1,10 @@
tangent intersections
plane detection for solid of revolution
-----
line styles (color, thickness)
marching algorithm for surface intersection
loop detection
IGES and STEP export
incremental regen of entities?
IGES export
incremental regen of entities