Skip to content

Commit

Permalink
Add Units schemaTranslate for Unit::Velocity.
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
Itai Nahshon committed Jun 16, 2017
1 parent fcb5667 commit ecc762c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Base/UnitsSchemaCentimeters.cpp
Expand Up @@ -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();
Expand Down
12 changes: 12 additions & 0 deletions src/Base/UnitsSchemaImperial1.cpp
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions src/Base/UnitsSchemaInternal.cpp
Expand Up @@ -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();
Expand Down
4 changes: 4 additions & 0 deletions src/Base/UnitsSchemaMKS.cpp
Expand Up @@ -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();
Expand Down

0 comments on commit ecc762c

Please sign in to comment.