allow to add faces to fillet and chamfer
This commit is contained in:
parent
329064d671
commit
fc1e8b8d17
|
@ -32,6 +32,7 @@
|
||||||
# include <TopTools_IndexedMapOfShape.hxx>
|
# include <TopTools_IndexedMapOfShape.hxx>
|
||||||
# include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
# include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||||
# include <TopTools_ListOfShape.hxx>
|
# include <TopTools_ListOfShape.hxx>
|
||||||
|
#include <BRep_Tool.hxx>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <Base/Console.h>
|
#include <Base/Console.h>
|
||||||
|
@ -74,8 +75,10 @@ App::DocumentObjectExecReturn *Chamfer::execute(void)
|
||||||
return new App::DocumentObjectExecReturn(e.what());
|
return new App::DocumentObjectExecReturn(e.what());
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<std::string>& SubVals = Base.getSubValuesStartsWith("Edge");
|
std::vector<std::string> SubNames = std::vector<std::string>(Base.getSubValues());
|
||||||
if (SubVals.size() == 0)
|
getContiniusEdges(TopShape, SubNames);
|
||||||
|
|
||||||
|
if (SubNames.size() == 0)
|
||||||
return new App::DocumentObjectExecReturn("No edges specified");
|
return new App::DocumentObjectExecReturn("No edges specified");
|
||||||
|
|
||||||
double size = Size.getValue();
|
double size = Size.getValue();
|
||||||
|
@ -92,7 +95,7 @@ App::DocumentObjectExecReturn *Chamfer::execute(void)
|
||||||
TopExp::MapShapesAndAncestors(baseShape._Shape, TopAbs_EDGE, TopAbs_FACE, mapEdgeFace);
|
TopExp::MapShapesAndAncestors(baseShape._Shape, TopAbs_EDGE, TopAbs_FACE, mapEdgeFace);
|
||||||
TopExp::MapShapes(baseShape._Shape, TopAbs_EDGE, mapOfEdges);
|
TopExp::MapShapes(baseShape._Shape, TopAbs_EDGE, mapOfEdges);
|
||||||
|
|
||||||
for (std::vector<std::string>::const_iterator it=SubVals.begin(); it != SubVals.end(); ++it) {
|
for (std::vector<std::string>::const_iterator it=SubNames.begin(); it != SubNames.end(); ++it) {
|
||||||
TopoDS_Edge edge = TopoDS::Edge(baseShape.getSubShape(it->c_str()));
|
TopoDS_Edge edge = TopoDS::Edge(baseShape.getSubShape(it->c_str()));
|
||||||
const TopoDS_Face& face = TopoDS::Face(mapEdgeFace.FindFromKey(edge).First());
|
const TopoDS_Face& face = TopoDS::Face(mapEdgeFace.FindFromKey(edge).First());
|
||||||
mkChamfer.Add(size, edge, face);
|
mkChamfer.Add(size, edge, face);
|
||||||
|
|
|
@ -28,6 +28,12 @@
|
||||||
|
|
||||||
#include "FeatureDressUp.h"
|
#include "FeatureDressUp.h"
|
||||||
#include <Base/Exception.h>
|
#include <Base/Exception.h>
|
||||||
|
#include <TopTools_IndexedMapOfShape.hxx>
|
||||||
|
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||||
|
#include <TopExp.hxx>
|
||||||
|
#include <TopoDS.hxx>
|
||||||
|
#include <BRep_Tool.hxx>
|
||||||
|
#include <TopoDS_Edge.hxx>
|
||||||
|
|
||||||
|
|
||||||
using namespace PartDesign;
|
using namespace PartDesign;
|
||||||
|
@ -74,6 +80,72 @@ Part::TopoShape DressUp::getBaseShape()
|
||||||
return shape;
|
return shape;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DressUp::getContiniusEdges(Part::TopoShape TopShape, std::vector< std::string >& SubNames) {
|
||||||
|
|
||||||
|
TopTools_IndexedMapOfShape mapOfEdges;
|
||||||
|
TopTools_IndexedDataMapOfShapeListOfShape mapEdgeFace;
|
||||||
|
TopExp::MapShapesAndAncestors(TopShape._Shape, TopAbs_EDGE, TopAbs_FACE, mapEdgeFace);
|
||||||
|
TopExp::MapShapes(TopShape._Shape, TopAbs_EDGE, mapOfEdges);
|
||||||
|
|
||||||
|
unsigned int i = 0;
|
||||||
|
while(i < SubNames.size())
|
||||||
|
{
|
||||||
|
std::string aSubName = static_cast<std::string>(SubNames.at(i));
|
||||||
|
|
||||||
|
if (aSubName.size() > 4 && aSubName.substr(0,4) == "Edge") {
|
||||||
|
TopoDS_Edge edge = TopoDS::Edge(TopShape.getSubShape(aSubName.c_str()));
|
||||||
|
const TopTools_ListOfShape& los = mapEdgeFace.FindFromKey(edge);
|
||||||
|
|
||||||
|
if(los.Extent() != 2)
|
||||||
|
{
|
||||||
|
SubNames.erase(SubNames.begin()+i);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const TopoDS_Shape& face1 = los.First();
|
||||||
|
const TopoDS_Shape& face2 = los.Last();
|
||||||
|
GeomAbs_Shape cont = BRep_Tool::Continuity(TopoDS::Edge(edge),
|
||||||
|
TopoDS::Face(face1),
|
||||||
|
TopoDS::Face(face2));
|
||||||
|
if (cont != GeomAbs_C0) {
|
||||||
|
SubNames.erase(SubNames.begin()+i);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
else if(aSubName.size() > 4 && aSubName.substr(0,4) == "Face") {
|
||||||
|
TopoDS_Face face = TopoDS::Face(TopShape.getSubShape(aSubName.c_str()));
|
||||||
|
|
||||||
|
TopTools_IndexedMapOfShape mapOfFaces;
|
||||||
|
TopExp::MapShapes(face, TopAbs_EDGE, mapOfFaces);
|
||||||
|
|
||||||
|
for(int j = 1; j <= mapOfFaces.Extent(); ++j) {
|
||||||
|
TopoDS_Edge edge = TopoDS::Edge(mapOfFaces.FindKey(j));
|
||||||
|
|
||||||
|
int id = mapOfEdges.FindIndex(edge);
|
||||||
|
|
||||||
|
std::stringstream buf;
|
||||||
|
buf << "Edge";
|
||||||
|
buf << id;
|
||||||
|
|
||||||
|
if(std::find(SubNames.begin(),SubNames.end(),buf.str()) == SubNames.end())
|
||||||
|
{
|
||||||
|
SubNames.push_back(buf.str());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
SubNames.erase(SubNames.begin()+i);
|
||||||
|
}
|
||||||
|
// empty name or any other sub-element
|
||||||
|
else {
|
||||||
|
SubNames.erase(SubNames.begin()+i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void DressUp::onChanged(const App::Property* prop)
|
void DressUp::onChanged(const App::Property* prop)
|
||||||
{
|
{
|
||||||
if (prop == &BaseFeature) {
|
if (prop == &BaseFeature) {
|
||||||
|
|
|
@ -43,6 +43,9 @@ public:
|
||||||
/// updates the Placement property from the Placement of the BaseFeature
|
/// updates the Placement property from the Placement of the BaseFeature
|
||||||
void positionByBaseFeature(void);
|
void positionByBaseFeature(void);
|
||||||
Part::TopoShape getBaseShape();
|
Part::TopoShape getBaseShape();
|
||||||
|
/// extracts all edges from the subshapes (inkluding face edges) and furthermore adds
|
||||||
|
/// all C0 continius edges to the vector
|
||||||
|
void getContiniusEdges(Part::TopoShape, std::vector< std::string >&);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onChanged(const App::Property* prop);
|
void onChanged(const App::Property* prop);
|
||||||
|
|
|
@ -29,6 +29,9 @@
|
||||||
# include <TopoDS.hxx>
|
# include <TopoDS.hxx>
|
||||||
# include <TopoDS_Edge.hxx>
|
# include <TopoDS_Edge.hxx>
|
||||||
# include <TopTools_ListOfShape.hxx>
|
# include <TopTools_ListOfShape.hxx>
|
||||||
|
#include <TopTools_IndexedMapOfShape.hxx>
|
||||||
|
#include <TopExp.hxx>
|
||||||
|
#include <BRep_Tool.hxx>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <Base/Console.h>
|
#include <Base/Console.h>
|
||||||
|
@ -68,10 +71,11 @@ App::DocumentObjectExecReturn *Fillet::execute(void)
|
||||||
} catch (Base::Exception& e) {
|
} catch (Base::Exception& e) {
|
||||||
return new App::DocumentObjectExecReturn(e.what());
|
return new App::DocumentObjectExecReturn(e.what());
|
||||||
}
|
}
|
||||||
|
std::vector<std::string> SubNames = std::vector<std::string>(Base.getSubValues());
|
||||||
|
getContiniusEdges(TopShape, SubNames);
|
||||||
|
|
||||||
const std::vector<std::string>& SubVals = Base.getSubValuesStartsWith("Edge");
|
if (SubNames.size() == 0)
|
||||||
if (SubVals.size() == 0)
|
return new App::DocumentObjectExecReturn("Fillet not possible on selected shapes");
|
||||||
return new App::DocumentObjectExecReturn("No edges specified");
|
|
||||||
|
|
||||||
double radius = Radius.getValue();
|
double radius = Radius.getValue();
|
||||||
|
|
||||||
|
@ -83,7 +87,7 @@ App::DocumentObjectExecReturn *Fillet::execute(void)
|
||||||
try {
|
try {
|
||||||
BRepFilletAPI_MakeFillet mkFillet(baseShape._Shape);
|
BRepFilletAPI_MakeFillet mkFillet(baseShape._Shape);
|
||||||
|
|
||||||
for (std::vector<std::string>::const_iterator it=SubVals.begin(); it != SubVals.end(); ++it) {
|
for (std::vector<std::string>::const_iterator it=SubNames.begin(); it != SubNames.end(); ++it) {
|
||||||
TopoDS_Edge edge = TopoDS::Edge(baseShape.getSubShape(it->c_str()));
|
TopoDS_Edge edge = TopoDS::Edge(baseShape.getSubShape(it->c_str()));
|
||||||
mkFillet.Add(radius, edge);
|
mkFillet.Add(radius, edge);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,18 +23,23 @@
|
||||||
|
|
||||||
#include "PreCompiled.h"
|
#include "PreCompiled.h"
|
||||||
#ifndef _PreComp_
|
#ifndef _PreComp_
|
||||||
|
# include <BRepAlgo.hxx>
|
||||||
# include <BRepFilletAPI_MakeFillet.hxx>
|
# include <BRepFilletAPI_MakeFillet.hxx>
|
||||||
# include <TopExp_Explorer.hxx>
|
# include <TopExp_Explorer.hxx>
|
||||||
# include <TopoDS.hxx>
|
# include <TopoDS.hxx>
|
||||||
# include <TopoDS_Edge.hxx>
|
# include <TopoDS_Edge.hxx>
|
||||||
|
<<<<<<< 2c7cc8276bd6dd4ccc4aa28daa809a688bd493c5
|
||||||
|
# include <TopTools_ListOfShape.hxx>
|
||||||
|
=======
|
||||||
|
#include <TopTools_IndexedMapOfShape.hxx>
|
||||||
|
#include <TopExp.hxx>
|
||||||
|
#include <BRep_Tool.hxx>
|
||||||
|
>>>>>>> allow to add faces to fillet and chamfer
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
<<<<<<< 50287516b47694e57429cc98f6d5596a06a635d6
|
|
||||||
#include <Base/Console.h>
|
#include <Base/Console.h>
|
||||||
#include <Base/Reader.h>
|
|
||||||
=======
|
|
||||||
#include <Base/Exception.h>
|
#include <Base/Exception.h>
|
||||||
>>>>>>> Some code unification for DressUp features
|
#include <Base/Reader.h>
|
||||||
#include <Mod/Part/App/TopoShape.h>
|
#include <Mod/Part/App/TopoShape.h>
|
||||||
|
|
||||||
#include "FeatureFillet.h"
|
#include "FeatureFillet.h"
|
||||||
|
@ -69,10 +74,11 @@ App::DocumentObjectExecReturn *Fillet::execute(void)
|
||||||
} catch (Base::Exception& e) {
|
} catch (Base::Exception& e) {
|
||||||
return new App::DocumentObjectExecReturn(e.what());
|
return new App::DocumentObjectExecReturn(e.what());
|
||||||
}
|
}
|
||||||
|
std::vector<std::string> SubNames = std::vector<std::string>(Base.getSubValues());
|
||||||
|
getContiniusEdges(TopShape, SubNames);
|
||||||
|
|
||||||
const std::vector<std::string>& SubVals = Base.getSubValuesStartsWith("Edge");
|
if (SubNames.size() == 0)
|
||||||
if (SubVals.size() == 0)
|
return new App::DocumentObjectExecReturn("Fillet not possible on selected shapes");
|
||||||
return new App::DocumentObjectExecReturn("No edges specified");
|
|
||||||
|
|
||||||
double radius = Radius.getValue();
|
double radius = Radius.getValue();
|
||||||
|
|
||||||
|
@ -84,7 +90,7 @@ App::DocumentObjectExecReturn *Fillet::execute(void)
|
||||||
try {
|
try {
|
||||||
BRepFilletAPI_MakeFillet mkFillet(baseShape._Shape);
|
BRepFilletAPI_MakeFillet mkFillet(baseShape._Shape);
|
||||||
|
|
||||||
for (std::vector<std::string>::const_iterator it=SubVals.begin(); it != SubVals.end(); ++it) {
|
for (std::vector<std::string>::const_iterator it=SubNames.begin(); it != SubNames.end(); ++it) {
|
||||||
TopoDS_Edge edge = TopoDS::Edge(baseShape.getSubShape(it->c_str()));
|
TopoDS_Edge edge = TopoDS::Edge(baseShape.getSubShape(it->c_str()));
|
||||||
mkFillet.Add(radius, edge);
|
mkFillet.Add(radius, edge);
|
||||||
}
|
}
|
||||||
|
@ -97,6 +103,12 @@ App::DocumentObjectExecReturn *Fillet::execute(void)
|
||||||
if (shape.IsNull())
|
if (shape.IsNull())
|
||||||
return new App::DocumentObjectExecReturn("Resulting shape is null");
|
return new App::DocumentObjectExecReturn("Resulting shape is null");
|
||||||
|
|
||||||
|
TopTools_ListOfShape aLarg;
|
||||||
|
aLarg.Append(baseShape._Shape);
|
||||||
|
if (!BRepAlgo::IsValid(aLarg, shape, Standard_False, Standard_False)) {
|
||||||
|
return new App::DocumentObjectExecReturn("Resulting shape is invalid");
|
||||||
|
}
|
||||||
|
|
||||||
this->Shape.setValue(shape);
|
this->Shape.setValue(shape);
|
||||||
return App::DocumentObject::StdReturn;
|
return App::DocumentObject::StdReturn;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1269,78 +1269,7 @@ void makeChamferOrFillet(Gui::Command* cmd, const std::string& which)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Part::TopoShape& TopShape = base->Shape.getShape();
|
|
||||||
if (TopShape._Shape.IsNull()){
|
|
||||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"),
|
|
||||||
QObject::tr("Shape of selected part is empty."));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
TopTools_IndexedMapOfShape mapOfEdges;
|
|
||||||
TopTools_IndexedDataMapOfShapeListOfShape mapEdgeFace;
|
|
||||||
TopExp::MapShapesAndAncestors(TopShape._Shape, TopAbs_EDGE, TopAbs_FACE, mapEdgeFace);
|
|
||||||
TopExp::MapShapes(TopShape._Shape, TopAbs_EDGE, mapOfEdges);
|
|
||||||
|
|
||||||
std::vector<std::string> SubNames = std::vector<std::string>(selection[0].getSubNames());
|
std::vector<std::string> SubNames = std::vector<std::string>(selection[0].getSubNames());
|
||||||
|
|
||||||
unsigned int i = 0;
|
|
||||||
|
|
||||||
while(i < SubNames.size())
|
|
||||||
{
|
|
||||||
std::string aSubName = static_cast<std::string>(SubNames.at(i));
|
|
||||||
|
|
||||||
if (aSubName.size() > 4 && aSubName.substr(0,4) == "Edge") {
|
|
||||||
TopoDS_Edge edge = TopoDS::Edge(TopShape.getSubShape(aSubName.c_str()));
|
|
||||||
const TopTools_ListOfShape& los = mapEdgeFace.FindFromKey(edge);
|
|
||||||
|
|
||||||
if(los.Extent() != 2)
|
|
||||||
{
|
|
||||||
SubNames.erase(SubNames.begin()+i);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const TopoDS_Shape& face1 = los.First();
|
|
||||||
const TopoDS_Shape& face2 = los.Last();
|
|
||||||
GeomAbs_Shape cont = BRep_Tool::Continuity(TopoDS::Edge(edge),
|
|
||||||
TopoDS::Face(face1),
|
|
||||||
TopoDS::Face(face2));
|
|
||||||
if (cont != GeomAbs_C0) {
|
|
||||||
SubNames.erase(SubNames.begin()+i);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
else if(aSubName.size() > 4 && aSubName.substr(0,4) == "Face") {
|
|
||||||
TopoDS_Face face = TopoDS::Face(TopShape.getSubShape(aSubName.c_str()));
|
|
||||||
|
|
||||||
TopTools_IndexedMapOfShape mapOfFaces;
|
|
||||||
TopExp::MapShapes(face, TopAbs_EDGE, mapOfFaces);
|
|
||||||
|
|
||||||
for(int j = 1; j <= mapOfFaces.Extent(); ++j) {
|
|
||||||
TopoDS_Edge edge = TopoDS::Edge(mapOfFaces.FindKey(j));
|
|
||||||
|
|
||||||
int id = mapOfEdges.FindIndex(edge);
|
|
||||||
|
|
||||||
std::stringstream buf;
|
|
||||||
buf << "Edge";
|
|
||||||
buf << id;
|
|
||||||
|
|
||||||
if(std::find(SubNames.begin(),SubNames.end(),buf.str()) == SubNames.end())
|
|
||||||
{
|
|
||||||
SubNames.push_back(buf.str());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
SubNames.erase(SubNames.begin()+i);
|
|
||||||
}
|
|
||||||
// empty name or any other sub-element
|
|
||||||
else {
|
|
||||||
SubNames.erase(SubNames.begin()+i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SubNames.size() == 0) {
|
if (SubNames.size() == 0) {
|
||||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"),
|
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"),
|
||||||
QString::fromStdString(which) + QObject::tr(" not possible on selected faces/edges."));
|
QString::fromStdString(which) + QObject::tr(" not possible on selected faces/edges."));
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -51,7 +51,7 @@ using namespace Gui;
|
||||||
/* TRANSLATOR PartDesignGui::TaskChamferParameters */
|
/* TRANSLATOR PartDesignGui::TaskChamferParameters */
|
||||||
|
|
||||||
TaskChamferParameters::TaskChamferParameters(ViewProviderDressUp *DressUpView,QWidget *parent)
|
TaskChamferParameters::TaskChamferParameters(ViewProviderDressUp *DressUpView,QWidget *parent)
|
||||||
: TaskDressUpParameters(DressUpView, parent)
|
: TaskDressUpParameters(DressUpView, true, true, parent)
|
||||||
{
|
{
|
||||||
// we need a separate container widget to add all controls to
|
// we need a separate container widget to add all controls to
|
||||||
proxy = new QWidget(this);
|
proxy = new QWidget(this);
|
||||||
|
|
|
@ -51,7 +51,7 @@ using namespace Gui;
|
||||||
/* TRANSLATOR PartDesignGui::TaskDraftParameters */
|
/* TRANSLATOR PartDesignGui::TaskDraftParameters */
|
||||||
|
|
||||||
TaskDraftParameters::TaskDraftParameters(ViewProviderDressUp *DressUpView,QWidget *parent)
|
TaskDraftParameters::TaskDraftParameters(ViewProviderDressUp *DressUpView,QWidget *parent)
|
||||||
: TaskDressUpParameters(DressUpView, parent)
|
: TaskDressUpParameters(DressUpView, false, true, parent)
|
||||||
{
|
{
|
||||||
// we need a separate container widget to add all controls to
|
// we need a separate container widget to add all controls to
|
||||||
proxy = new QWidget(this);
|
proxy = new QWidget(this);
|
||||||
|
|
|
@ -50,8 +50,9 @@ using namespace Gui;
|
||||||
|
|
||||||
/* TRANSLATOR PartDesignGui::TaskDressUpParameters */
|
/* TRANSLATOR PartDesignGui::TaskDressUpParameters */
|
||||||
|
|
||||||
TaskDressUpParameters::TaskDressUpParameters(ViewProviderDressUp *DressUpView,QWidget *parent)
|
TaskDressUpParameters::TaskDressUpParameters(ViewProviderDressUp *DressUpView, bool selectEdges, bool selectFaces, QWidget *parent)
|
||||||
: TaskBox(Gui::BitmapFactory().pixmap((std::string("PartDesign_") + DressUpView->featureName).c_str()),
|
: allowFaces(selectFaces), allowEdges(selectEdges),
|
||||||
|
TaskBox(Gui::BitmapFactory().pixmap((std::string("PartDesign_") + DressUpView->featureName).c_str()),
|
||||||
QString::fromAscii((DressUpView->featureName + " parameters").c_str()),
|
QString::fromAscii((DressUpView->featureName + " parameters").c_str()),
|
||||||
true,
|
true,
|
||||||
parent),
|
parent),
|
||||||
|
@ -113,9 +114,7 @@ void TaskDressUpParameters::onButtonRefAdd(bool checked)
|
||||||
hideObject();
|
hideObject();
|
||||||
selectionMode = refAdd;
|
selectionMode = refAdd;
|
||||||
Gui::Selection().clearSelection();
|
Gui::Selection().clearSelection();
|
||||||
bool edge = (DressUpView->featureName != "Draft");
|
Gui::Selection().addSelectionGate(new ReferenceSelection(this->getBase(), allowEdges, allowFaces, false));
|
||||||
bool face = (DressUpView->featureName == "Draft");
|
|
||||||
Gui::Selection().addSelectionGate(new ReferenceSelection(this->getBase(), edge, face, false));
|
|
||||||
DressUpView->highlightReferences(true);
|
DressUpView->highlightReferences(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,9 +126,7 @@ void TaskDressUpParameters::onButtonRefRemove(const bool checked)
|
||||||
hideObject();
|
hideObject();
|
||||||
selectionMode = refRemove;
|
selectionMode = refRemove;
|
||||||
Gui::Selection().clearSelection();
|
Gui::Selection().clearSelection();
|
||||||
bool edge = (DressUpView->featureName != "Draft");
|
Gui::Selection().addSelectionGate(new ReferenceSelection(this->getBase(), allowEdges, allowFaces, false));
|
||||||
bool face = (DressUpView->featureName == "Draft");
|
|
||||||
Gui::Selection().addSelectionGate(new ReferenceSelection(this->getBase(), edge, face, false));
|
|
||||||
DressUpView->highlightReferences(true);
|
DressUpView->highlightReferences(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ class TaskDressUpParameters : public Gui::TaskView::TaskBox, public Gui::Selecti
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TaskDressUpParameters(ViewProviderDressUp *DressUpView, QWidget *parent=0);
|
TaskDressUpParameters(ViewProviderDressUp *DressUpView, bool selectEdges, bool selectFaces, QWidget* parent = 0);
|
||||||
virtual ~TaskDressUpParameters();
|
virtual ~TaskDressUpParameters();
|
||||||
|
|
||||||
const std::vector<std::string> getReferences(void) const;
|
const std::vector<std::string> getReferences(void) const;
|
||||||
|
@ -73,6 +73,7 @@ protected:
|
||||||
QWidget* proxy;
|
QWidget* proxy;
|
||||||
ViewProviderDressUp *DressUpView;
|
ViewProviderDressUp *DressUpView;
|
||||||
|
|
||||||
|
bool allowFaces, allowEdges;
|
||||||
selectionModes selectionMode;
|
selectionModes selectionMode;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ using namespace Gui;
|
||||||
/* TRANSLATOR PartDesignGui::TaskFilletParameters */
|
/* TRANSLATOR PartDesignGui::TaskFilletParameters */
|
||||||
|
|
||||||
TaskFilletParameters::TaskFilletParameters(ViewProviderDressUp *DressUpView,QWidget *parent)
|
TaskFilletParameters::TaskFilletParameters(ViewProviderDressUp *DressUpView,QWidget *parent)
|
||||||
: TaskDressUpParameters(DressUpView, parent)
|
: TaskDressUpParameters(DressUpView, true, true, parent)
|
||||||
{
|
{
|
||||||
// we need a separate container widget to add all controls to
|
// we need a separate container widget to add all controls to
|
||||||
proxy = new QWidget(this);
|
proxy = new QWidget(this);
|
||||||
|
|
|
@ -115,7 +115,8 @@ void ViewProviderDressUp::highlightReferences(const bool on)
|
||||||
colors[idx] = App::Color(1.0,0.0,1.0); // magenta
|
colors[idx] = App::Color(1.0,0.0,1.0); // magenta
|
||||||
}
|
}
|
||||||
vp->DiffuseColor.setValues(colors);
|
vp->DiffuseColor.setValues(colors);
|
||||||
} else if (!edges.empty() && originalLineColors.empty()) {
|
}
|
||||||
|
if (!edges.empty() && originalLineColors.empty()) {
|
||||||
TopTools_IndexedMapOfShape eMap;
|
TopTools_IndexedMapOfShape eMap;
|
||||||
TopExp::MapShapes(base->Shape.getValue(), TopAbs_EDGE, eMap);
|
TopExp::MapShapes(base->Shape.getValue(), TopAbs_EDGE, eMap);
|
||||||
originalLineColors = vp->LineColorArray.getValues();
|
originalLineColors = vp->LineColorArray.getValues();
|
||||||
|
@ -133,7 +134,8 @@ void ViewProviderDressUp::highlightReferences(const bool on)
|
||||||
if (!faces.empty() && !originalFaceColors.empty()) {
|
if (!faces.empty() && !originalFaceColors.empty()) {
|
||||||
vp->DiffuseColor.setValues(originalFaceColors);
|
vp->DiffuseColor.setValues(originalFaceColors);
|
||||||
originalFaceColors.clear();
|
originalFaceColors.clear();
|
||||||
} else if (!edges.empty() && !originalLineColors.empty()) {
|
}
|
||||||
|
if (!edges.empty() && !originalLineColors.empty()) {
|
||||||
vp->LineColorArray.setValues(originalLineColors);
|
vp->LineColorArray.setValues(originalLineColors);
|
||||||
originalLineColors.clear();
|
originalLineColors.clear();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user