PartDesign changes
* Mostly for supporting in-place editing * Add new SubShapeBinder that support cross coordinate system, external, and sub-object binding
This commit is contained in:
@@ -218,6 +218,7 @@ void TaskLinearPatternParameters::updateUI()
|
||||
|
||||
void TaskLinearPatternParameters::onUpdateViewTimer()
|
||||
{
|
||||
setupTransaction();
|
||||
recomputeFeature();
|
||||
}
|
||||
|
||||
@@ -228,25 +229,8 @@ void TaskLinearPatternParameters::kickUpdateViewTimer() const
|
||||
|
||||
void TaskLinearPatternParameters::onSelectionChanged(const Gui::SelectionChanges& msg)
|
||||
{
|
||||
if (msg.Type == Gui::SelectionChanges::AddSelection) {
|
||||
if (selectionMode!=none && msg.Type == Gui::SelectionChanges::AddSelection) {
|
||||
if (originalSelected(msg)) {
|
||||
Gui::SelectionObject selObj(msg);
|
||||
App::DocumentObject* obj = selObj.getObject();
|
||||
Q_ASSERT(obj);
|
||||
|
||||
QString label = QString::fromUtf8(obj->Label.getValue());
|
||||
QString objectName = QString::fromLatin1(msg.pObjectName);
|
||||
|
||||
if (selectionMode == addFeature) {
|
||||
QListWidgetItem* item = new QListWidgetItem();
|
||||
item->setText(label);
|
||||
item->setData(Qt::UserRole, objectName);
|
||||
ui->listWidgetFeatures->addItem(item);
|
||||
}
|
||||
else {
|
||||
removeItemFromListWidget(ui->listWidgetFeatures, label);
|
||||
}
|
||||
|
||||
exitSelectionMode();
|
||||
} else {
|
||||
// TODO check if this works correctly (2015-09-01, Fat-Zer)
|
||||
@@ -263,8 +247,8 @@ void TaskLinearPatternParameters::onSelectionChanged(const Gui::SelectionChanges
|
||||
selObj->isDerivedFrom(Part::Feature::getClassTypeId()) ||
|
||||
selObj->isDerivedFrom(PartDesign::Line::getClassTypeId()) ||
|
||||
selObj->isDerivedFrom(PartDesign::Plane::getClassTypeId()))) {
|
||||
setupTransaction();
|
||||
pcLinearPattern->Direction.setValue(selObj, directions);
|
||||
|
||||
recomputeFeature();
|
||||
updateUI();
|
||||
}
|
||||
@@ -342,6 +326,7 @@ void TaskLinearPatternParameters::onUpdateView(bool on)
|
||||
std::vector<std::string> directions;
|
||||
App::DocumentObject* obj;
|
||||
|
||||
setupTransaction();
|
||||
getDirection(obj, directions);
|
||||
pcLinearPattern->Direction.setValue(obj,directions);
|
||||
pcLinearPattern->Reversed.setValue(getReverse());
|
||||
@@ -357,6 +342,7 @@ void TaskLinearPatternParameters::onFeatureDeleted(void)
|
||||
PartDesign::Transformed* pcTransformed = getObject();
|
||||
std::vector<App::DocumentObject*> originals = pcTransformed->Originals.getValues();
|
||||
originals.erase(originals.begin() + ui->listWidgetFeatures->currentRow());
|
||||
setupTransaction();
|
||||
pcTransformed->Originals.setValues(originals);
|
||||
ui->listWidgetFeatures->model()->removeRow(ui->listWidgetFeatures->currentRow());
|
||||
recomputeFeature();
|
||||
@@ -415,15 +401,14 @@ void TaskLinearPatternParameters::changeEvent(QEvent *e)
|
||||
|
||||
void TaskLinearPatternParameters::apply()
|
||||
{
|
||||
std::string name = TransformedView->getObject()->getNameInDocument();
|
||||
|
||||
std::vector<std::string> directions;
|
||||
App::DocumentObject* obj;
|
||||
getDirection(obj, directions);
|
||||
std::string direction = buildLinkSingleSubPythonStr(obj, directions);
|
||||
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Direction = %s", name.c_str(), direction.c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Reversed = %u",name.c_str(),getReverse());
|
||||
auto tobj = TransformedView->getObject();
|
||||
FCMD_OBJ_CMD(tobj,"Direction = " << direction);
|
||||
FCMD_OBJ_CMD(tobj,"Reversed = " << getReverse());
|
||||
|
||||
ui->spinLength->apply();
|
||||
ui->spinOccurrences->apply();
|
||||
|
||||
Reference in New Issue
Block a user