Make the number of digits after the decimal point (for dimensions,
as they are displayed on the drawing, and for many other places) a user-configurable parameter. Also reshuffle some options in the configuration screen, to put all the stuff relating to exports together. [git-p4: depot-paths = "//depot/solvespace/": change = 2179]
This commit is contained in:
parent
e672706770
commit
cc3b17f60e
|
@ -53,16 +53,23 @@ void TextWindow::ScreenChangeGridSpacing(int link, DWORD v) {
|
||||||
SS.TW.edit.meaning = EDIT_GRID_SPACING;
|
SS.TW.edit.meaning = EDIT_GRID_SPACING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TextWindow::ScreenChangeDigitsAfterDecimal(int link, DWORD v) {
|
||||||
|
char buf[128];
|
||||||
|
sprintf(buf, "%d", SS.UnitDigitsAfterDecimal());
|
||||||
|
SS.TW.ShowEditControl(55, 3, buf);
|
||||||
|
SS.TW.edit.meaning = EDIT_DIGITS_AFTER_DECIMAL;
|
||||||
|
}
|
||||||
|
|
||||||
void TextWindow::ScreenChangeExportScale(int link, DWORD v) {
|
void TextWindow::ScreenChangeExportScale(int link, DWORD v) {
|
||||||
char str[1024];
|
char str[1024];
|
||||||
sprintf(str, "%.3f", (double)SS.exportScale);
|
sprintf(str, "%.3f", (double)SS.exportScale);
|
||||||
|
|
||||||
SS.TW.ShowEditControl(57, 5, str);
|
SS.TW.ShowEditControl(61, 5, str);
|
||||||
SS.TW.edit.meaning = EDIT_EXPORT_SCALE;
|
SS.TW.edit.meaning = EDIT_EXPORT_SCALE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextWindow::ScreenChangeExportOffset(int link, DWORD v) {
|
void TextWindow::ScreenChangeExportOffset(int link, DWORD v) {
|
||||||
SS.TW.ShowEditControl(61, 3, SS.MmToString(SS.exportOffset));
|
SS.TW.ShowEditControl(65, 3, SS.MmToString(SS.exportOffset));
|
||||||
SS.TW.edit.meaning = EDIT_EXPORT_OFFSET;
|
SS.TW.edit.meaning = EDIT_EXPORT_OFFSET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +121,7 @@ void TextWindow::ScreenChangeCanvasSize(int link, DWORD v) {
|
||||||
|
|
||||||
default: return;
|
default: return;
|
||||||
}
|
}
|
||||||
int row = 75, col;
|
int row = 81, col;
|
||||||
if(v < 10) {
|
if(v < 10) {
|
||||||
row += v*2;
|
row += v*2;
|
||||||
col = 11;
|
col = 11;
|
||||||
|
@ -129,7 +136,7 @@ void TextWindow::ScreenChangeCanvasSize(int link, DWORD v) {
|
||||||
|
|
||||||
void TextWindow::ScreenChangeGCodeParameter(int link, DWORD v) {
|
void TextWindow::ScreenChangeGCodeParameter(int link, DWORD v) {
|
||||||
char buf[1024] = "";
|
char buf[1024] = "";
|
||||||
int row = 95;
|
int row = 93;
|
||||||
switch(link) {
|
switch(link) {
|
||||||
case 'd':
|
case 'd':
|
||||||
SS.TW.edit.meaning = EDIT_G_CODE_DEPTH;
|
SS.TW.edit.meaning = EDIT_G_CODE_DEPTH;
|
||||||
|
@ -203,6 +210,11 @@ void TextWindow::ShowConfiguration(void) {
|
||||||
Printf(false, "%Ba %s %Fl%Ll%f%D[change]%E",
|
Printf(false, "%Ba %s %Fl%Ll%f%D[change]%E",
|
||||||
SS.MmToString(SS.gridSpacing),
|
SS.MmToString(SS.gridSpacing),
|
||||||
&ScreenChangeGridSpacing, 0);
|
&ScreenChangeGridSpacing, 0);
|
||||||
|
Printf(false, "%Ft digits after decimal point to show%E");
|
||||||
|
Printf(false, "%Ba %d %Fl%Ll%f%D[change]%E (e.g. '%s')",
|
||||||
|
SS.UnitDigitsAfterDecimal(),
|
||||||
|
&ScreenChangeDigitsAfterDecimal, 0,
|
||||||
|
SS.MmToString(SS.StringToMm("1.23456789")));
|
||||||
|
|
||||||
Printf(false, "");
|
Printf(false, "");
|
||||||
Printf(false, "%Ft export scale factor (1:1=mm, 1:25.4=inch)");
|
Printf(false, "%Ft export scale factor (1:1=mm, 1:25.4=inch)");
|
||||||
|
@ -218,7 +230,6 @@ void TextWindow::ShowConfiguration(void) {
|
||||||
Printf(false, " %Fd%f%Ll%c export shaded 2d triangles%E",
|
Printf(false, " %Fd%f%Ll%c export shaded 2d triangles%E",
|
||||||
&ScreenChangeShadedTriangles,
|
&ScreenChangeShadedTriangles,
|
||||||
SS.exportShadedTriangles ? CHECK_TRUE : CHECK_FALSE);
|
SS.exportShadedTriangles ? CHECK_TRUE : CHECK_FALSE);
|
||||||
|
|
||||||
if(fabs(SS.exportOffset) > LENGTH_EPS) {
|
if(fabs(SS.exportOffset) > LENGTH_EPS) {
|
||||||
Printf(false, " %Fd%c curves as piecewise linear%E "
|
Printf(false, " %Fd%c curves as piecewise linear%E "
|
||||||
"(since cutter radius is not zero)", CHECK_TRUE);
|
"(since cutter radius is not zero)", CHECK_TRUE);
|
||||||
|
@ -227,6 +238,9 @@ void TextWindow::ShowConfiguration(void) {
|
||||||
&ScreenChangePwlCurves,
|
&ScreenChangePwlCurves,
|
||||||
SS.exportPwlCurves ? CHECK_TRUE : CHECK_FALSE);
|
SS.exportPwlCurves ? CHECK_TRUE : CHECK_FALSE);
|
||||||
}
|
}
|
||||||
|
Printf(false, " %Fd%f%Ll%c fix white exported lines%E",
|
||||||
|
&ScreenChangeFixExportColors,
|
||||||
|
SS.fixExportColors ? CHECK_TRUE : CHECK_FALSE);
|
||||||
|
|
||||||
Printf(false, "");
|
Printf(false, "");
|
||||||
Printf(false, "%Ft export canvas size: "
|
Printf(false, "%Ft export canvas size: "
|
||||||
|
@ -259,17 +273,6 @@ void TextWindow::ShowConfiguration(void) {
|
||||||
SS.MmToString(SS.exportCanvas.dy), &ScreenChangeCanvasSize, 13);
|
SS.MmToString(SS.exportCanvas.dy), &ScreenChangeCanvasSize, 13);
|
||||||
}
|
}
|
||||||
|
|
||||||
Printf(false, "");
|
|
||||||
Printf(false, " %Fd%f%Ll%c fix white exported lines%E",
|
|
||||||
&ScreenChangeFixExportColors,
|
|
||||||
SS.fixExportColors ? CHECK_TRUE : CHECK_FALSE);
|
|
||||||
Printf(false, " %Fd%f%Ll%c draw triangle back faces in red%E",
|
|
||||||
&ScreenChangeBackFaces,
|
|
||||||
SS.drawBackFaces ? CHECK_TRUE : CHECK_FALSE);
|
|
||||||
Printf(false, " %Fd%f%Ll%c check sketch for closed contour%E",
|
|
||||||
&ScreenChangeCheckClosedContour,
|
|
||||||
SS.checkClosedContour ? CHECK_TRUE : CHECK_FALSE);
|
|
||||||
|
|
||||||
Printf(false, "");
|
Printf(false, "");
|
||||||
Printf(false, "%Ft exported g code parameters");
|
Printf(false, "%Ft exported g code parameters");
|
||||||
Printf(false, "%Ba%Ft depth: %Fd%s %Fl%Ld%f[change]%E",
|
Printf(false, "%Ba%Ft depth: %Fd%s %Fl%Ld%f[change]%E",
|
||||||
|
@ -280,6 +283,14 @@ void TextWindow::ShowConfiguration(void) {
|
||||||
SS.MmToString(SS.gCode.feed), &ScreenChangeGCodeParameter);
|
SS.MmToString(SS.gCode.feed), &ScreenChangeGCodeParameter);
|
||||||
Printf(false, "%Bd%Ft plunge fd: %Fd%s %Fl%LP%f[change]%E",
|
Printf(false, "%Bd%Ft plunge fd: %Fd%s %Fl%LP%f[change]%E",
|
||||||
SS.MmToString(SS.gCode.plungeFeed), &ScreenChangeGCodeParameter);
|
SS.MmToString(SS.gCode.plungeFeed), &ScreenChangeGCodeParameter);
|
||||||
|
|
||||||
|
Printf(false, "");
|
||||||
|
Printf(false, " %Fd%f%Ll%c draw triangle back faces in red%E",
|
||||||
|
&ScreenChangeBackFaces,
|
||||||
|
SS.drawBackFaces ? CHECK_TRUE : CHECK_FALSE);
|
||||||
|
Printf(false, " %Fd%f%Ll%c check sketch for closed contour%E",
|
||||||
|
&ScreenChangeCheckClosedContour,
|
||||||
|
SS.checkClosedContour ? CHECK_TRUE : CHECK_FALSE);
|
||||||
|
|
||||||
Printf(false, "");
|
Printf(false, "");
|
||||||
Printf(false, " %Ftgl vendor %E%s", glGetString(GL_VENDOR));
|
Printf(false, " %Ftgl vendor %E%s", glGetString(GL_VENDOR));
|
||||||
|
@ -338,6 +349,16 @@ bool TextWindow::EditControlDoneForConfiguration(char *s) {
|
||||||
InvalidateGraphics();
|
InvalidateGraphics();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case EDIT_DIGITS_AFTER_DECIMAL: {
|
||||||
|
int v = atoi(s);
|
||||||
|
if(v < 0 || v > 8) {
|
||||||
|
Error("Specify between 0 and 8 digits after the decimal.");
|
||||||
|
} else {
|
||||||
|
SS.SetUnitDigitsAfterDecimal(v);
|
||||||
|
}
|
||||||
|
InvalidateGraphics();
|
||||||
|
break;
|
||||||
|
}
|
||||||
case EDIT_EXPORT_SCALE: {
|
case EDIT_EXPORT_SCALE: {
|
||||||
Expr *e = Expr::From(s, true);
|
Expr *e = Expr::From(s, true);
|
||||||
if(e) {
|
if(e) {
|
||||||
|
|
|
@ -64,6 +64,9 @@ void SolveSpace::Init(char *cmdLine) {
|
||||||
maxSegments = CnfThawDWORD(10, "MaxSegments");
|
maxSegments = CnfThawDWORD(10, "MaxSegments");
|
||||||
// View units
|
// View units
|
||||||
viewUnits = (Unit)CnfThawDWORD((DWORD)UNIT_MM, "ViewUnits");
|
viewUnits = (Unit)CnfThawDWORD((DWORD)UNIT_MM, "ViewUnits");
|
||||||
|
// Number of digits after the decimal point
|
||||||
|
afterDecimalMm = CnfThawDWORD(2, "AfterDecimalMm");
|
||||||
|
afterDecimalInch = CnfThawDWORD(3, "AfterDecimalInch");
|
||||||
// Camera tangent (determines perspective)
|
// Camera tangent (determines perspective)
|
||||||
cameraTangent = CnfThawFloat(0.3f/1e3f, "CameraTangent");
|
cameraTangent = CnfThawFloat(0.3f/1e3f, "CameraTangent");
|
||||||
// Grid spacing
|
// Grid spacing
|
||||||
|
@ -157,8 +160,11 @@ void SolveSpace::Exit(void) {
|
||||||
CnfFreezeFloat((float)chordTol, "ChordTolerance");
|
CnfFreezeFloat((float)chordTol, "ChordTolerance");
|
||||||
// Max pwl segments to generate
|
// Max pwl segments to generate
|
||||||
CnfFreezeDWORD((DWORD)maxSegments, "MaxSegments");
|
CnfFreezeDWORD((DWORD)maxSegments, "MaxSegments");
|
||||||
// Display/entry units
|
// View units
|
||||||
CnfFreezeDWORD((DWORD)viewUnits, "ViewUnits");
|
CnfFreezeDWORD((DWORD)viewUnits, "ViewUnits");
|
||||||
|
// Number of digits after the decimal point
|
||||||
|
CnfFreezeDWORD((DWORD)afterDecimalMm, "AfterDecimalMm");
|
||||||
|
CnfFreezeDWORD((DWORD)afterDecimalInch, "AfterDecimalInch");
|
||||||
// Camera tangent (determines perspective)
|
// Camera tangent (determines perspective)
|
||||||
CnfFreezeFloat((float)cameraTangent, "CameraTangent");
|
CnfFreezeFloat((float)cameraTangent, "CameraTangent");
|
||||||
// Grid spacing
|
// Grid spacing
|
||||||
|
@ -228,15 +234,18 @@ char *SolveSpace::UnitName(void) {
|
||||||
char *SolveSpace::MmToString(double v) {
|
char *SolveSpace::MmToString(double v) {
|
||||||
static int WhichBuf;
|
static int WhichBuf;
|
||||||
static char Bufs[8][128];
|
static char Bufs[8][128];
|
||||||
|
char fmt[128];
|
||||||
|
|
||||||
WhichBuf++;
|
WhichBuf++;
|
||||||
if(WhichBuf >= 8 || WhichBuf < 0) WhichBuf = 0;
|
if(WhichBuf >= 8 || WhichBuf < 0) WhichBuf = 0;
|
||||||
|
|
||||||
char *s = Bufs[WhichBuf];
|
char *s = Bufs[WhichBuf];
|
||||||
if(viewUnits == UNIT_INCHES) {
|
if(viewUnits == UNIT_INCHES) {
|
||||||
sprintf(s, "%.3f", v/25.4);
|
sprintf(fmt, "%%.%df", afterDecimalInch);
|
||||||
|
sprintf(s, fmt, v/25.4);
|
||||||
} else {
|
} else {
|
||||||
sprintf(s, "%.2f", v);
|
sprintf(fmt, "%%.%df", afterDecimalMm);
|
||||||
|
sprintf(s, fmt, v);
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
@ -249,6 +258,16 @@ double SolveSpace::StringToMm(char *str) {
|
||||||
double SolveSpace::ChordTolMm(void) {
|
double SolveSpace::ChordTolMm(void) {
|
||||||
return SS.chordTol / SS.GW.scale;
|
return SS.chordTol / SS.GW.scale;
|
||||||
}
|
}
|
||||||
|
int SolveSpace::UnitDigitsAfterDecimal(void) {
|
||||||
|
return (viewUnits == UNIT_INCHES) ? afterDecimalInch : afterDecimalMm;
|
||||||
|
}
|
||||||
|
void SolveSpace::SetUnitDigitsAfterDecimal(int v) {
|
||||||
|
if(viewUnits == UNIT_INCHES) {
|
||||||
|
afterDecimalInch = v;
|
||||||
|
} else {
|
||||||
|
afterDecimalMm = v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
double SolveSpace::CameraTangent(void) {
|
double SolveSpace::CameraTangent(void) {
|
||||||
if(!usePerspectiveProj) {
|
if(!usePerspectiveProj) {
|
||||||
|
|
|
@ -645,11 +645,16 @@ public:
|
||||||
UNIT_INCHES,
|
UNIT_INCHES,
|
||||||
} Unit;
|
} Unit;
|
||||||
Unit viewUnits;
|
Unit viewUnits;
|
||||||
|
int afterDecimalMm;
|
||||||
|
int afterDecimalInch;
|
||||||
|
|
||||||
char *MmToString(double v);
|
char *MmToString(double v);
|
||||||
double ExprToMm(Expr *e);
|
double ExprToMm(Expr *e);
|
||||||
double StringToMm(char *s);
|
double StringToMm(char *s);
|
||||||
char *UnitName(void);
|
char *UnitName(void);
|
||||||
double MmPerUnit(void);
|
double MmPerUnit(void);
|
||||||
|
int UnitDigitsAfterDecimal(void);
|
||||||
|
void SetUnitDigitsAfterDecimal(int v);
|
||||||
double ChordTolMm(void);
|
double ChordTolMm(void);
|
||||||
bool usePerspectiveProj;
|
bool usePerspectiveProj;
|
||||||
double CameraTangent(void);
|
double CameraTangent(void);
|
||||||
|
|
16
ui.h
16
ui.h
|
@ -141,13 +141,14 @@ public:
|
||||||
static const int EDIT_MAX_SEGMENTS = 104;
|
static const int EDIT_MAX_SEGMENTS = 104;
|
||||||
static const int EDIT_CAMERA_TANGENT = 105;
|
static const int EDIT_CAMERA_TANGENT = 105;
|
||||||
static const int EDIT_GRID_SPACING = 106;
|
static const int EDIT_GRID_SPACING = 106;
|
||||||
static const int EDIT_EXPORT_SCALE = 107;
|
static const int EDIT_DIGITS_AFTER_DECIMAL = 107;
|
||||||
static const int EDIT_EXPORT_OFFSET = 108;
|
static const int EDIT_EXPORT_SCALE = 108;
|
||||||
static const int EDIT_CANVAS_SIZE = 109;
|
static const int EDIT_EXPORT_OFFSET = 109;
|
||||||
static const int EDIT_G_CODE_DEPTH = 110;
|
static const int EDIT_CANVAS_SIZE = 110;
|
||||||
static const int EDIT_G_CODE_PASSES = 111;
|
static const int EDIT_G_CODE_DEPTH = 120;
|
||||||
static const int EDIT_G_CODE_FEED = 112;
|
static const int EDIT_G_CODE_PASSES = 121;
|
||||||
static const int EDIT_G_CODE_PLUNGE_FEED = 113;
|
static const int EDIT_G_CODE_FEED = 122;
|
||||||
|
static const int EDIT_G_CODE_PLUNGE_FEED = 123;
|
||||||
// For TTF text
|
// For TTF text
|
||||||
static const int EDIT_TTF_TEXT = 300;
|
static const int EDIT_TTF_TEXT = 300;
|
||||||
// For the step dimension screen
|
// For the step dimension screen
|
||||||
|
@ -285,6 +286,7 @@ public:
|
||||||
static void ScreenChangeMaxSegments(int link, DWORD v);
|
static void ScreenChangeMaxSegments(int link, DWORD v);
|
||||||
static void ScreenChangeCameraTangent(int link, DWORD v);
|
static void ScreenChangeCameraTangent(int link, DWORD v);
|
||||||
static void ScreenChangeGridSpacing(int link, DWORD v);
|
static void ScreenChangeGridSpacing(int link, DWORD v);
|
||||||
|
static void ScreenChangeDigitsAfterDecimal(int link, DWORD v);
|
||||||
static void ScreenChangeExportScale(int link, DWORD v);
|
static void ScreenChangeExportScale(int link, DWORD v);
|
||||||
static void ScreenChangeExportOffset(int link, DWORD v);
|
static void ScreenChangeExportOffset(int link, DWORD v);
|
||||||
static void ScreenChangeGCodeParameter(int link, DWORD v);
|
static void ScreenChangeGCodeParameter(int link, DWORD v);
|
||||||
|
|
|
@ -3,7 +3,7 @@ fix anti-aliased edge bug with filled contours
|
||||||
crude DXF, HPGL import
|
crude DXF, HPGL import
|
||||||
a request to import a plane thing
|
a request to import a plane thing
|
||||||
make export assemble only contours in same group
|
make export assemble only contours in same group
|
||||||
rotation works about first point under cursor
|
rotation of model view works about z of first point under cursor
|
||||||
|
|
||||||
-----
|
-----
|
||||||
rounding, as a special group
|
rounding, as a special group
|
||||||
|
|
Loading…
Reference in New Issue
Block a user