Add Units schemaTranslate for Unit::Velocity.

Independent of scale, use only mm/min or in/min because it is compatible
with GCODE feed rate units.
(My use case is definition os feed-rates in PathLoadTool.py).
This commit is contained in:
Itai Nahshon
2017-06-16 14:54:18 +03:00
committed by wmayer
parent b5a82693ce
commit a42391fa3b
4 changed files with 24 additions and 0 deletions

View File

@@ -62,6 +62,10 @@ QString UnitsSchemaCentimeters::schemaTranslate(const Base::Quantity& quant, dou
unitString = QString::fromLatin1("W/m^2");
factor = 1.0;
}
else if (unit == Unit::Velocity) {
unitString = QString::fromLatin1("mm/min");
factor = 1.0/60;
}
else {
// default action for all cases without special treatment:
unitString = quant.getUnit().getString();

View File

@@ -127,6 +127,10 @@ QString UnitsSchemaImperial1::schemaTranslate(const Quantity &quant, double &fac
factor = 0.145038;
}
}
else if (unit == Unit::Velocity) {
unitString = QString::fromLatin1("in/min");
factor = 25.4/60;
}
else{
// default action for all cases without special treatment:
unitString = quant.getUnit().getString();
@@ -188,6 +192,10 @@ QString UnitsSchemaImperialDecimal::schemaTranslate(const Base::Quantity& quant,
factor = 0.145038;
}
}
else if (unit == Unit::Velocity) {
unitString = QString::fromLatin1("in/min");
factor = 25.4/60;
}
else {
// default action for all cases without special treatment:
unitString = quant.getUnit().getString();
@@ -266,6 +274,10 @@ QString UnitsSchemaImperialBuilding::schemaTranslate(const Quantity &quant, doub
unitString = QString::fromLatin1("cuft");
factor = 28316846.592;
}
else if (unit == Unit::Velocity) {
unitString = QString::fromLatin1("in/min");
factor = 25.4/60;
}
else {
unitString = quant.getUnit().getString();
factor = 1.0;

View File

@@ -163,6 +163,10 @@ QString UnitsSchemaInternal::schemaTranslate(const Quantity &quant, double &fact
unitString = QString::fromLatin1("W/m^2");
factor = 1.0;
}
else if (unit == Unit::Velocity) {
unitString = QString::fromLatin1("mm/min");
factor = 1.0/60;
}
else {
// default action for all cases without special treatment:
unitString = quant.getUnit().getString();

View File

@@ -164,6 +164,10 @@ QString UnitsSchemaMKS::schemaTranslate(const Quantity &quant, double &factor, Q
unitString = QString::fromLatin1("W/m^2");
factor = 1.0;
}
else if (unit == Unit::Velocity) {
unitString = QString::fromLatin1("mm/min");
factor = 1.0/60;
}
else {
// default action for all cases without special treatment:
unitString = quant.getUnit().getString();