[FEM] fix point filter output
fixes #7008: - the point data must be read also when the center changed - when the dialog is called it has only the value for the current field, thus recompute the feature to fill all fields with data - on clicking on a mesh point display the value at the clicked position - due to the object's recomputation at the start, a complete recomputation (for the whole pipeline) is needed on closing the dialog
This commit is contained in:
@@ -385,19 +385,16 @@ void FemPostDataAtPointFilter::onChanged(const Property* prop) {
|
||||
const Base::Vector3d& vec = Center.getValue();
|
||||
m_point->SetCenter(vec.x, vec.y, vec.z);
|
||||
}
|
||||
else if (prop == &FieldName) {
|
||||
GetPointData();
|
||||
}
|
||||
GetPointData();
|
||||
Fem::FemPostFilter::onChanged(prop);
|
||||
}
|
||||
|
||||
short int FemPostDataAtPointFilter::mustExecute(void) const {
|
||||
|
||||
if (Center.isTouched()) {
|
||||
|
||||
if (Center.isTouched())
|
||||
return 1;
|
||||
}
|
||||
else return App::DocumentObject::mustExecute();
|
||||
else
|
||||
return App::DocumentObject::mustExecute();
|
||||
}
|
||||
|
||||
void FemPostDataAtPointFilter::GetPointData() {
|
||||
|
||||
@@ -257,7 +257,6 @@ void TaskDlgPost::clicked(int button)
|
||||
|
||||
bool TaskDlgPost::accept()
|
||||
{
|
||||
|
||||
try {
|
||||
std::vector<TaskPostBox*>::iterator it = m_boxes.begin();
|
||||
for (; it != m_boxes.end(); ++it)
|
||||
@@ -811,12 +810,16 @@ TaskPostDataAtPoint::TaskPostDataAtPoint(ViewProviderDocumentObject* view, QWidg
|
||||
connect(ui->centerY, SIGNAL(valueChanged(double)), this, SLOT(centerChanged(double)));
|
||||
connect(ui->centerZ, SIGNAL(valueChanged(double)), this, SLOT(centerChanged(double)));
|
||||
|
||||
//update all fields
|
||||
// update all fields
|
||||
updateEnumerationList(getTypedView<ViewProviderFemPostObject>()->Field, ui->Field);
|
||||
|
||||
// the point filter object needs to be recompiled
|
||||
// to fill all fields with data at the current point
|
||||
static_cast<Fem::FemPostDataAtPointFilter*>(getObject())->recomputeFeature();
|
||||
}
|
||||
|
||||
TaskPostDataAtPoint::~TaskPostDataAtPoint() {
|
||||
|
||||
App::GetApplication().getActiveDocument()->recompute();
|
||||
}
|
||||
|
||||
void TaskPostDataAtPoint::applyPythonCode() {
|
||||
@@ -883,6 +886,12 @@ void TaskPostDataAtPoint::onChange(double x, double y, double z) {
|
||||
ui->centerX->setValue(x);
|
||||
ui->centerY->setValue(y);
|
||||
ui->centerZ->setValue(z);
|
||||
Base::Console().Error("on Change\n");
|
||||
// recompute the feature to fill all fields with data at this point
|
||||
static_cast<Fem::FemPostDataAtPointFilter*>(getObject())->recomputeFeature();
|
||||
// show the data ba calling on_Field_activated with the field that is currently set
|
||||
auto Field = getTypedView<ViewProviderFemPostObject>()->Field.getValue();
|
||||
on_Field_activated(Field);
|
||||
}
|
||||
|
||||
void TaskPostDataAtPoint::centerChanged(double) {
|
||||
@@ -974,9 +983,8 @@ void TaskPostDataAtPoint::on_Field_activated(int i) {
|
||||
bool scientific = (pointValue < 1e-2) || (pointValue > 1e4);
|
||||
std::ios::fmtflags flags = scientific ? (std::ios::scientific | std::ios::showpoint | std::ios::showpos)
|
||||
: (std::ios::fixed | std::ios::showpoint | std::ios::showpos);
|
||||
int UserDecimals = Base::UnitsApi::getDecimals();
|
||||
std::stringstream valueStream;
|
||||
valueStream.precision(UserDecimals);
|
||||
valueStream.precision(Base::UnitsApi::getDecimals());
|
||||
valueStream.setf(flags);
|
||||
valueStream << pointValue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user