Set placement property to read-only for skecth/ dress up features
This commit is contained in:
parent
de50ac9eca
commit
1b5e834ee9
|
@ -48,6 +48,16 @@ public:
|
||||||
bool operator () (const std::pair<std::string, App::Property*>& elem) const
|
bool operator () (const std::pair<std::string, App::Property*>& elem) const
|
||||||
{
|
{
|
||||||
if (elem.first == propertyname) {
|
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
|
return elem.second->isDerivedFrom
|
||||||
(Base::Type::fromName("App::PropertyPlacement"));
|
(Base::Type::fromName("App::PropertyPlacement"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,6 +121,8 @@ int PropertyItem::columnCount() const
|
||||||
void PropertyItem::setReadOnly(bool ro)
|
void PropertyItem::setReadOnly(bool ro)
|
||||||
{
|
{
|
||||||
readonly = ro;
|
readonly = ro;
|
||||||
|
for (QList<PropertyItem*>::iterator it = childItems.begin(); it != childItems.end(); ++it)
|
||||||
|
(*it)->setReadOnly(ro);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PropertyItem::isReadOnly() const
|
bool PropertyItem::isReadOnly() const
|
||||||
|
|
|
@ -48,4 +48,14 @@ void DressUp::positionByBase(void)
|
||||||
this->Placement.setValue(base->Placement.getValue());
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,10 @@ public:
|
||||||
|
|
||||||
/// updates the Placement property from the Placement of Base
|
/// updates the Placement property from the Placement of Base
|
||||||
void positionByBase(void);
|
void positionByBase(void);
|
||||||
};
|
|
||||||
|
protected:
|
||||||
|
void onChanged(const App::Property* prop);
|
||||||
|
};
|
||||||
|
|
||||||
} //namespace PartDesign
|
} //namespace PartDesign
|
||||||
|
|
||||||
|
|
|
@ -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
|
bool SketchBased::isInside(const TopoDS_Wire& wire1, const TopoDS_Wire& wire2) const
|
||||||
{
|
{
|
||||||
Bnd_Box box1;
|
Bnd_Box box1;
|
||||||
|
|
|
@ -51,6 +51,7 @@ public:
|
||||||
int getSketchAxisCount(void) const;
|
int getSketchAxisCount(void) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void onChanged(const App::Property* prop);
|
||||||
TopoDS_Face validateFace(const TopoDS_Face&) const;
|
TopoDS_Face validateFace(const TopoDS_Face&) const;
|
||||||
TopoDS_Shape makeFace(const std::vector<TopoDS_Wire>&) const;
|
TopoDS_Shape makeFace(const std::vector<TopoDS_Wire>&) const;
|
||||||
TopoDS_Shape makeFace(std::list<TopoDS_Wire>&) const; // for internal use only
|
TopoDS_Shape makeFace(std::list<TopoDS_Wire>&) const; // for internal use only
|
||||||
|
|
Loading…
Reference in New Issue
Block a user