Base: Add moment unit

This commit is contained in:
FEA-eng
2024-03-15 19:36:48 +01:00
committed by Chris Hennes
parent 53b9c0b6e6
commit 14a7ca99cd
7 changed files with 66 additions and 0 deletions

View File

@@ -2027,6 +2027,7 @@ void Application::initTypes()
App::PropertyMagneticFluxDensity ::init();
App::PropertyMagnetization ::init();
App::PropertyMass ::init();
App::PropertyMoment ::init();
App::PropertyPressure ::init();
App::PropertyPower ::init();
App::PropertyShearModulus ::init();

View File

@@ -555,6 +555,17 @@ PropertyMass::PropertyMass()
setUnit(Base::Unit::Mass);
}
//**************************************************************************
// PropertyMoment
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
TYPESYSTEM_SOURCE(App::PropertyMoment, App::PropertyQuantity)
PropertyMoment::PropertyMoment()
{
setUnit(Base::Unit::Moment);
}
//**************************************************************************
// PropertyPressure
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

View File

@@ -540,6 +540,19 @@ public:
~PropertyMass() override = default;
};
/** Moment property
* This is a property for representing moment. It is basically a float
* property. On the Gui it has a quantity like N*m.
*/
class AppExport PropertyMoment: public PropertyQuantity
{
TYPESYSTEM_HEADER_WITH_OVERRIDE();
public:
PropertyMoment();
~PropertyMoment() override = default;
};
/** Pressure property
* This is a property for representing pressure. It basically a float
* property. On the Gui it has a quantity like Pa.

View File

@@ -623,6 +623,9 @@ QString Unit::getTypeString() const
if (*this == Unit::YoungsModulus) {
return QString::fromLatin1("YoungsModulus");
}
if (*this == Unit::Moment) {
return QString::fromLatin1("Moment");
}
return {};
}
@@ -664,6 +667,7 @@ const Unit Unit::MagneticFieldStrength (-1,0,0,1);
const Unit Unit::MagneticFlux (2,1,-2,-1);
const Unit Unit::MagneticFluxDensity (0,1,-2,-1);
const Unit Unit::Magnetization (-1,0,0,1);
const Unit Unit::Moment (2, 1, -2);
const Unit Unit::Pressure (-1,1,-2);
const Unit Unit::Power (2, 1, -3);
const Unit Unit::ShearModulus (-1,1,-2);

View File

@@ -155,6 +155,7 @@ public:
static const Unit Force;
static const Unit Work;
static const Unit Power;
static const Unit Moment;
static const Unit SpecificEnergy;
static const Unit ThermalConductivity;

View File

@@ -272,6 +272,24 @@ UnitsSchemaInternal::schemaTranslate(const Quantity& quant, double& factor, QStr
factor = 1e9;
}
}
// else if (unit == Unit::Moment) {
// if (UnitValue < 1e6) {
// unitString = QString::fromLatin1("mNm");
// factor = 1e3;
// }
// else if (UnitValue < 1e9) {
// unitString = QString::fromLatin1("Nm");
// factor = 1e6;
// }
// else if (UnitValue < 1e12) {
// unitString = QString::fromLatin1("kNm");
// factor = 1e9;
// }
// else {
// unitString = QString::fromLatin1("MNm");
// factor = 1e12;
// }
// }
else if (unit == Unit::Power) {
if (UnitValue < 1e6) {
unitString = QString::fromLatin1("mW");

View File

@@ -261,6 +261,24 @@ QString UnitsSchemaMKS::schemaTranslate(const Quantity& quant, double& factor, Q
factor = 1e9;
}
}
// else if (unit == Unit::Moment) {
// if (UnitValue < 1e6) {
// unitString = QString::fromLatin1("mNm");
// factor = 1e3;
// }
// else if (UnitValue < 1e9) {
// unitString = QString::fromLatin1("Nm");
// factor = 1e6;
// }
// else if (UnitValue < 1e12) {
// unitString = QString::fromLatin1("kNm");
// factor = 1e9;
// }
// else {
// unitString = QString::fromLatin1("MNm");
// factor = 1e12;
// }
// }
else if (unit == Unit::Power) {
if (UnitValue < 1e6) {
unitString = QString::fromLatin1("mW");