diff --git a/src/App/Application.cpp b/src/App/Application.cpp index 0e86aa9bdb..11b078c97a 100644 --- a/src/App/Application.cpp +++ b/src/App/Application.cpp @@ -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(); diff --git a/src/App/PropertyUnits.cpp b/src/App/PropertyUnits.cpp index 6c0f60f8a8..867555456c 100644 --- a/src/App/PropertyUnits.cpp +++ b/src/App/PropertyUnits.cpp @@ -555,6 +555,17 @@ PropertyMass::PropertyMass() setUnit(Base::Unit::Mass); } +//************************************************************************** +// PropertyMoment +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +TYPESYSTEM_SOURCE(App::PropertyMoment, App::PropertyQuantity) + +PropertyMoment::PropertyMoment() +{ + setUnit(Base::Unit::Moment); +} + //************************************************************************** // PropertyPressure //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/src/App/PropertyUnits.h b/src/App/PropertyUnits.h index fc32e080b1..c0854e47c1 100644 --- a/src/App/PropertyUnits.h +++ b/src/App/PropertyUnits.h @@ -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. diff --git a/src/Base/Unit.cpp b/src/Base/Unit.cpp index 7aa14c7526..46a5dbe3ef 100644 --- a/src/Base/Unit.cpp +++ b/src/Base/Unit.cpp @@ -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); diff --git a/src/Base/Unit.h b/src/Base/Unit.h index 77b325a784..5e957a97a7 100644 --- a/src/Base/Unit.h +++ b/src/Base/Unit.h @@ -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; diff --git a/src/Base/UnitsSchemaInternal.cpp b/src/Base/UnitsSchemaInternal.cpp index 355e8307c7..4b141fd247 100644 --- a/src/Base/UnitsSchemaInternal.cpp +++ b/src/Base/UnitsSchemaInternal.cpp @@ -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"); diff --git a/src/Base/UnitsSchemaMKS.cpp b/src/Base/UnitsSchemaMKS.cpp index aba27295ab..96034a9495 100644 --- a/src/Base/UnitsSchemaMKS.cpp +++ b/src/Base/UnitsSchemaMKS.cpp @@ -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");