Set placement property to read-only for skecth/ dress up features

This commit is contained in:
wmayer 2012-04-06 12:29:18 +02:00
parent de50ac9eca
commit 1b5e834ee9
6 changed files with 37 additions and 1 deletions

View File

@ -48,6 +48,16 @@ public:
bool operator () (const std::pair<std::string, App::Property*>& elem) const
{
if (elem.first == propertyname) {
// flag set that property is read-only or hidden
if (elem.second->StatusBits.test(2) || elem.second->StatusBits.test(3))
return false;
App::PropertyContainer* parent = elem.second->getContainer();
if (parent) {
// flag set that property is read-only or hidden
if (parent->isReadOnly(elem.second) ||
parent->isHidden(elem.second))
return false;
}
return elem.second->isDerivedFrom
(Base::Type::fromName("App::PropertyPlacement"));
}

View File

@ -121,6 +121,8 @@ int PropertyItem::columnCount() const
void PropertyItem::setReadOnly(bool ro)
{
readonly = ro;
for (QList<PropertyItem*>::iterator it = childItems.begin(); it != childItems.end(); ++it)
(*it)->setReadOnly(ro);
}
bool PropertyItem::isReadOnly() const

View File

@ -48,4 +48,14 @@ void DressUp::positionByBase(void)
this->Placement.setValue(base->Placement.getValue());
}
void DressUp::onChanged(const App::Property* prop)
{
if (prop == &Base) {
// if attached to a sketch then mark it as read-only
this->Placement.StatusBits.set(2, Base.getValue() != 0);
}
Feature::onChanged(prop);
}
}

View File

@ -41,7 +41,10 @@ public:
/// updates the Placement property from the Placement of Base
void positionByBase(void);
};
protected:
void onChanged(const App::Property* prop);
};
} //namespace PartDesign

View File

@ -89,6 +89,16 @@ void SketchBased::positionBySketch(void)
}
}
void SketchBased::onChanged(const App::Property* prop)
{
if (prop == &Sketch) {
// if attached to a sketch then mark it as read-only
this->Placement.StatusBits.set(2, Sketch.getValue() != 0);
}
Feature::onChanged(prop);
}
bool SketchBased::isInside(const TopoDS_Wire& wire1, const TopoDS_Wire& wire2) const
{
Bnd_Box box1;

View File

@ -51,6 +51,7 @@ public:
int getSketchAxisCount(void) const;
protected:
void onChanged(const App::Property* prop);
TopoDS_Face validateFace(const TopoDS_Face&) const;
TopoDS_Shape makeFace(const std::vector<TopoDS_Wire>&) const;
TopoDS_Shape makeFace(std::list<TopoDS_Wire>&) const; // for internal use only