Allow using m (in addition to mm and inch) as base unit.
This commit is contained in:
parent
6ad5c684d8
commit
a16c204304
@ -45,12 +45,13 @@ New rendering features:
|
|||||||
* The "Show/hide outlines" button is now independent from "Show/hide edges".
|
* The "Show/hide outlines" button is now independent from "Show/hide edges".
|
||||||
|
|
||||||
New measurement/analysis features:
|
New measurement/analysis features:
|
||||||
|
* New choice for base unit, meters.
|
||||||
* New command for measuring total length of selected entities,
|
* New command for measuring total length of selected entities,
|
||||||
"Analyze → Measure Perimeter".
|
"Analyze → Measure Perimeter".
|
||||||
* New command for measuring center of mass, with live updates as the sketch
|
* New command for measuring center of mass, with live updates as the sketch
|
||||||
changes, "Analyze → Center of Mass".
|
changes, "Analyze → Center of Mass".
|
||||||
* New option for displaying areas of closed contours.
|
* New option for displaying areas of closed contours.
|
||||||
* When selecting a point and a line, projected distance to to current
|
* When selecting a point and a line, projected distance to current
|
||||||
workplane is displayed.
|
workplane is displayed.
|
||||||
|
|
||||||
Other new features:
|
Other new features:
|
||||||
|
@ -75,13 +75,14 @@ const GraphicsWindow::MenuEntry GraphicsWindow::menu[] = {
|
|||||||
{ 1, NULL, Command::NONE, 0, TN, NULL },
|
{ 1, NULL, Command::NONE, 0, TN, NULL },
|
||||||
{ 1, N_("Show Snap &Grid"), Command::SHOW_GRID, '>', TC, mView },
|
{ 1, N_("Show Snap &Grid"), Command::SHOW_GRID, '>', TC, mView },
|
||||||
{ 1, N_("Use &Perspective Projection"), Command::PERSPECTIVE_PROJ, '`', TC, mView },
|
{ 1, N_("Use &Perspective Projection"), Command::PERSPECTIVE_PROJ, '`', TC, mView },
|
||||||
|
{ 1, N_("Dimension &Units"), Command::NONE, 0, TN, NULL },
|
||||||
|
{ 2, N_("Dimensions in &Inches"), Command::UNITS_INCHES, 0, TR, mView },
|
||||||
|
{ 2, N_("Dimensions in &Millimeters"), Command::UNITS_MM, 0, TR, mView },
|
||||||
|
{ 2, N_("Dimensions in M&eters"), Command::UNITS_METERS, 0, TR, mView },
|
||||||
{ 1, NULL, Command::NONE, 0, TN, NULL },
|
{ 1, NULL, Command::NONE, 0, TN, NULL },
|
||||||
{ 1, N_("Show &Toolbar"), Command::SHOW_TOOLBAR, 0, TC, mView },
|
{ 1, N_("Show &Toolbar"), Command::SHOW_TOOLBAR, 0, TC, mView },
|
||||||
{ 1, N_("Show Property Bro&wser"), Command::SHOW_TEXT_WND, '\t', TC, mView },
|
{ 1, N_("Show Property Bro&wser"), Command::SHOW_TEXT_WND, '\t', TC, mView },
|
||||||
{ 1, NULL, Command::NONE, 0, TN, NULL },
|
{ 1, NULL, Command::NONE, 0, TN, NULL },
|
||||||
{ 1, N_("Dimensions in &Inches"), Command::UNITS_INCHES, 0, TR, mView },
|
|
||||||
{ 1, N_("Dimensions in &Millimeters"), Command::UNITS_MM, 0, TR, mView },
|
|
||||||
{ 1, NULL, Command::NONE, 0, TN, NULL },
|
|
||||||
{ 1, N_("&Full Screen"), Command::FULL_SCREEN, C|F(11), TC, mView },
|
{ 1, N_("&Full Screen"), Command::FULL_SCREEN, C|F(11), TC, mView },
|
||||||
|
|
||||||
{ 0, N_("&New Group"), Command::NONE, 0, TN, NULL },
|
{ 0, N_("&New Group"), Command::NONE, 0, TN, NULL },
|
||||||
@ -605,6 +606,12 @@ void GraphicsWindow::MenuView(Command id) {
|
|||||||
SS.GW.EnsureValidActives();
|
SS.GW.EnsureValidActives();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Command::UNITS_METERS:
|
||||||
|
SS.viewUnits = Unit::METERS;
|
||||||
|
SS.ScheduleShowTW();
|
||||||
|
SS.GW.EnsureValidActives();
|
||||||
|
break;
|
||||||
|
|
||||||
case Command::FULL_SCREEN:
|
case Command::FULL_SCREEN:
|
||||||
ToggleFullScreen();
|
ToggleFullScreen();
|
||||||
SS.GW.EnsureValidActives();
|
SS.GW.EnsureValidActives();
|
||||||
@ -671,12 +678,14 @@ void GraphicsWindow::EnsureValidActives() {
|
|||||||
switch(SS.viewUnits) {
|
switch(SS.viewUnits) {
|
||||||
case Unit::MM:
|
case Unit::MM:
|
||||||
case Unit::INCHES:
|
case Unit::INCHES:
|
||||||
|
case Unit::METERS:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
SS.viewUnits = Unit::MM;
|
SS.viewUnits = Unit::MM;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
RadioMenuByCmd(Command::UNITS_MM, SS.viewUnits == Unit::MM);
|
RadioMenuByCmd(Command::UNITS_MM, SS.viewUnits == Unit::MM);
|
||||||
|
RadioMenuByCmd(Command::UNITS_METERS, SS.viewUnits == Unit::METERS);
|
||||||
RadioMenuByCmd(Command::UNITS_INCHES, SS.viewUnits == Unit::INCHES);
|
RadioMenuByCmd(Command::UNITS_INCHES, SS.viewUnits == Unit::INCHES);
|
||||||
|
|
||||||
ShowTextWindow(SS.GW.showTextWindow);
|
ShowTextWindow(SS.GW.showTextWindow);
|
||||||
|
@ -250,25 +250,29 @@ void SolveSpaceUI::DoLater() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
double SolveSpaceUI::MmPerUnit() {
|
double SolveSpaceUI::MmPerUnit() {
|
||||||
if(viewUnits == Unit::INCHES) {
|
switch(viewUnits) {
|
||||||
return 25.4;
|
case Unit::INCHES: return 25.4;
|
||||||
} else {
|
case Unit::METERS: return 1000.0;
|
||||||
return 1.0;
|
case Unit::MM: return 1.0;
|
||||||
}
|
}
|
||||||
|
return 1.0;
|
||||||
}
|
}
|
||||||
const char *SolveSpaceUI::UnitName() {
|
const char *SolveSpaceUI::UnitName() {
|
||||||
if(viewUnits == Unit::INCHES) {
|
switch(viewUnits) {
|
||||||
return "inch";
|
case Unit::INCHES: return "inch";
|
||||||
} else {
|
case Unit::METERS: return "m";
|
||||||
return "mm";
|
case Unit::MM: return "mm";
|
||||||
}
|
}
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string SolveSpaceUI::MmToString(double v) {
|
std::string SolveSpaceUI::MmToString(double v) {
|
||||||
if(viewUnits == Unit::INCHES) {
|
switch(viewUnits) {
|
||||||
return ssprintf("%.*f", afterDecimalInch, v/25.4);
|
case Unit::INCHES: return ssprintf("%.*f", afterDecimalInch, v / 25.4);
|
||||||
} else {
|
case Unit::METERS: return ssprintf("%.*f", afterDecimalMm, v / 1000.0);
|
||||||
return ssprintf("%.*f", afterDecimalMm, v);
|
case Unit::MM: return ssprintf("%.*f", afterDecimalMm, v);
|
||||||
}
|
}
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
double SolveSpaceUI::ExprToMm(Expr *e) {
|
double SolveSpaceUI::ExprToMm(Expr *e) {
|
||||||
return (e->Eval()) * MmPerUnit();
|
return (e->Eval()) * MmPerUnit();
|
||||||
|
@ -151,7 +151,8 @@ DialogChoice LocateImportedFileYesNoCancel(const Platform::Path &filename,
|
|||||||
|
|
||||||
enum class Unit : uint32_t {
|
enum class Unit : uint32_t {
|
||||||
MM = 0,
|
MM = 0,
|
||||||
INCHES
|
INCHES,
|
||||||
|
METERS
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FileFilter;
|
struct FileFilter;
|
||||||
|
Loading…
Reference in New Issue
Block a user