@@ -91,14 +91,36 @@ TaskFemConstraintContact::TaskFemConstraintContact(ViewProviderFemConstraintCont
91
91
92
92
std::vector<App::DocumentObject*> Objects = pcConstraint->References .getValues ();
93
93
std::vector<std::string> SubElements = pcConstraint->References .getSubValues ();
94
- double slope = pcConstraint->Slope .getValue ();
95
- double friction = pcConstraint->Friction .getValue ();
96
94
97
- // Fill data into dialog elements
98
- ui->spSlope ->setMinimum (1.0 );
99
- ui->spSlope ->setValue (slope);
100
- ui->spFriction ->setValue (friction);
95
+ bool friction = pcConstraint->Friction .getValue ();
101
96
97
+ // Fill data into dialog elements
98
+ ui->spbSlope ->setUnit (pcConstraint->Slope .getUnit ());
99
+ ui->spbSlope ->setMinimum (0 );
100
+ ui->spbSlope ->setMaximum (FLOAT_MAX);
101
+ ui->spbSlope ->setValue (pcConstraint->Slope .getQuantityValue ());
102
+ ui->spbSlope ->bind (pcConstraint->Slope );
103
+
104
+ ui->spbAdjust ->setUnit (pcConstraint->Adjust .getUnit ());
105
+ ui->spbAdjust ->setMinimum (0 );
106
+ ui->spbAdjust ->setMaximum (FLOAT_MAX);
107
+ ui->spbAdjust ->setValue (pcConstraint->Adjust .getQuantityValue ());
108
+ ui->spbAdjust ->bind (pcConstraint->Adjust );
109
+
110
+ ui->ckbFriction ->setChecked (friction);
111
+
112
+ ui->spbFrictionCoeff ->setMinimum (0 );
113
+ ui->spbFrictionCoeff ->setMaximum (FLOAT_MAX);
114
+ ui->spbFrictionCoeff ->setValue (pcConstraint->FrictionCoefficient .getValue ());
115
+ ui->spbFrictionCoeff ->setEnabled (friction);
116
+ ui->spbFrictionCoeff ->bind (pcConstraint->FrictionCoefficient );
117
+
118
+ ui->spbStickSlope ->setUnit (pcConstraint->StickSlope .getUnit ());
119
+ ui->spbStickSlope ->setMinimum (0 );
120
+ ui->spbStickSlope ->setMaximum (FLOAT_MAX);
121
+ ui->spbStickSlope ->setValue (pcConstraint->StickSlope .getQuantityValue ());
122
+ ui->spbStickSlope ->setEnabled (friction);
123
+ ui->spbStickSlope ->bind (pcConstraint->StickSlope );
102
124
/* */
103
125
104
126
ui->lw_referencesMaster ->clear ();
@@ -136,6 +158,11 @@ TaskFemConstraintContact::TaskFemConstraintContact(ViewProviderFemConstraintCont
136
158
this ,
137
159
&TaskFemConstraintContact::removeFromSelectionMaster);
138
160
161
+ connect (ui->ckbFriction ,
162
+ &QCheckBox::toggled,
163
+ this ,
164
+ &TaskFemConstraintContact::onFrictionChanged);
165
+
139
166
updateUI ();
140
167
}
141
168
@@ -428,6 +455,12 @@ void TaskFemConstraintContact::onReferenceDeletedMaster()
428
455
TaskFemConstraintContact::removeFromSelectionMaster ();
429
456
}
430
457
458
+ void TaskFemConstraintContact::onFrictionChanged (bool state)
459
+ {
460
+ ui->spbFrictionCoeff ->setEnabled (state);
461
+ ui->spbStickSlope ->setEnabled (state);
462
+ }
463
+
431
464
const std::string TaskFemConstraintContact::getReferences () const
432
465
{
433
466
int rowsSlave = ui->lw_referencesSlave ->model ()->rowCount ();
@@ -443,15 +476,29 @@ const std::string TaskFemConstraintContact::getReferences() const
443
476
return TaskFemConstraint::getReferences (items);
444
477
}
445
478
446
- /* Note: */
447
- double TaskFemConstraintContact::get_Slope () const
479
+ const std::string TaskFemConstraintContact::getSlope () const
480
+ {
481
+ return ui->spbSlope ->value ().getSafeUserString ().toStdString ();
482
+ }
483
+
484
+ const std::string TaskFemConstraintContact::getAdjust () const
485
+ {
486
+ return ui->spbAdjust ->value ().getSafeUserString ().toStdString ();
487
+ }
488
+
489
+ bool TaskFemConstraintContact::getFriction () const
490
+ {
491
+ return ui->ckbFriction ->isChecked ();
492
+ }
493
+
494
+ double TaskFemConstraintContact::getFrictionCoeff () const
448
495
{
449
- return ui->spSlope -> rawValue ();
496
+ return ui->spbFrictionCoeff -> value ();
450
497
}
451
498
452
- double TaskFemConstraintContact::get_Friction () const
499
+ const std::string TaskFemConstraintContact::getStickSlope () const
453
500
{
454
- return ui->spFriction ->value ();
501
+ return ui->spbStickSlope ->value (). getSafeUserString (). toStdString ();
455
502
}
456
503
457
504
void TaskFemConstraintContact::changeEvent (QEvent*)
@@ -478,7 +525,7 @@ void TaskDlgFemConstraintContact::open()
478
525
// a transaction is already open at creation time of the panel
479
526
if (!Gui::Command::hasPendingCommand ()) {
480
527
QString msg = QObject::tr (" Contact constraint" );
481
- Gui::Command::openCommand (( const char *) msg.toUtf8 ());
528
+ Gui::Command::openCommand (static_cast < const char *>( msg.toUtf8 () ));
482
529
ConstraintView->setVisible (true );
483
530
Gui::Command::runCommand (
484
531
Gui::Command::Doc,
@@ -497,13 +544,25 @@ bool TaskDlgFemConstraintContact::accept()
497
544
498
545
try {
499
546
Gui::Command::doCommand (Gui::Command::Doc,
500
- " App.ActiveDocument.%s.Slope = %f" ,
547
+ " App.ActiveDocument.%s.Slope = \" %s\" " ,
548
+ name.c_str (),
549
+ parameterContact->getSlope ().c_str ());
550
+ Gui::Command::doCommand (Gui::Command::Doc,
551
+ " App.ActiveDocument.%s.Adjust = \" %s\" " ,
552
+ name.c_str (),
553
+ parameterContact->getAdjust ().c_str ());
554
+ Gui::Command::doCommand (Gui::Command::Doc,
555
+ " App.ActiveDocument.%s.Friction = %s" ,
556
+ name.c_str (),
557
+ parameterContact->getFriction () ? " True" : " False" );
558
+ Gui::Command::doCommand (Gui::Command::Doc,
559
+ " App.ActiveDocument.%s.FrictionCoefficient = %f" ,
501
560
name.c_str (),
502
- parameterContact->get_Slope ());
561
+ parameterContact->getFrictionCoeff ());
503
562
Gui::Command::doCommand (Gui::Command::Doc,
504
- " App.ActiveDocument.%s.Friction = %f " ,
563
+ " App.ActiveDocument.%s.StickSlope = \" %s \" " ,
505
564
name.c_str (),
506
- parameterContact->get_Friction ());
565
+ parameterContact->getStickSlope (). c_str ());
507
566
std::string scale = parameterContact->getScale (); // OvG: determine modified scale
508
567
Gui::Command::doCommand (Gui::Command::Doc,
509
568
" App.ActiveDocument.%s.Scale = %s" ,
0 commit comments