diff --git a/draw.cpp b/draw.cpp index d4e5b210..c12357da 100644 --- a/draw.cpp +++ b/draw.cpp @@ -771,6 +771,8 @@ nogrid:; glEnd(); } + // An extra line, used to indicate the origin when rotating within the + // plane of the monitor. if(SS.extraLine.draw) { glLineWidth(1); glxLockColorTo(Style::Color(Style::DATUM)); @@ -780,6 +782,32 @@ nogrid:; glEnd(); } + // A note to indicate the origin in the just-exported file. + if(SS.justExportedInfo.draw) { + glxColorRGB(Style::Color(Style::DATUM)); + Vector p = SS.justExportedInfo.pt, + u = SS.justExportedInfo.u, + v = SS.justExportedInfo.v; + + glLineWidth(1.5); + glBegin(GL_LINES); + glxVertex3v(p.Plus(u.WithMagnitude(-15/scale))); + glxVertex3v(p.Plus(u.WithMagnitude(30/scale))); + glxVertex3v(p.Plus(v.WithMagnitude(-15/scale))); + glxVertex3v(p.Plus(v.WithMagnitude(30/scale))); + glEnd(); + + glxWriteText("(x, y) = (0, 0) for file just exported", + DEFAULT_TEXT_HEIGHT, + p.Plus(u.ScaledBy(10/scale)).Plus(v.ScaledBy(10/scale)), + u, v, NULL, NULL); + glxWriteText("press Esc to clear this message", + DEFAULT_TEXT_HEIGHT, + p.Plus(u.ScaledBy(40/scale)).Plus( + v.ScaledBy(-(DEFAULT_TEXT_HEIGHT)/scale)), + u, v, NULL, NULL); + } + // And finally the toolbar. if(SS.showToolbar) { ToolbarDraw(); diff --git a/export.cpp b/export.cpp index 60349611..fb75d4e7 100644 --- a/export.cpp +++ b/export.cpp @@ -175,6 +175,17 @@ void SolveSpace::ExportViewOrWireframeTo(char *filename, bool wireframe) { u, v, n, origin, SS.CameraTangent()*SS.GW.scale, out); } + + if(!out->HasCanvasSize()) { + // These file formats don't have a canvas size, so they just + // get exported in the raw coordinate system. So indicate what + // that was on-screen. + SS.justExportedInfo.draw = true; + SS.justExportedInfo.pt = origin; + SS.justExportedInfo.u = u; + SS.justExportedInfo.v = v; + InvalidateGraphics(); + } } edges.Clear(); diff --git a/graphicswin.cpp b/graphicswin.cpp index 579d15bf..797ec99e 100644 --- a/graphicswin.cpp +++ b/graphicswin.cpp @@ -334,10 +334,12 @@ void GraphicsWindow::MenuView(int id) { switch(id) { case MNU_ZOOM_IN: SS.GW.scale *= 1.2; + SS.later.showTW = true; break; case MNU_ZOOM_OUT: SS.GW.scale /= 1.2; + SS.later.showTW = true; break; case MNU_ZOOM_TO_FIT: @@ -626,6 +628,7 @@ void GraphicsWindow::MenuEdit(int id) { SS.GW.ClearSuper(); HideTextEditControl(); SS.nakedEdges.Clear(); + SS.justExportedInfo.draw = false; break; case MNU_SELECT_ALL: { diff --git a/solvespace.h b/solvespace.h index addfba31..8887365b 100644 --- a/solvespace.h +++ b/solvespace.h @@ -428,6 +428,7 @@ public: virtual void Triangle(STriangle *tr) = 0; virtual void StartFile(void) = 0; virtual void FinishAndCloseFile(void) = 0; + virtual bool HasCanvasSize(void) = 0; }; class DxfFileWriter : public VectorFileWriter { public: @@ -439,6 +440,7 @@ public: void Bezier(SBezier *sb); void StartFile(void); void FinishAndCloseFile(void); + bool HasCanvasSize(void) { return false; } }; class EpsFileWriter : public VectorFileWriter { public: @@ -453,6 +455,7 @@ public: void Bezier(SBezier *sb); void StartFile(void); void FinishAndCloseFile(void); + bool HasCanvasSize(void) { return true; } }; class PdfFileWriter : public VectorFileWriter { public: @@ -469,6 +472,7 @@ public: void Bezier(SBezier *sb); void StartFile(void); void FinishAndCloseFile(void); + bool HasCanvasSize(void) { return true; } }; class SvgFileWriter : public VectorFileWriter { public: @@ -483,6 +487,7 @@ public: void Bezier(SBezier *sb); void StartFile(void); void FinishAndCloseFile(void); + bool HasCanvasSize(void) { return true; } }; class HpglFileWriter : public VectorFileWriter { public: @@ -495,6 +500,7 @@ public: void Bezier(SBezier *sb); void StartFile(void); void FinishAndCloseFile(void); + bool HasCanvasSize(void) { return false; } }; class Step2dFileWriter : public VectorFileWriter { StepFileWriter sfw; @@ -506,6 +512,7 @@ class Step2dFileWriter : public VectorFileWriter { void Bezier(SBezier *sb); void StartFile(void); void FinishAndCloseFile(void); + bool HasCanvasSize(void) { return false; } }; class GCodeFileWriter : public VectorFileWriter { public: @@ -518,6 +525,7 @@ public: void Bezier(SBezier *sb); void StartFile(void); void FinishAndCloseFile(void); + bool HasCanvasSize(void) { return false; } }; #ifdef LIBRARY @@ -710,6 +718,10 @@ public: double scale; // pixels per mm Vector origin; } bgImage; + struct { + bool draw; + Vector pt, u, v; + } justExportedInfo; class Clipboard { public: