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:
Zheng, Lei
2019-07-13 18:13:21 +08:00
committed by wmayer
parent 11321bb996
commit cd2b7e297c
55 changed files with 1944 additions and 755 deletions

View File

@@ -116,7 +116,8 @@ TaskHoleParameters::TaskHoleParameters(ViewProviderHole *HoleView, QWidget *pare
ui->DrillPointAngle->bind(pcHole->DrillPointAngle);
ui->TaperedAngle->bind(pcHole->TaperedAngle);
connectPropChanged = App::GetApplication().signalChangePropertyEditor.connect(boost::bind(&TaskHoleParameters::changedObject, this, _1));
connectPropChanged = App::GetApplication().signalChangePropertyEditor.connect(
boost::bind(&TaskHoleParameters::changedObject, this, _1, _2));
this->groupLayout()->addWidget(proxy);
}
@@ -328,7 +329,7 @@ void TaskHoleParameters::changeEvent(QEvent *e)
}
}
void TaskHoleParameters::changedObject(const App::Property &Prop)
void TaskHoleParameters::changedObject(const App::Document&, const App::Property &Prop)
{
// happens when aborting the command
if (vp == nullptr)
@@ -691,9 +692,8 @@ Base::Quantity TaskHoleParameters::getTaperedAngle() const
void TaskHoleParameters::apply()
{
std::string name = vp->getObject()->getNameInDocument();
auto obj = vp->getObject();
PartDesign::Hole* pcHole = static_cast<PartDesign::Hole*>(vp->getObject());
const char * cname = name.c_str();
isApplying = true;
@@ -710,27 +710,27 @@ void TaskHoleParameters::apply()
ui->TaperedAngle->apply();
if (!pcHole->Threaded.isReadOnly())
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Threaded = %u", cname, getThreaded() ? 1 : 0);
FCMD_OBJ_CMD(obj,"Threaded = " << (getThreaded() ? 1 : 0));
if (!pcHole->ModelActualThread.isReadOnly())
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.ModelActualThread = %u", cname, getThreaded() ? 1 : 0);
FCMD_OBJ_CMD(obj,"ModelActualThread = " << (getThreaded() ? 1 : 0));
if (!pcHole->ThreadType.isReadOnly())
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.ThreadType = %u", cname, getThreadType());
FCMD_OBJ_CMD(obj,"ThreadType = " << getThreadType());
if (!pcHole->ThreadSize.isReadOnly())
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.ThreadSize = %u", cname, getThreadSize());
FCMD_OBJ_CMD(obj,"ThreadSize = " << getThreadSize());
if (!pcHole->ThreadClass.isReadOnly())
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.ThreadClass = %u", cname, getThreadClass());
if (!pcHole->ThreadFit.isReadOnly())
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.ThreadFit = %u", cname, getThreadFit());
FCMD_OBJ_CMD(obj,"ThreadClass = " << getThreadClass());
if (!pcHole->ThreadFit.isReadOnly())
FCMD_OBJ_CMD(obj,"ThreadFit = " << getThreadFit());
if (!pcHole->ThreadDirection.isReadOnly())
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.ThreadDirection = %u", cname, getThreadDirection());
FCMD_OBJ_CMD(obj,"ThreadDirection = " << getThreadDirection());
if (!pcHole->HoleCutType.isReadOnly())
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.HoleCutType = %u", cname, getHoleCutType());
FCMD_OBJ_CMD(obj,"HoleCutType = " << getHoleCutType());
if (!pcHole->DepthType.isReadOnly())
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.DepthType = %u", cname, getDepthType());
FCMD_OBJ_CMD(obj,"DepthType = " << getDepthType());
if (!pcHole->DrillPoint.isReadOnly())
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.DrillPoint = %u", cname, getDrillPoint());
FCMD_OBJ_CMD(obj,"DrillPoint = " << getDrillPoint());
if (!pcHole->Tapered.isReadOnly())
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Tapered = %u", cname, getTapered());
FCMD_OBJ_CMD(obj,"Tapered = " << getTapered());
isApplying = false;
}
@@ -767,6 +767,7 @@ void TaskHoleParameters::Observer::slotChangedObject(const App::DocumentObject &
{
if (&Obj == hole) {
Base::Console().Log("Parameter %s was updated with a new value\n", Prop.getName());
owner->changedObject(Prop);
if(Obj.getDocument())
owner->changedObject(*Obj.getDocument(),Prop);
}
}