From fc5d57035f6b14cebef78ffceb6e8d82d3da0165 Mon Sep 17 00:00:00 2001 From: marioalexis Date: Fri, 19 Jul 2024 15:29:26 -0300 Subject: [PATCH] Fem: Remove redundant *Fix properties in constraint displacement - fixes #14556 --- src/Mod/Fem/App/FemConstraintDisplacement.cpp | 120 +++++++++--- src/Mod/Fem/App/FemConstraintDisplacement.h | 6 - .../Fem/Gui/TaskFemConstraintDisplacement.cpp | 178 +++--------------- .../Fem/Gui/TaskFemConstraintDisplacement.h | 12 -- .../Fem/Gui/TaskFemConstraintDisplacement.ui | 54 +----- .../ccx_cantilever_prescribeddisplacement.py | 1 - .../constraint_transform_beam_hinged.py | 2 +- .../Fem/femexamples/frequency_beamsimple.py | 6 - .../calculix/write_constraint_displacement.py | 24 +-- .../constraint_transform_beam_hinged.inp | 2 +- .../data/calculix/frequency_beamsimple.inp | 10 +- 11 files changed, 137 insertions(+), 278 deletions(-) diff --git a/src/Mod/Fem/App/FemConstraintDisplacement.cpp b/src/Mod/Fem/App/FemConstraintDisplacement.cpp index 7f8c3d7f85..c313d5c57a 100644 --- a/src/Mod/Fem/App/FemConstraintDisplacement.cpp +++ b/src/Mod/Fem/App/FemConstraintDisplacement.cpp @@ -41,43 +41,113 @@ ConstraintDisplacement::ConstraintDisplacement() // Displacement or Rotation not 0.0, prescribed displacement, Free and Fix should be False // x displacement - ADD_PROPERTY(xFix, (false)); - ADD_PROPERTY(xFree, (1)); - ADD_PROPERTY(xDisplacement, (0.0)); - ADD_PROPERTY(hasXFormula, (false)); - ADD_PROPERTY(xDisplacementFormula, ("")); + ADD_PROPERTY_TYPE(xFree, + (true), + "ConstraintDisplacement", + App::Prop_None, + "Use free translation in X direction"); + ADD_PROPERTY_TYPE(xDisplacement, + (0.0), + "ConstraintDisplacement", + App::Prop_None, + "Translation in local X direction"); + ADD_PROPERTY_TYPE(hasXFormula, + (false), + "ConstraintDisplacement", + App::Prop_None, + "Define translation in X direction as a formula"); + ADD_PROPERTY_TYPE(xDisplacementFormula, + (""), + "ConstraintDisplacement", + App::Prop_None, + "Formula for translation in X direction"); // y displacement - ADD_PROPERTY(yFix, (false)); - ADD_PROPERTY(yFree, (true)); - ADD_PROPERTY(yDisplacement, (0.0)); - ADD_PROPERTY(hasYFormula, (false)); - ADD_PROPERTY(yDisplacementFormula, ("")); + ADD_PROPERTY_TYPE(yFree, + (true), + "ConstraintDisplacement", + App::Prop_None, + "Use free translation in Y direction"); + ADD_PROPERTY_TYPE(yDisplacement, + (0.0), + "ConstraintDisplacement", + App::Prop_None, + "Translation in local Y direction"); + ADD_PROPERTY_TYPE(hasYFormula, + (false), + "ConstraintDisplacement", + App::Prop_None, + "Define translation in Y direction as a formula"); + ADD_PROPERTY_TYPE(yDisplacementFormula, + (""), + "ConstraintDisplacement", + App::Prop_None, + "Formula for translation in Y direction"); // z displacement - ADD_PROPERTY(zFix, (false)); - ADD_PROPERTY(zFree, (true)); - ADD_PROPERTY(zDisplacement, (0.0)); - ADD_PROPERTY(hasZFormula, (false)); - ADD_PROPERTY(zDisplacementFormula, ("")); + ADD_PROPERTY_TYPE(zFree, + (true), + "ConstraintDisplacement", + App::Prop_None, + "Use free translation in Z direction"); + ADD_PROPERTY_TYPE(zDisplacement, + (0.0), + "ConstraintDisplacement", + App::Prop_None, + "Translation in local Z direction"); + ADD_PROPERTY_TYPE(hasZFormula, + (false), + "ConstraintDisplacement", + App::Prop_None, + "Define translation in Z direction as a formula"); + ADD_PROPERTY_TYPE(zDisplacementFormula, + (""), + "ConstraintDisplacement", + App::Prop_None, + "Formula for translation in Z direction"); // flow surface force - ADD_PROPERTY(useFlowSurfaceForce, (false)); + ADD_PROPERTY_TYPE(useFlowSurfaceForce, + (false), + "ConstraintDisplacement", + App::Prop_None, + "Use flow surface force"); // x rotation - ADD_PROPERTY(rotxFix, (false)); - ADD_PROPERTY(rotxFree, (true)); - ADD_PROPERTY(xRotation, (0.0)); + ADD_PROPERTY_TYPE(rotxFree, + (true), + "ConstraintDisplacement", + App::Prop_None, + "Use free rotation in X direction"); + ADD_PROPERTY_TYPE(xRotation, + (0.0), + "ConstraintDisplacement", + App::Prop_None, + "Rotation in local X direction"); // y rotation - ADD_PROPERTY(rotyFix, (false)); - ADD_PROPERTY(rotyFree, (true)); - ADD_PROPERTY(yRotation, (0.0)); + ADD_PROPERTY_TYPE(rotyFree, + (true), + "ConstraintDisplacement", + App::Prop_None, + "Use free rotation in Y direction"); + ADD_PROPERTY_TYPE(yRotation, + (0.0), + "ConstraintDisplacement", + App::Prop_None, + "Rotation in local Y direction"); // z rotation - ADD_PROPERTY(rotzFix, (false)); - ADD_PROPERTY(rotzFree, (true)); - ADD_PROPERTY(zRotation, (0.0)); + ADD_PROPERTY_TYPE(rotzFree, + (true), + "ConstraintDisplacement", + App::Prop_None, + "Use free rotation in Z direction"); + ADD_PROPERTY_TYPE(zRotation, + (0.0), + "ConstraintDisplacement", + App::Prop_None, + "Rotation in local Z direction"); } App::DocumentObjectExecReturn* ConstraintDisplacement::execute() diff --git a/src/Mod/Fem/App/FemConstraintDisplacement.h b/src/Mod/Fem/App/FemConstraintDisplacement.h index ef480b1f59..f2debea70e 100644 --- a/src/Mod/Fem/App/FemConstraintDisplacement.h +++ b/src/Mod/Fem/App/FemConstraintDisplacement.h @@ -53,15 +53,9 @@ public: App::PropertyBool xFree; App::PropertyBool yFree; App::PropertyBool zFree; - App::PropertyBool xFix; - App::PropertyBool yFix; - App::PropertyBool zFix; App::PropertyBool rotxFree; App::PropertyBool rotyFree; App::PropertyBool rotzFree; - App::PropertyBool rotxFix; - App::PropertyBool rotyFix; - App::PropertyBool rotzFix; App::PropertyBool hasXFormula; App::PropertyBool hasYFormula; App::PropertyBool hasZFormula; diff --git a/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.cpp b/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.cpp index 2801938614..0ccf30f814 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.cpp @@ -92,7 +92,7 @@ TaskFemConstraintDisplacement::TaskFemConstraintDisplacement( static_cast(ConstraintView->getObject()); Base::Quantity fStates[6] {}; const char* sStates[3] {}; - bool bStates[16] {}; + bool bStates[10] {}; fStates[0] = pcConstraint->xDisplacement.getQuantityValue(); fStates[1] = pcConstraint->yDisplacement.getQuantityValue(); fStates[2] = pcConstraint->zDisplacement.getQuantityValue(); @@ -102,22 +102,16 @@ TaskFemConstraintDisplacement::TaskFemConstraintDisplacement( sStates[0] = pcConstraint->xDisplacementFormula.getValue(); sStates[1] = pcConstraint->yDisplacementFormula.getValue(); sStates[2] = pcConstraint->zDisplacementFormula.getValue(); - bStates[0] = pcConstraint->xFix.getValue(); - bStates[1] = pcConstraint->xFree.getValue(); - bStates[2] = pcConstraint->yFix.getValue(); - bStates[3] = pcConstraint->yFree.getValue(); - bStates[4] = pcConstraint->zFix.getValue(); - bStates[5] = pcConstraint->zFree.getValue(); - bStates[6] = pcConstraint->rotxFix.getValue(); - bStates[7] = pcConstraint->rotxFree.getValue(); - bStates[8] = pcConstraint->rotyFix.getValue(); - bStates[9] = pcConstraint->rotyFree.getValue(); - bStates[10] = pcConstraint->rotzFix.getValue(); - bStates[11] = pcConstraint->rotzFree.getValue(); - bStates[12] = pcConstraint->hasXFormula.getValue(); - bStates[13] = pcConstraint->hasYFormula.getValue(); - bStates[14] = pcConstraint->hasZFormula.getValue(); - bStates[15] = pcConstraint->useFlowSurfaceForce.getValue(); + bStates[0] = pcConstraint->xFree.getValue(); + bStates[1] = pcConstraint->yFree.getValue(); + bStates[2] = pcConstraint->zFree.getValue(); + bStates[3] = pcConstraint->rotxFree.getValue(); + bStates[4] = pcConstraint->rotyFree.getValue(); + bStates[5] = pcConstraint->rotzFree.getValue(); + bStates[6] = pcConstraint->hasXFormula.getValue(); + bStates[7] = pcConstraint->hasYFormula.getValue(); + bStates[8] = pcConstraint->hasZFormula.getValue(); + bStates[9] = pcConstraint->useFlowSurfaceForce.getValue(); std::vector Objects = pcConstraint->References.getValues(); std::vector SubElements = pcConstraint->References.getSubValues(); @@ -131,26 +125,20 @@ TaskFemConstraintDisplacement::TaskFemConstraintDisplacement( } // Connect check box values displacements - connect(ui->dispxfix, &QCheckBox::toggled, this, &TaskFemConstraintDisplacement::fixx); connect(ui->DisplacementXFormulaCB, &QCheckBox::toggled, this, &TaskFemConstraintDisplacement::formulaX); - connect(ui->dispyfix, &QCheckBox::toggled, this, &TaskFemConstraintDisplacement::fixy); connect(ui->DisplacementYFormulaCB, &QCheckBox::toggled, this, &TaskFemConstraintDisplacement::formulaY); - connect(ui->dispzfix, &QCheckBox::toggled, this, &TaskFemConstraintDisplacement::fixz); connect(ui->DisplacementZFormulaCB, &QCheckBox::toggled, this, &TaskFemConstraintDisplacement::formulaZ); connect(ui->FlowForceCB, &QCheckBox::toggled, this, &TaskFemConstraintDisplacement::flowForce); // Connect to check box values for rotations - connect(ui->rotxfix, &QCheckBox::toggled, this, &TaskFemConstraintDisplacement::rotfixx); - connect(ui->rotyfix, &QCheckBox::toggled, this, &TaskFemConstraintDisplacement::rotfixy); - connect(ui->rotzfix, &QCheckBox::toggled, this, &TaskFemConstraintDisplacement::rotfixz); // Fill data into dialog elements ui->spinxDisplacement->setValue(fStates[0]); @@ -162,26 +150,20 @@ TaskFemConstraintDisplacement::TaskFemConstraintDisplacement( ui->DisplacementXFormulaLE->setText(QString::fromUtf8(sStates[0])); ui->DisplacementYFormulaLE->setText(QString::fromUtf8(sStates[1])); ui->DisplacementZFormulaLE->setText(QString::fromUtf8(sStates[2])); - ui->dispxfix->setChecked(bStates[0]); - ui->DisplacementXGB->setChecked(!bStates[1]); - ui->dispyfix->setChecked(bStates[2]); - ui->DisplacementYGB->setChecked(!bStates[3]); - ui->dispzfix->setChecked(bStates[4]); - ui->DisplacementZGB->setChecked(!bStates[5]); - ui->rotxfix->setChecked(bStates[6]); - ui->RotationXGB->setChecked(!bStates[7]); - ui->rotyfix->setChecked(bStates[8]); - ui->RotationYGB->setChecked(!bStates[9]); - ui->rotzfix->setChecked(bStates[10]); - ui->RotationZGB->setChecked(!bStates[11]); - ui->DisplacementXFormulaCB->setChecked(bStates[12]); - ui->DisplacementYFormulaCB->setChecked(bStates[13]); - ui->DisplacementZFormulaCB->setChecked(bStates[14]); - ui->FlowForceCB->setChecked(bStates[15]); + ui->DisplacementXGB->setChecked(!bStates[0]); + ui->DisplacementYGB->setChecked(!bStates[1]); + ui->DisplacementZGB->setChecked(!bStates[2]); + ui->RotationXGB->setChecked(!bStates[3]); + ui->RotationYGB->setChecked(!bStates[4]); + ui->RotationZGB->setChecked(!bStates[5]); + ui->DisplacementXFormulaCB->setChecked(bStates[6]); + ui->DisplacementYFormulaCB->setChecked(bStates[7]); + ui->DisplacementZFormulaCB->setChecked(bStates[8]); + ui->FlowForceCB->setChecked(bStates[9]); // Selection buttons - buttonGroup->addButton(ui->btnAdd, (int)SelectionChangeModes::refAdd); - buttonGroup->addButton(ui->btnRemove, (int)SelectionChangeModes::refRemove); + buttonGroup->addButton(ui->btnAdd, static_cast(SelectionChangeModes::refAdd)); + buttonGroup->addButton(ui->btnRemove, static_cast(SelectionChangeModes::refRemove)); // Bind input fields to properties ui->spinxDisplacement->bind(pcConstraint->xDisplacement); @@ -205,54 +187,21 @@ void TaskFemConstraintDisplacement::updateUI() } } -void TaskFemConstraintDisplacement::fixx(bool state) -{ - if (state) { - ui->spinxDisplacement->setValue(0); - ui->DisplacementXFormulaCB->setChecked(!state); - } - ui->spinxDisplacement->setEnabled(!state); - ui->DisplacementXFormulaCB->setEnabled(!state); -} - void TaskFemConstraintDisplacement::formulaX(bool state) { ui->spinxDisplacement->setEnabled(!state); - ui->dispxfix->setEnabled(!state); ui->DisplacementXFormulaLE->setEnabled(state); } -void TaskFemConstraintDisplacement::fixy(bool state) -{ - if (state) { - ui->spinyDisplacement->setValue(0); - ui->DisplacementYFormulaCB->setChecked(!state); - } - ui->spinyDisplacement->setEnabled(!state); - ui->DisplacementYFormulaCB->setEnabled(!state); -} - void TaskFemConstraintDisplacement::formulaY(bool state) { ui->spinyDisplacement->setEnabled(!state); - ui->dispyfix->setEnabled(!state); ui->DisplacementYFormulaLE->setEnabled(state); } -void TaskFemConstraintDisplacement::fixz(bool state) -{ - if (state) { - ui->spinzDisplacement->setValue(0); - ui->DisplacementZFormulaCB->setChecked(!state); - } - ui->spinzDisplacement->setEnabled(!state); - ui->DisplacementZFormulaCB->setEnabled(!state); -} - void TaskFemConstraintDisplacement::formulaZ(bool state) { ui->spinzDisplacement->setEnabled(!state); - ui->dispzfix->setEnabled(!state); ui->DisplacementZFormulaLE->setEnabled(state); } @@ -268,46 +217,19 @@ void TaskFemConstraintDisplacement::flowForce(bool state) } } -void TaskFemConstraintDisplacement::rotfixx(bool state) -{ - if (state) { - ui->spinxRotation->setValue(0); - } - ui->spinxRotation->setEnabled(!state); -} - void TaskFemConstraintDisplacement::formulaRotx(bool state) { ui->spinxRotation->setEnabled(!state); - ui->rotxfix->setEnabled(!state); -} - -void TaskFemConstraintDisplacement::rotfixy(bool state) -{ - if (state) { - ui->spinyRotation->setValue(0); - } - ui->spinyRotation->setEnabled(!state); } void TaskFemConstraintDisplacement::formulaRoty(bool state) { ui->spinyRotation->setEnabled(!state); - ui->rotyfix->setEnabled(!state); -} - -void TaskFemConstraintDisplacement::rotfixz(bool state) -{ - if (state) { - ui->spinzRotation->setValue(0); - } - ui->spinzRotation->setEnabled(!state); } void TaskFemConstraintDisplacement::formulaRotz(bool state) { ui->spinzRotation->setEnabled(!state); - ui->rotzfix->setEnabled(!state); } void TaskFemConstraintDisplacement::addToSelection() @@ -505,11 +427,6 @@ std::string TaskFemConstraintDisplacement::get_zFormula() const return zFormula.toStdString(); } -bool TaskFemConstraintDisplacement::get_dispxfix() const -{ - return ui->dispxfix->isChecked(); -} - bool TaskFemConstraintDisplacement::get_dispxfree() const { return !ui->DisplacementXGB->isChecked(); @@ -520,11 +437,6 @@ bool TaskFemConstraintDisplacement::get_hasDispXFormula() const return ui->DisplacementXFormulaCB->isChecked(); } -bool TaskFemConstraintDisplacement::get_dispyfix() const -{ - return ui->dispyfix->isChecked(); -} - bool TaskFemConstraintDisplacement::get_dispyfree() const { return !ui->DisplacementYGB->isChecked(); @@ -535,11 +447,6 @@ bool TaskFemConstraintDisplacement::get_hasDispYFormula() const return ui->DisplacementYFormulaCB->isChecked(); } -bool TaskFemConstraintDisplacement::get_dispzfix() const -{ - return ui->dispzfix->isChecked(); -} - bool TaskFemConstraintDisplacement::get_dispzfree() const { return !ui->DisplacementZGB->isChecked(); @@ -550,31 +457,16 @@ bool TaskFemConstraintDisplacement::get_hasDispZFormula() const return ui->DisplacementZFormulaCB->isChecked(); } -bool TaskFemConstraintDisplacement::get_rotxfix() const -{ - return ui->rotxfix->isChecked(); -} - bool TaskFemConstraintDisplacement::get_rotxfree() const { return !ui->RotationXGB->isChecked(); } -bool TaskFemConstraintDisplacement::get_rotyfix() const -{ - return ui->rotyfix->isChecked(); -} - bool TaskFemConstraintDisplacement::get_rotyfree() const { return !ui->RotationYGB->isChecked(); } -bool TaskFemConstraintDisplacement::get_rotzfix() const -{ - return ui->rotzfix->isChecked(); -} - bool TaskFemConstraintDisplacement::get_rotzfree() const { return !ui->RotationZGB->isChecked(); @@ -673,10 +565,6 @@ bool TaskDlgFemConstraintDisplacement::accept() "App.ActiveDocument.%s.xFree = %s", name.c_str(), parameterDisplacement->get_dispxfree() ? "True" : "False"); - Gui::Command::doCommand(Gui::Command::Doc, - "App.ActiveDocument.%s.xFix = %s", - name.c_str(), - parameterDisplacement->get_dispxfix() ? "True" : "False"); Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.hasXFormula = %s", name.c_str(), @@ -685,10 +573,6 @@ bool TaskDlgFemConstraintDisplacement::accept() "App.ActiveDocument.%s.yFree = %s", name.c_str(), parameterDisplacement->get_dispyfree() ? "True" : "False"); - Gui::Command::doCommand(Gui::Command::Doc, - "App.ActiveDocument.%s.yFix = %s", - name.c_str(), - parameterDisplacement->get_dispyfix() ? "True" : "False"); Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.hasYFormula = %s", name.c_str(), @@ -697,10 +581,6 @@ bool TaskDlgFemConstraintDisplacement::accept() "App.ActiveDocument.%s.zFree = %s", name.c_str(), parameterDisplacement->get_dispzfree() ? "True" : "False"); - Gui::Command::doCommand(Gui::Command::Doc, - "App.ActiveDocument.%s.zFix = %s", - name.c_str(), - parameterDisplacement->get_dispzfix() ? "True" : "False"); Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.hasZFormula = %s", name.c_str(), @@ -709,26 +589,14 @@ bool TaskDlgFemConstraintDisplacement::accept() "App.ActiveDocument.%s.rotxFree = %s", name.c_str(), parameterDisplacement->get_rotxfree() ? "True" : "False"); - Gui::Command::doCommand(Gui::Command::Doc, - "App.ActiveDocument.%s.rotxFix = %s", - name.c_str(), - parameterDisplacement->get_rotxfix() ? "True" : "False"); Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.rotyFree = %s", name.c_str(), parameterDisplacement->get_rotyfree() ? "True" : "False"); - Gui::Command::doCommand(Gui::Command::Doc, - "App.ActiveDocument.%s.rotyFix = %s", - name.c_str(), - parameterDisplacement->get_rotyfix() ? "True" : "False"); Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.rotzFree = %s", name.c_str(), parameterDisplacement->get_rotzfree() ? "True" : "False"); - Gui::Command::doCommand(Gui::Command::Doc, - "App.ActiveDocument.%s.rotzFix = %s", - name.c_str(), - parameterDisplacement->get_rotzfix() ? "True" : "False"); Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.useFlowSurfaceForce = %s", name.c_str(), diff --git a/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.h b/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.h index f90285a8b2..5781953ae0 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.h +++ b/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.h @@ -60,37 +60,25 @@ public: std::string get_xFormula() const; std::string get_yFormula() const; std::string get_zFormula() const; - bool get_dispxfix() const; bool get_dispxfree() const; bool get_hasDispXFormula() const; - bool get_dispyfix() const; bool get_dispyfree() const; bool get_hasDispYFormula() const; - bool get_dispzfix() const; bool get_dispzfree() const; bool get_hasDispZFormula() const; - bool get_rotxfix() const; bool get_rotxfree() const; - bool get_rotyfix() const; bool get_rotyfree() const; - bool get_rotzfix() const; bool get_rotzfree() const; bool get_useFlowSurfaceForce() const; private Q_SLOTS: void onReferenceDeleted(); - void fixx(bool); void formulaX(bool); - void fixy(bool); void formulaY(bool); - void fixz(bool); void formulaZ(bool); void flowForce(bool); - void rotfixx(bool); void formulaRotx(bool); - void rotfixy(bool); void formulaRoty(bool); - void rotfixz(bool); void formulaRotz(bool); void addToSelection() override; diff --git a/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.ui b/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.ui index f17c9aa99f..ec311c8ec8 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.ui +++ b/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.ui @@ -110,17 +110,10 @@ true - + - - - - Fixed - - - - + Formulas are only valid @@ -150,10 +143,10 @@ for the Elmer solver true - + - + Formulas are only valid @@ -164,13 +157,6 @@ for the Elmer solver - - - - Fixed - - - @@ -190,17 +176,10 @@ for the Elmer solver true - + - - - - Fixed - - - - + Formulas are only valid @@ -269,13 +248,6 @@ generated by the flow true - - - - Fixed - - - @@ -295,13 +267,6 @@ generated by the flow true - - - - Fixed - - - @@ -321,13 +286,6 @@ generated by the flow true - - - - Fixed - - - diff --git a/src/Mod/Fem/femexamples/ccx_cantilever_prescribeddisplacement.py b/src/Mod/Fem/femexamples/ccx_cantilever_prescribeddisplacement.py index 5ca90a9fae..b94a206941 100644 --- a/src/Mod/Fem/femexamples/ccx_cantilever_prescribeddisplacement.py +++ b/src/Mod/Fem/femexamples/ccx_cantilever_prescribeddisplacement.py @@ -82,7 +82,6 @@ def setup(doc=None, solvertype="ccxtools"): # constraint displacement con_disp = ObjectsFem.makeConstraintDisplacement(doc, name="ConstraintDisplacmentPrescribed") con_disp.References = [(geom_obj, "Face2")] - con_disp.zFix = False con_disp.zFree = False con_disp.zDisplacement = -250.0 analysis.addObject(con_disp) diff --git a/src/Mod/Fem/femexamples/constraint_transform_beam_hinged.py b/src/Mod/Fem/femexamples/constraint_transform_beam_hinged.py index 3bf63f79c2..0f33d65d8d 100644 --- a/src/Mod/Fem/femexamples/constraint_transform_beam_hinged.py +++ b/src/Mod/Fem/femexamples/constraint_transform_beam_hinged.py @@ -158,7 +158,7 @@ def setup(doc=None, solvertype="ccxtools"): con_disp = ObjectsFem.makeConstraintDisplacement(doc, name="FemConstraintDisplacment") con_disp.References = [(geom_obj, "Face4"), (geom_obj, "Face5")] con_disp.xFree = False - con_disp.xFix = True + con_disp.xDisplacement = 0.0 analysis.addObject(con_disp) # constraints transform diff --git a/src/Mod/Fem/femexamples/frequency_beamsimple.py b/src/Mod/Fem/femexamples/frequency_beamsimple.py index 3b6d7d2787..f68265f1b4 100644 --- a/src/Mod/Fem/femexamples/frequency_beamsimple.py +++ b/src/Mod/Fem/femexamples/frequency_beamsimple.py @@ -119,13 +119,10 @@ def setup(doc=None, solvertype="ccxtools"): # constraint displacement xyz con_disp_xyz = ObjectsFem.makeConstraintDisplacement(doc, "Fix_XYZ") con_disp_xyz.References = [(doc.Box, "Edge4")] - con_disp_xyz.xFix = True con_disp_xyz.xFree = False con_disp_xyz.xDisplacement = 0.0 - con_disp_xyz.yFix = True con_disp_xyz.yFree = False con_disp_xyz.yDisplacement = 0.0 - con_disp_xyz.zFix = True con_disp_xyz.zFree = False con_disp_xyz.zDisplacement = 0.0 analysis.addObject(con_disp_xyz) @@ -133,13 +130,10 @@ def setup(doc=None, solvertype="ccxtools"): # constraint displacement yz con_disp_yz = ObjectsFem.makeConstraintDisplacement(doc, "Fix_YZ") con_disp_yz.References = [(doc.Box, "Edge8")] - con_disp_yz.xFix = False con_disp_yz.xFree = True con_disp_yz.xDisplacement = 0.0 - con_disp_yz.yFix = True con_disp_yz.yFree = False con_disp_yz.yDisplacement = 0.0 - con_disp_yz.zFix = True con_disp_yz.zFree = False con_disp_yz.zDisplacement = 0.0 analysis.addObject(con_disp_yz) diff --git a/src/Mod/Fem/femsolver/calculix/write_constraint_displacement.py b/src/Mod/Fem/femsolver/calculix/write_constraint_displacement.py index 43f6d70769..557cfc7abf 100644 --- a/src/Mod/Fem/femsolver/calculix/write_constraint_displacement.py +++ b/src/Mod/Fem/femsolver/calculix/write_constraint_displacement.py @@ -67,25 +67,19 @@ def write_constraint(f, femobj, disp_obj, ccxwriter): # floats read from ccx should use {:.13G}, see comment in writer module f.write("*BOUNDARY\n") - if disp_obj.xFix: - f.write(f"{disp_obj.Name},1\n") - elif not disp_obj.xFree: + if not disp_obj.xFree: f.write( "{},1,1,{}\n".format( disp_obj.Name, FreeCAD.Units.Quantity(disp_obj.xDisplacement.getValueAs("mm")) ) ) - if disp_obj.yFix: - f.write(f"{disp_obj.Name},2\n") - elif not disp_obj.yFree: + if not disp_obj.yFree: f.write( "{},2,2,{}\n".format( disp_obj.Name, FreeCAD.Units.Quantity(disp_obj.yDisplacement.getValueAs("mm")) ) ) - if disp_obj.zFix: - f.write(f"{disp_obj.Name},3\n") - elif not disp_obj.zFree: + if not disp_obj.zFree: f.write( "{},3,3,{}\n".format( disp_obj.Name, FreeCAD.Units.Quantity(disp_obj.zDisplacement.getValueAs("mm")) @@ -93,25 +87,19 @@ def write_constraint(f, femobj, disp_obj, ccxwriter): ) if ccxwriter.member.geos_beamsection or ccxwriter.member.geos_shellthickness: - if disp_obj.rotxFix: - f.write(f"{disp_obj.Name},4\n") - elif not disp_obj.rotxFree: + if not disp_obj.rotxFree: f.write( "{},4,4,{}\n".format( disp_obj.Name, FreeCAD.Units.Quantity(disp_obj.xRotation.getValueAs("deg")) ) ) - if disp_obj.rotyFix: - f.write(f"{disp_obj.Name},5\n") - elif not disp_obj.rotyFree: + if not disp_obj.rotyFree: f.write( "{},5,5,{}\n".format( disp_obj.Name, FreeCAD.Units.Quantity(disp_obj.yRotation.getValueAs("deg")) ) ) - if disp_obj.rotzFix: - f.write(f"{disp_obj.Name},6\n") - elif not disp_obj.rotzFree: + if not disp_obj.rotzFree: f.write( "{},6,6,{}\n".format( disp_obj.Name, FreeCAD.Units.Quantity(disp_obj.zRotation.getValueAs("deg")) diff --git a/src/Mod/Fem/femtest/data/calculix/constraint_transform_beam_hinged.inp b/src/Mod/Fem/femtest/data/calculix/constraint_transform_beam_hinged.inp index 94a7a2bbc9..d13f5e8742 100644 --- a/src/Mod/Fem/femtest/data/calculix/constraint_transform_beam_hinged.inp +++ b/src/Mod/Fem/femtest/data/calculix/constraint_transform_beam_hinged.inp @@ -3650,7 +3650,7 @@ Evolumes ** Displacement constraint applied ** FemConstraintDisplacment *BOUNDARY -FemConstraintDisplacment,1 +FemConstraintDisplacment,1,1,0.0 *********************************************************** diff --git a/src/Mod/Fem/femtest/data/calculix/frequency_beamsimple.inp b/src/Mod/Fem/femtest/data/calculix/frequency_beamsimple.inp index 5ffef0521c..1bc9ada523 100644 --- a/src/Mod/Fem/femtest/data/calculix/frequency_beamsimple.inp +++ b/src/Mod/Fem/femtest/data/calculix/frequency_beamsimple.inp @@ -17050,13 +17050,13 @@ Evolumes ** Displacement constraint applied ** Fix_XYZ *BOUNDARY -Fix_XYZ,1 -Fix_XYZ,2 -Fix_XYZ,3 +Fix_XYZ,1,1,0.0 +Fix_XYZ,2,2,0.0 +Fix_XYZ,3,3,0.0 ** Fix_YZ *BOUNDARY -Fix_YZ,2 -Fix_YZ,3 +Fix_YZ,2,2,0.0 +Fix_YZ,3,3,0.0 ***********************************************************