diff --git a/src/App/Application.cpp b/src/App/Application.cpp index 741cc97d36..c02e2ebbad 100644 --- a/src/App/Application.cpp +++ b/src/App/Application.cpp @@ -2027,6 +2027,7 @@ void Application::initTypes() App::PropertySpecificHeat ::init(); App::PropertySpeed ::init(); App::PropertyStiffness ::init(); + App::PropertyStiffnessDensity ::init(); App::PropertyStress ::init(); App::PropertyTemperature ::init(); App::PropertyThermalConductivity ::init(); diff --git a/src/App/PropertyUnits.cpp b/src/App/PropertyUnits.cpp index f7106d1061..6c0f60f8a8 100644 --- a/src/App/PropertyUnits.cpp +++ b/src/App/PropertyUnits.cpp @@ -621,6 +621,17 @@ PropertyStiffness::PropertyStiffness() setUnit(Base::Unit::Stiffness); } +//************************************************************************** +// PropertyStiffnessDensity +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +TYPESYSTEM_SOURCE(App::PropertyStiffnessDensity, App::PropertyQuantity) + +PropertyStiffnessDensity::PropertyStiffnessDensity() +{ + setUnit(Base::Unit::StiffnessDensity); +} + //************************************************************************** // PropertyTemperature //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/src/App/PropertyUnits.h b/src/App/PropertyUnits.h index c10782ebe0..fc32e080b1 100644 --- a/src/App/PropertyUnits.h +++ b/src/App/PropertyUnits.h @@ -620,7 +620,7 @@ public: /** Stiffness property * This is a property for representing stiffness. It is basically a float - * property. On the Gui it has a quantity like m/s^2. + * property. On the Gui it has a quantity like N/m. */ class AppExport PropertyStiffness: public PropertyQuantity { @@ -631,8 +631,21 @@ public: ~PropertyStiffness() override = default; }; +/** StiffnessDensity property + * This is a property for representing stiffness per area unit. It is basically a float + * property. On the Gui it has a quantity like Pa/m. + */ +class AppExport PropertyStiffnessDensity: public PropertyQuantity +{ + TYPESYSTEM_HEADER_WITH_OVERRIDE(); + +public: + PropertyStiffnessDensity(); + ~PropertyStiffnessDensity() override = default; +}; + /** Stress property - * This is a property for representing . It is basically a float + * This is a property for representing stress. It is basically a float * property. On the Gui it has a quantity like Pa. */ class AppExport PropertyStress: public PropertyQuantity diff --git a/src/Base/Unit.cpp b/src/Base/Unit.cpp index 64cefecf85..7aa14c7526 100644 --- a/src/Base/Unit.cpp +++ b/src/Base/Unit.cpp @@ -575,6 +575,9 @@ QString Unit::getTypeString() const if (*this == Unit::Stiffness) { return QString::fromLatin1("Stiffness"); } + if (*this == Unit::StiffnessDensity) { + return QString::fromLatin1("StiffnessDensity"); + } if (*this == Unit::Stress) { return QString::fromLatin1("Stress"); } @@ -667,6 +670,7 @@ const Unit Unit::ShearModulus (-1,1,-2); const Unit Unit::SpecificEnergy (2, 0, -2); const Unit Unit::SpecificHeat (2, 0, -2, 0, -1); const Unit Unit::Stiffness (0, 1, -2); +const Unit Unit::StiffnessDensity (-2, 1, -2); const Unit Unit::Stress (-1,1,-2); const Unit Unit::ThermalConductivity (1, 1, -3, 0, -1); const Unit Unit::ThermalExpansionCoefficient(0, 0, 0, 0, -1); diff --git a/src/Base/Unit.h b/src/Base/Unit.h index 8b4a4aec70..77b325a784 100644 --- a/src/Base/Unit.h +++ b/src/Base/Unit.h @@ -150,6 +150,7 @@ public: static const Unit YoungsModulus; static const Unit Stiffness; + static const Unit StiffnessDensity; static const Unit Force; static const Unit Work; diff --git a/src/Base/UnitsSchemaInternal.cpp b/src/Base/UnitsSchemaInternal.cpp index c3d13cd38e..355e8307c7 100644 --- a/src/Base/UnitsSchemaInternal.cpp +++ b/src/Base/UnitsSchemaInternal.cpp @@ -223,7 +223,7 @@ UnitsSchemaInternal::schemaTranslate(const Quantity& quant, double& factor, QStr unitString = QString::fromLatin1("mN/m"); factor = 1e-3; } - if (UnitValue < 1e3) { + else if (UnitValue < 1e3) { unitString = QString::fromLatin1("N/m"); factor = 1.0; } @@ -236,6 +236,24 @@ UnitsSchemaInternal::schemaTranslate(const Quantity& quant, double& factor, QStr factor = 1e6; } } + else if ((unit == Unit::StiffnessDensity)) { + if (UnitValue < 1e-3) { + unitString = QString::fromLatin1("Pa/m"); + factor = 1e-6; + } + else if (UnitValue < 1) { + unitString = QString::fromLatin1("kPa/m"); + factor = 1e-3; + } + else if (UnitValue < 1e3) { + unitString = QString::fromLatin1("MPa/m"); + factor = 1.0; + } + else { + unitString = QString::fromLatin1("GPa/m"); + factor = 1e3; + } + } else if (unit == Unit::Force) { if (UnitValue < 1e3) { unitString = QString::fromLatin1("mN"); diff --git a/src/Base/UnitsSchemaMKS.cpp b/src/Base/UnitsSchemaMKS.cpp index e15a721ad3..aba27295ab 100644 --- a/src/Base/UnitsSchemaMKS.cpp +++ b/src/Base/UnitsSchemaMKS.cpp @@ -174,7 +174,7 @@ QString UnitsSchemaMKS::schemaTranslate(const Quantity& quant, double& factor, Q unitString = QString::fromLatin1("mN/m"); factor = 1e-3; } - if (UnitValue < 1e3) { + else if (UnitValue < 1e3) { unitString = QString::fromLatin1("N/m"); factor = 1.0; } @@ -187,6 +187,24 @@ QString UnitsSchemaMKS::schemaTranslate(const Quantity& quant, double& factor, Q factor = 1e6; } } + else if ((unit == Unit::StiffnessDensity)) { + if (UnitValue < 1e-3) { + unitString = QString::fromLatin1("Pa/m"); + factor = 1e-6; + } + else if (UnitValue < 1) { + unitString = QString::fromLatin1("kPa/m"); + factor = 1e-3; + } + else if (UnitValue < 1e3) { + unitString = QString::fromLatin1("MPa/m"); + factor = 1.0; + } + else { + unitString = QString::fromLatin1("GPa/m"); + factor = 1e3; + } + } else if (unit == Unit::ThermalConductivity) { if (UnitValue > 1000000) { unitString = QString::fromLatin1("W/mm/K"); diff --git a/src/Mod/Fem/App/FemConstraintContact.cpp b/src/Mod/Fem/App/FemConstraintContact.cpp index d49c67c262..f4d4fa5268 100644 --- a/src/Mod/Fem/App/FemConstraintContact.cpp +++ b/src/Mod/Fem/App/FemConstraintContact.cpp @@ -33,9 +33,31 @@ PROPERTY_SOURCE(Fem::ConstraintContact, Fem::Constraint) ConstraintContact::ConstraintContact() { /*Note: Initialise parameters here*/ - ADD_PROPERTY(Slope, (0.0)); - ADD_PROPERTY(Friction, (0.0)); - /* */ + ADD_PROPERTY_TYPE(Slope, + (0.0), + "ConstraintContact", + App::PropertyType(App::Prop_None), + "Contact stiffness"); + ADD_PROPERTY_TYPE(Adjust, + (0.0), + "ConstraintContact", + App::PropertyType(App::Prop_None), + "Node clearance adjustment limit"); + ADD_PROPERTY_TYPE(Friction, + (false), + "ConstraintContact", + App::PropertyType(App::Prop_None), + "Enable friction interaction"); + ADD_PROPERTY_TYPE(FrictionCoefficient, + (0.0), + "ConstraintContact", + App::PropertyType(App::Prop_None), + "Friction coefficient"); + ADD_PROPERTY_TYPE(StickSlope, + (0.0), + "ConstraintContact", + App::PropertyType(App::Prop_None), + "Stick slope"); ADD_PROPERTY_TYPE(Points, (Base::Vector3d()), @@ -47,6 +69,7 @@ ConstraintContact::ConstraintContact() "ConstraintContact", App::PropertyType(App::Prop_ReadOnly | App::Prop_Output), "Normals where symbols are drawn"); + /* */ Points.setValues(std::vector()); Normals.setValues(std::vector()); } @@ -77,3 +100,28 @@ void ConstraintContact::onChanged(const App::Property* prop) } } } + +void ConstraintContact::handleChangedPropertyType(Base::XMLReader& reader, + const char* typeName, + App::Property* prop) +{ + if (prop == &Slope && strcmp(typeName, "App::PropertyFloat") == 0) { + App::PropertyFloat oldSlope; + oldSlope.Restore(reader); + // old slope value stored as MPa/mm equivalent to 1e3 kg/(mm^2*s^2) + Slope.setValue(oldSlope.getValue() * 1000); + + // stick slope internally generated as slope/10 + StickSlope.setValue(Slope.getValue() / 10); + } + else if (prop == &Friction && strcmp(typeName, "App::PropertyFloat") == 0) { + App::PropertyFloat oldFriction; + oldFriction.Restore(reader); + FrictionCoefficient.setValue(oldFriction.getValue()); + + Friction.setValue(oldFriction.getValue() > 0 ? true : false); + } + else { + Constraint::handleChangedPropertyType(reader, typeName, prop); + } +} diff --git a/src/Mod/Fem/App/FemConstraintContact.h b/src/Mod/Fem/App/FemConstraintContact.h index 60c82cfbf9..68b17eef8b 100644 --- a/src/Mod/Fem/App/FemConstraintContact.h +++ b/src/Mod/Fem/App/FemConstraintContact.h @@ -50,8 +50,11 @@ public: * This is only the definitions of the variables ******/ // ex. - App::PropertyFloat Slope; - App::PropertyFloat Friction; + App::PropertyStiffnessDensity Slope; + App::PropertyLength Adjust; + App::PropertyBool Friction; + App::PropertyFloat FrictionCoefficient; + App::PropertyStiffnessDensity StickSlope; // etc /* */ @@ -64,6 +67,9 @@ public: protected: void onChanged(const App::Property* prop) override; + void handleChangedPropertyType(Base::XMLReader& reader, + const char* typeName, + App::Property* prop) override; }; } // namespace Fem diff --git a/src/Mod/Fem/Gui/Command.cpp b/src/Mod/Fem/Gui/Command.cpp index 82f82e1a3f..0f5f1d8d1c 100644 --- a/src/Mod/Fem/Gui/Command.cpp +++ b/src/Mod/Fem/Gui/Command.cpp @@ -250,10 +250,19 @@ void CmdFemConstraintContact::activated(int) "App.activeDocument().addObject(\"Fem::ConstraintContact\",\"%s\")", FeatName.c_str()); doCommand(Doc, - "App.activeDocument().%s.Slope = 1000000.00", + "App.activeDocument().%s.Slope = \"1e6 GPa/m\"", FeatName.c_str()); // OvG: set default not equal to 0 doCommand(Doc, - "App.activeDocument().%s.Friction = 0.0", + "App.activeDocument().%s.Adjust = 0.0", + FeatName.c_str()); // OvG: set default equal to 0 + doCommand(Doc, + "App.activeDocument().%s.Friction = False", + FeatName.c_str()); // OvG: set default equal to 0 + doCommand(Doc, + "App.activeDocument().%s.FrictionCoefficient = 0.0", + FeatName.c_str()); // OvG: set default equal to 0 + doCommand(Doc, + "App.activeDocument().%s.StickSlope = \"1e4 GPa/m\"", FeatName.c_str()); // OvG: set default not equal to 0 doCommand(Doc, "App.activeDocument().%s.Scale = 1", diff --git a/src/Mod/Fem/Gui/Resources/ui/ConstraintTie.ui b/src/Mod/Fem/Gui/Resources/ui/ConstraintTie.ui index 309fe91eca..c33c39b6eb 100644 --- a/src/Mod/Fem/Gui/Resources/ui/ConstraintTie.ui +++ b/src/Mod/Fem/Gui/Resources/ui/ConstraintTie.ui @@ -28,31 +28,13 @@ - - QFormLayout::AllNonFixedFieldsGrow - - - - - 0 - 0 - + + + mm - - - 80 - 20 - - - - Qt::LeftToRight - - - 0 mm - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + 0.000000000000000 1.000000000000000 @@ -60,9 +42,6 @@ 1000000000.000000000000000 - - mm - 2 @@ -74,7 +53,14 @@ - Tolerance: + Tolerance + + + + + + + Enable Adjust @@ -87,9 +73,9 @@ - Gui::InputField - QLineEdit -
Gui/InputField.h
+ Gui::QuantitySpinBox + QWidget +
Gui/QuantitySpinBox.h
diff --git a/src/Mod/Fem/Gui/TaskFemConstraintContact.cpp b/src/Mod/Fem/Gui/TaskFemConstraintContact.cpp index cc15da6dbb..d515c44438 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintContact.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintContact.cpp @@ -91,14 +91,36 @@ TaskFemConstraintContact::TaskFemConstraintContact(ViewProviderFemConstraintCont std::vector Objects = pcConstraint->References.getValues(); std::vector SubElements = pcConstraint->References.getSubValues(); - double slope = pcConstraint->Slope.getValue(); - double friction = pcConstraint->Friction.getValue(); + + bool friction = pcConstraint->Friction.getValue(); // Fill data into dialog elements - ui->spSlope->setMinimum(1.0); - ui->spSlope->setValue(slope); - ui->spFriction->setValue(friction); + ui->spbSlope->setUnit(pcConstraint->Slope.getUnit()); + ui->spbSlope->setMinimum(0); + ui->spbSlope->setMaximum(FLOAT_MAX); + ui->spbSlope->setValue(pcConstraint->Slope.getQuantityValue()); + ui->spbSlope->bind(pcConstraint->Slope); + ui->spbAdjust->setUnit(pcConstraint->Adjust.getUnit()); + ui->spbAdjust->setMinimum(0); + ui->spbAdjust->setMaximum(FLOAT_MAX); + ui->spbAdjust->setValue(pcConstraint->Adjust.getQuantityValue()); + ui->spbAdjust->bind(pcConstraint->Adjust); + + ui->ckbFriction->setChecked(friction); + + ui->spbFrictionCoeff->setMinimum(0); + ui->spbFrictionCoeff->setMaximum(FLOAT_MAX); + ui->spbFrictionCoeff->setValue(pcConstraint->FrictionCoefficient.getValue()); + ui->spbFrictionCoeff->setEnabled(friction); + ui->spbFrictionCoeff->bind(pcConstraint->FrictionCoefficient); + + ui->spbStickSlope->setUnit(pcConstraint->StickSlope.getUnit()); + ui->spbStickSlope->setMinimum(0); + ui->spbStickSlope->setMaximum(FLOAT_MAX); + ui->spbStickSlope->setValue(pcConstraint->StickSlope.getQuantityValue()); + ui->spbStickSlope->setEnabled(friction); + ui->spbStickSlope->bind(pcConstraint->StickSlope); /* */ ui->lw_referencesMaster->clear(); @@ -136,6 +158,11 @@ TaskFemConstraintContact::TaskFemConstraintContact(ViewProviderFemConstraintCont this, &TaskFemConstraintContact::removeFromSelectionMaster); + connect(ui->ckbFriction, + &QCheckBox::toggled, + this, + &TaskFemConstraintContact::onFrictionChanged); + updateUI(); } @@ -428,6 +455,12 @@ void TaskFemConstraintContact::onReferenceDeletedMaster() TaskFemConstraintContact::removeFromSelectionMaster(); } +void TaskFemConstraintContact::onFrictionChanged(bool state) +{ + ui->spbFrictionCoeff->setEnabled(state); + ui->spbStickSlope->setEnabled(state); +} + const std::string TaskFemConstraintContact::getReferences() const { int rowsSlave = ui->lw_referencesSlave->model()->rowCount(); @@ -443,15 +476,29 @@ const std::string TaskFemConstraintContact::getReferences() const return TaskFemConstraint::getReferences(items); } -/* Note: */ -double TaskFemConstraintContact::get_Slope() const +const std::string TaskFemConstraintContact::getSlope() const { - return ui->spSlope->rawValue(); + return ui->spbSlope->value().getSafeUserString().toStdString(); } -double TaskFemConstraintContact::get_Friction() const +const std::string TaskFemConstraintContact::getAdjust() const { - return ui->spFriction->value(); + return ui->spbAdjust->value().getSafeUserString().toStdString(); +} + +bool TaskFemConstraintContact::getFriction() const +{ + return ui->ckbFriction->isChecked(); +} + +double TaskFemConstraintContact::getFrictionCoeff() const +{ + return ui->spbFrictionCoeff->value(); +} + +const std::string TaskFemConstraintContact::getStickSlope() const +{ + return ui->spbStickSlope->value().getSafeUserString().toStdString(); } void TaskFemConstraintContact::changeEvent(QEvent*) @@ -478,7 +525,7 @@ void TaskDlgFemConstraintContact::open() // a transaction is already open at creation time of the panel if (!Gui::Command::hasPendingCommand()) { QString msg = QObject::tr("Contact constraint"); - Gui::Command::openCommand((const char*)msg.toUtf8()); + Gui::Command::openCommand(static_cast(msg.toUtf8())); ConstraintView->setVisible(true); Gui::Command::runCommand( Gui::Command::Doc, @@ -497,13 +544,25 @@ bool TaskDlgFemConstraintContact::accept() try { Gui::Command::doCommand(Gui::Command::Doc, - "App.ActiveDocument.%s.Slope = %f", + "App.ActiveDocument.%s.Slope = \"%s\"", name.c_str(), - parameterContact->get_Slope()); + parameterContact->getSlope().c_str()); Gui::Command::doCommand(Gui::Command::Doc, - "App.ActiveDocument.%s.Friction = %f", + "App.ActiveDocument.%s.Adjust = \"%s\"", name.c_str(), - parameterContact->get_Friction()); + parameterContact->getAdjust().c_str()); + Gui::Command::doCommand(Gui::Command::Doc, + "App.ActiveDocument.%s.Friction = %s", + name.c_str(), + parameterContact->getFriction() ? "True" : "False"); + Gui::Command::doCommand(Gui::Command::Doc, + "App.ActiveDocument.%s.FrictionCoefficient = %f", + name.c_str(), + parameterContact->getFrictionCoeff()); + Gui::Command::doCommand(Gui::Command::Doc, + "App.ActiveDocument.%s.StickSlope = \"%s\"", + name.c_str(), + parameterContact->getStickSlope().c_str()); std::string scale = parameterContact->getScale(); // OvG: determine modified scale Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.Scale = %s", diff --git a/src/Mod/Fem/Gui/TaskFemConstraintContact.h b/src/Mod/Fem/Gui/TaskFemConstraintContact.h index cc7891a667..b5f78a6ec2 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintContact.h +++ b/src/Mod/Fem/Gui/TaskFemConstraintContact.h @@ -46,8 +46,11 @@ public: QWidget* parent = nullptr); ~TaskFemConstraintContact() override; const std::string getReferences() const override; - double get_Slope() const; - double get_Friction() const; + const std::string getAdjust() const; + const std::string getSlope() const; + bool getFriction() const; + const std::string getStickSlope() const; + double getFrictionCoeff() const; private Q_SLOTS: void onReferenceDeletedSlave(); @@ -56,12 +59,12 @@ private Q_SLOTS: void removeFromSelectionSlave(); void addToSelectionMaster(); void removeFromSelectionMaster(); + void onFrictionChanged(bool); protected: void changeEvent(QEvent* e) override; private: - // void onSelectionChanged(const Gui::SelectionChanges& msg); void updateUI(); std::unique_ptr ui; }; diff --git a/src/Mod/Fem/Gui/TaskFemConstraintContact.ui b/src/Mod/Fem/Gui/TaskFemConstraintContact.ui index 0d86b655fe..3fca07dde2 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintContact.ui +++ b/src/Mod/Fem/Gui/TaskFemConstraintContact.ui @@ -135,56 +135,123 @@
+ - - - - - Contact Stiffness - - - - - - - 1.000000000000000 - - - 1000000000.000000000000000 - - - Pa - - - 1000000.000000000000000 - - - - - - - - - - - Friction coefficient - - - - - - - 2 - - - 1.000000000000000 - - - 0.100000000000000 - - - - + + + + 0 + 0 + + + + + + + Parameters + + + + + + Contact Stiffness + + + + + + + 1.000000000000000 + + + 1000000000.000000000000000 + + + GPa/m + + + 100.000000000000000 + + + + + + + Clearance Adjustment + + + + + + + 0.000000000000000 + + + mm + + + 0.000000000000000 + + + 0.100000000000000 + + + + + + + Enable Friction + + + + + + + Friction Coefficient + + + + + + + 2 + + + 0.000000000000000 + + + 0.000000000000000 + + + 0.100000000000000 + + + + + + + Stick Slope + + + + + + + 1.000000000000000 + + + 1000000000.000000000000000 + + + GPa/m + + + 1.000000000000000 + + + + +
lbl_info_2 @@ -194,9 +261,14 @@ - Gui::InputField - QLineEdit -
Gui/InputField.h
+ Gui::QuantitySpinBox + QWidget +
Gui/QuantitySpinBox.h
+
+ + Gui::DoubleSpinBox + QWidget +
Gui/SpinBox.h
diff --git a/src/Mod/Fem/femexamples/constraint_contact_shell_shell.py b/src/Mod/Fem/femexamples/constraint_contact_shell_shell.py index 3e6464a041..2d2b42af80 100644 --- a/src/Mod/Fem/femexamples/constraint_contact_shell_shell.py +++ b/src/Mod/Fem/femexamples/constraint_contact_shell_shell.py @@ -193,9 +193,8 @@ def setup(doc=None, solvertype="ccxtools"): (lower_tube, "Face1"), (upper_tube, "Face1"), ] - con_contact.Friction = 0.0 - # con_contact.Slope = "1000000.0 kg/(mm*s^2)" # contact stiffness - con_contact.Slope = 1000000.0 # should be 1000000.0 kg/(mm*s^2) + con_contact.Friction = False + con_contact.Slope = "1000000.0 GPa/m" analysis.addObject(con_contact) # mesh diff --git a/src/Mod/Fem/femexamples/constraint_contact_solid_solid.py b/src/Mod/Fem/femexamples/constraint_contact_solid_solid.py index c3efe9b189..d2392d1d2a 100644 --- a/src/Mod/Fem/femexamples/constraint_contact_solid_solid.py +++ b/src/Mod/Fem/femexamples/constraint_contact_solid_solid.py @@ -177,8 +177,8 @@ def setup(doc=None, solvertype="ccxtools"): (geom_obj, "Face7"), # first seams slave face, TODO proof in writer code! (geom_obj, "Face3"), # second seams master face, TODO proof in writer code! ] - con_contact.Friction = 0.0 - con_contact.Slope = 1000000.0 # contact stiffness 1000000.0 kg/(mm*s^2) + con_contact.Friction = False + con_contact.Slope = "1000000.0 GPa/m" analysis.addObject(con_contact) # mesh diff --git a/src/Mod/Fem/femobjects/constraint_tie.py b/src/Mod/Fem/femobjects/constraint_tie.py index ad36031163..c983656706 100644 --- a/src/Mod/Fem/femobjects/constraint_tie.py +++ b/src/Mod/Fem/femobjects/constraint_tie.py @@ -46,5 +46,14 @@ class ConstraintTie(base_fempythonobject.BaseFemPythonObject): "App::PropertyLength", "Tolerance", "Geometry", - "set max gap between tied faces" + "Set max gap between tied faces" ) + obj.Tolerance = "0.0 mm" + + obj.addProperty( + "App::PropertyBool", + "Adjust", + "Geometry", + "Adjust connected nodes" + ) + obj.Adjust = False diff --git a/src/Mod/Fem/femsolver/calculix/write_constraint_contact.py b/src/Mod/Fem/femsolver/calculix/write_constraint_contact.py index c8527975f6..a9c0bcc9dd 100644 --- a/src/Mod/Fem/femsolver/calculix/write_constraint_contact.py +++ b/src/Mod/Fem/femsolver/calculix/write_constraint_contact.py @@ -68,20 +68,24 @@ def write_meshdata_constraint(f, femobj, contact_obj, ccxwriter): def write_constraint(f, femobj, contact_obj, ccxwriter): # floats read from ccx should use {:.13G}, see comment in writer module + adjust = "" + if contact_obj.Adjust.Value > 0: + adjust = ", ADJUST={:.13G}".format( + contact_obj.Adjust.getValueAs("mm").Value) f.write( - "*CONTACT PAIR, INTERACTION=INT{},TYPE=SURFACE TO SURFACE\n" - .format(contact_obj.Name) + "*CONTACT PAIR, INTERACTION=INT{}, TYPE=SURFACE TO SURFACE{}\n" + .format(contact_obj.Name, adjust) ) ind_surf = "IND" + contact_obj.Name dep_surf = "DEP" + contact_obj.Name - f.write("{},{}\n".format(dep_surf, ind_surf)) + f.write("{}, {}\n".format(dep_surf, ind_surf)) f.write("*SURFACE INTERACTION, NAME=INT{}\n".format(contact_obj.Name)) - f.write("*SURFACE BEHAVIOR,PRESSURE-OVERCLOSURE=LINEAR\n") - slope = contact_obj.Slope + f.write("*SURFACE BEHAVIOR, PRESSURE-OVERCLOSURE=LINEAR\n") + slope = contact_obj.Slope.getValueAs("MPa/mm").Value f.write("{:.13G}\n".format(slope)) - friction = contact_obj.Friction - if friction > 0: - f.write("*FRICTION \n") - stick = (slope / 10.0) + if contact_obj.Friction: + f.write("*FRICTION\n") + friction = contact_obj.FrictionCoefficient + stick = contact_obj.StickSlope.getValueAs("MPa/mm").Value f.write("{:.13G}, {:.13G}\n".format(friction, stick)) diff --git a/src/Mod/Fem/femsolver/calculix/write_constraint_tie.py b/src/Mod/Fem/femsolver/calculix/write_constraint_tie.py index 8817fa9954..c75ab90be3 100644 --- a/src/Mod/Fem/femsolver/calculix/write_constraint_tie.py +++ b/src/Mod/Fem/femsolver/calculix/write_constraint_tie.py @@ -70,10 +70,13 @@ def write_constraint(f, femobj, tie_obj, ccxwriter): # floats read from ccx should use {:.13G}, see comment in writer module tolerance = tie_obj.Tolerance.getValueAs("mm").Value + adjust = "" + if not tie_obj.Adjust: + adjust = ", ADJUST=NO" f.write( - "*TIE, POSITION TOLERANCE={:.13G}, ADJUST=NO, NAME=TIE{}\n" - .format(tolerance, tie_obj.Name) + "*TIE, POSITION TOLERANCE={:.13G}{}, NAME=TIE{}\n" + .format(tolerance, adjust, tie_obj.Name) ) ind_surf = "TIE_IND{}".format(tie_obj.Name) dep_surf = "TIE_DEP{}".format(tie_obj.Name) - f.write("{},{}\n".format(dep_surf, ind_surf)) + f.write("{}, {}\n".format(dep_surf, ind_surf)) diff --git a/src/Mod/Fem/femtaskpanels/task_constraint_tie.py b/src/Mod/Fem/femtaskpanels/task_constraint_tie.py index 05b1369c13..f2e97ede3f 100644 --- a/src/Mod/Fem/femtaskpanels/task_constraint_tie.py +++ b/src/Mod/Fem/femtaskpanels/task_constraint_tie.py @@ -52,10 +52,15 @@ class _TaskPanel: FreeCAD.getHomePath() + "Mod/Fem/Resources/ui/ConstraintTie.ui" ) QtCore.QObject.connect( - self.parameterWidget.if_tolerance, + self.parameterWidget.spb_tolerance, QtCore.SIGNAL("valueChanged(Base::Quantity)"), self.tolerance_changed ) + QtCore.QObject.connect( + self.parameterWidget.ckb_adjust, + QtCore.SIGNAL("toggled(bool)"), + self.adjust_changed + ) self.init_parameter_widget() # geometry selection widget @@ -67,7 +72,7 @@ class _TaskPanel: ) # form made from param and selection widget - self.form = [self.parameterWidget, self.selectionWidget] + self.form = [self.selectionWidget, self.parameterWidget] def accept(self): # check values @@ -94,6 +99,7 @@ class _TaskPanel: elif msgBox.clickedButton() == ignoreButton: pass self.obj.Tolerance = self.tolerance + self.obj.Adjust = self.adjust self.obj.References = self.selectionWidget.references self.recompute_and_set_back_all() return True @@ -112,7 +118,12 @@ class _TaskPanel: def init_parameter_widget(self): self.tolerance = self.obj.Tolerance - self.parameterWidget.if_tolerance.setText(self.tolerance.UserString) + self.adjust = self.obj.Adjust + self.parameterWidget.spb_tolerance.setProperty("value", self.tolerance) + self.parameterWidget.ckb_adjust.setChecked(self.adjust) def tolerance_changed(self, base_quantity_value): self.tolerance = base_quantity_value + + def adjust_changed(self, bool_value): + self.adjust = bool_value diff --git a/src/Mod/Fem/femtest/data/calculix/constraint_contact_shell_shell.inp b/src/Mod/Fem/femtest/data/calculix/constraint_contact_shell_shell.inp index 437d5c7feb..4f696b5b7d 100644 --- a/src/Mod/Fem/femtest/data/calculix/constraint_contact_shell_shell.inp +++ b/src/Mod/Fem/femtest/data/calculix/constraint_contact_shell_shell.inp @@ -38365,10 +38365,10 @@ Efaces *********************************************************** ** Contact Constraints ** ConstraintContact -*CONTACT PAIR, INTERACTION=INTConstraintContact,TYPE=SURFACE TO SURFACE -DEPConstraintContact,INDConstraintContact +*CONTACT PAIR, INTERACTION=INTConstraintContact, TYPE=SURFACE TO SURFACE +DEPConstraintContact, INDConstraintContact *SURFACE INTERACTION, NAME=INTConstraintContact -*SURFACE BEHAVIOR,PRESSURE-OVERCLOSURE=LINEAR +*SURFACE BEHAVIOR, PRESSURE-OVERCLOSURE=LINEAR 1000000 *********************************************************** diff --git a/src/Mod/Fem/femtest/data/calculix/constraint_contact_solid_solid.inp b/src/Mod/Fem/femtest/data/calculix/constraint_contact_solid_solid.inp index 883a37b530..5d315d93ad 100644 --- a/src/Mod/Fem/femtest/data/calculix/constraint_contact_solid_solid.inp +++ b/src/Mod/Fem/femtest/data/calculix/constraint_contact_solid_solid.inp @@ -5572,10 +5572,10 @@ Evolumes *********************************************************** ** Contact Constraints ** ConstraintContact -*CONTACT PAIR, INTERACTION=INTConstraintContact,TYPE=SURFACE TO SURFACE +*CONTACT PAIR, INTERACTION=INTConstraintContact, TYPE=SURFACE TO SURFACE DEPConstraintContact,INDConstraintContact *SURFACE INTERACTION, NAME=INTConstraintContact -*SURFACE BEHAVIOR,PRESSURE-OVERCLOSURE=LINEAR +*SURFACE BEHAVIOR, PRESSURE-OVERCLOSURE=LINEAR 1000000 *********************************************************** diff --git a/src/Mod/Fem/femtest/data/calculix/constraint_tie.inp b/src/Mod/Fem/femtest/data/calculix/constraint_tie.inp index d028a0ba94..a201c5415f 100644 --- a/src/Mod/Fem/femtest/data/calculix/constraint_tie.inp +++ b/src/Mod/Fem/femtest/data/calculix/constraint_tie.inp @@ -18608,7 +18608,7 @@ Evolumes ** Tie Constraints ** ConstraintTie *TIE, POSITION TOLERANCE=25, ADJUST=NO, NAME=TIEConstraintTie -TIE_DEPConstraintTie,TIE_INDConstraintTie +TIE_DEPConstraintTie, TIE_INDConstraintTie *********************************************************** ** At least one step is needed to run an CalculiX analysis of FreeCAD