PartGui: Fixes and updates for Offset2D to task dialog
+ add expression support for offset value
This commit is contained in:
parent
c5f642e44a
commit
4e252175ee
|
@ -76,8 +76,44 @@ OffsetWidget::OffsetWidget(Part::Offset* offset, QWidget* parent)
|
|||
d->ui.spinOffset->setUnit(Base::Unit::Length);
|
||||
d->ui.spinOffset->setRange(-INT_MAX, INT_MAX);
|
||||
d->ui.spinOffset->setSingleStep(0.1);
|
||||
d->ui.spinOffset->setValue(d->offset->Value.getValue());
|
||||
d->ui.facesButton->hide();
|
||||
|
||||
bool is_2d = d->offset->isDerivedFrom(Part::Offset2D::getClassTypeId());
|
||||
d->ui.selfIntersection->setVisible(!is_2d);
|
||||
if(is_2d)
|
||||
d->ui.modeType->removeItem(2);//remove Recto-Verso mode, not supported by 2d offset
|
||||
|
||||
//block signals to fill values read out from feature...
|
||||
bool block = true;
|
||||
d->ui.fillOffset->blockSignals(block);
|
||||
d->ui.intersection->blockSignals(block);
|
||||
d->ui.selfIntersection->blockSignals(block);
|
||||
d->ui.modeType->blockSignals(block);
|
||||
d->ui.joinType->blockSignals(block);
|
||||
d->ui.spinOffset->blockSignals(block);
|
||||
|
||||
//read values from feature
|
||||
d->ui.spinOffset->setValue(d->offset->Value.getValue());
|
||||
d->ui.fillOffset->setChecked(offset->Fill.getValue());
|
||||
d->ui.intersection->setChecked(offset->Intersection.getValue());
|
||||
d->ui.selfIntersection->setChecked(offset->SelfIntersection.getValue());
|
||||
long mode = offset->Mode.getValue();
|
||||
if (mode >= 0 && mode < d->ui.modeType->count())
|
||||
d->ui.modeType->setCurrentIndex(mode);
|
||||
long join = offset->Join.getValue();
|
||||
if (join >= 0 && join < d->ui.joinType->count())
|
||||
d->ui.joinType->setCurrentIndex(join);
|
||||
|
||||
//unblock signals
|
||||
block = false;
|
||||
d->ui.fillOffset->blockSignals(block);
|
||||
d->ui.intersection->blockSignals(block);
|
||||
d->ui.selfIntersection->blockSignals(block);
|
||||
d->ui.modeType->blockSignals(block);
|
||||
d->ui.joinType->blockSignals(block);
|
||||
d->ui.spinOffset->blockSignals(block);
|
||||
|
||||
d->ui.spinOffset->bind(d->offset->Value);
|
||||
}
|
||||
|
||||
OffsetWidget::~OffsetWidget()
|
||||
|
@ -147,6 +183,7 @@ bool OffsetWidget::accept()
|
|||
double offsetValue = d->ui.spinOffset->value().getValue();
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Value = %f",
|
||||
name.c_str(),offsetValue);
|
||||
d->ui.spinOffset->apply();
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Mode = %i",
|
||||
name.c_str(),d->ui.modeType->currentIndex());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Join = %i",
|
||||
|
|
Loading…
Reference in New Issue
Block a user