Part: modernize C++: use range-based for loop
This commit is contained in:
@@ -2124,10 +2124,10 @@ private:
|
||||
tEdgeClusterVector aclusteroutput = acluster.GetClusters();
|
||||
|
||||
Py::List root_list;
|
||||
for (tEdgeClusterVector::iterator it=aclusteroutput.begin(); it != aclusteroutput.end();++it) {
|
||||
for (const auto & it : aclusteroutput) {
|
||||
Py::List add_list;
|
||||
for (tEdgeVector::iterator it1=(*it).begin();it1 != (*it).end();++it1) {
|
||||
add_list.append(Py::Object(new TopoShapeEdgePy(new TopoShape(*it1)),true));
|
||||
for (const auto& it1 : it) {
|
||||
add_list.append(Py::Object(new TopoShapeEdgePy(new TopoShape(it1)),true));
|
||||
}
|
||||
root_list.append(add_list);
|
||||
}
|
||||
@@ -2160,8 +2160,8 @@ private:
|
||||
|
||||
std::list<TopoDS_Edge> sorted = sort_Edges(Precision::Confusion(), edges);
|
||||
Py::List sorted_list;
|
||||
for (std::list<TopoDS_Edge>::iterator it = sorted.begin(); it != sorted.end(); ++it) {
|
||||
sorted_list.append(Py::Object(new TopoShapeEdgePy(new TopoShape(*it)),true));
|
||||
for (const auto & it : sorted) {
|
||||
sorted_list.append(Py::Object(new TopoShapeEdgePy(new TopoShape(it)),true));
|
||||
}
|
||||
|
||||
return sorted_list;
|
||||
@@ -2195,8 +2195,8 @@ private:
|
||||
while(!edges.empty()) {
|
||||
std::list<TopoDS_Edge> sorted = sort_Edges(tol3d, edges);
|
||||
Py::List sorted_list;
|
||||
for (std::list<TopoDS_Edge>::iterator it = sorted.begin(); it != sorted.end(); ++it) {
|
||||
sorted_list.append(Py::Object(new TopoShapeEdgePy(new TopoShape(*it)),true));
|
||||
for (const auto & it : sorted) {
|
||||
sorted_list.append(Py::Object(new TopoShapeEdgePy(new TopoShape(it)),true));
|
||||
}
|
||||
root_list.append(sorted_list);
|
||||
}
|
||||
|
||||
@@ -344,9 +344,8 @@ void AttachEngine::suggestMapModes(SuggestResult &result) const
|
||||
if (! this->modeEnabled[iMode])
|
||||
continue;
|
||||
const refTypeStringList &listStrings = modeRefTypes[iMode];
|
||||
for (std::size_t iStr = 0; iStr < listStrings.size(); ++iStr) {
|
||||
for (const auto & str : listStrings) {
|
||||
int score = 1; //-1 = topo incompatible, 0 = topo compatible, geom incompatible; 1+ = compatible (the higher - the more specific is the mode for the support)
|
||||
const refTypeString &str = listStrings[iStr];
|
||||
for (std::size_t iChr = 0; iChr < str.size() && iChr < typeStr.size(); ++iChr) {
|
||||
int match = AttachEngine::isShapeOfType(typeStr[iChr], str[iChr]);
|
||||
switch(match){
|
||||
@@ -1345,8 +1344,8 @@ Base::Placement AttachEngine3D::calculateAttachedPlacement(const Base::Placement
|
||||
|
||||
std::vector<gp_Pnt> points;
|
||||
|
||||
for (std::size_t i = 0; i < shapes.size(); i++) {
|
||||
const TopoDS_Shape &sh = *shapes[i];
|
||||
for (const auto & shape : shapes) {
|
||||
const TopoDS_Shape &sh = *shape;
|
||||
if (sh.IsNull())
|
||||
throw Base::ValueError("Null shape in AttachEngine3D::calculateAttachedPlacement()!");
|
||||
if (sh.ShapeType() == TopAbs_VERTEX){
|
||||
@@ -1807,8 +1806,8 @@ Base::Placement AttachEngineLine::calculateAttachedPlacement(const Base::Placeme
|
||||
case mm1TwoPoints:{
|
||||
std::vector<gp_Pnt> points;
|
||||
|
||||
for (std::size_t i = 0; i < shapes.size(); i++) {
|
||||
const TopoDS_Shape &sh = *shapes[i];
|
||||
for (const auto & shape : shapes) {
|
||||
const TopoDS_Shape &sh = *shape;
|
||||
if (sh.IsNull())
|
||||
throw Base::ValueError("Null shape in AttachEngineLine::calculateAttachedPlacement()!");
|
||||
if (sh.ShapeType() == TopAbs_VERTEX){
|
||||
|
||||
@@ -775,9 +775,9 @@ PyObject* BSplineCurvePy::toBiArcs(PyObject * args)
|
||||
arcs = curve->toBiArcs(tolerance);
|
||||
|
||||
Py::List list;
|
||||
for (std::list<Geometry*>::iterator it = arcs.begin(); it != arcs.end(); ++it) {
|
||||
list.append(Py::asObject((*it)->getPyObject()));
|
||||
delete (*it);
|
||||
for (auto arc : arcs) {
|
||||
list.append(Py::asObject(arc->getPyObject()));
|
||||
delete arc;
|
||||
}
|
||||
|
||||
return Py::new_reference_to(list);
|
||||
|
||||
@@ -47,8 +47,8 @@ BodyBase* BodyBase::findBodyOf(const App::DocumentObject* f)
|
||||
App::Document* doc = f->getDocument();
|
||||
if (doc) {
|
||||
std::vector<App::DocumentObject*> bodies = doc->getObjectsOfType(BodyBase::getClassTypeId());
|
||||
for (std::vector<App::DocumentObject*>::const_iterator b = bodies.begin(); b != bodies.end(); b++) {
|
||||
BodyBase* body = static_cast<BodyBase*>(*b);
|
||||
for (auto it : bodies) {
|
||||
BodyBase* body = static_cast<BodyBase*>(it);
|
||||
if (body->hasObject(f))
|
||||
return body;
|
||||
}
|
||||
|
||||
@@ -284,8 +284,8 @@ void ExtrusionHelper::makeDraft(const TopoDS_Shape& shape,
|
||||
}
|
||||
else
|
||||
// we already have the results
|
||||
for (auto it = shells.begin(); it != shells.end(); ++it)
|
||||
drafts.push_back(*it);
|
||||
for (const auto & shell : shells)
|
||||
drafts.push_back(shell);
|
||||
}
|
||||
else { // no solid
|
||||
BRepBuilderAPI_Sewing sewer;
|
||||
|
||||
@@ -167,8 +167,8 @@ TopoDS_Shape FaceMakerCheese::makeFace(std::list<TopoDS_Wire>& wires)
|
||||
}
|
||||
|
||||
wires.pop_front();
|
||||
for (std::list<TopoDS_Wire>::iterator it = wires.begin(); it != wires.end(); ++it) {
|
||||
BRepBuilderAPI_MakeFace mkInnerFace(*it);
|
||||
for (auto wire : wires) {
|
||||
BRepBuilderAPI_MakeFace mkInnerFace(wire);
|
||||
const TopoDS_Face& inner_face = mkInnerFace.Face();
|
||||
if (inner_face.IsNull())
|
||||
return inner_face; // failure
|
||||
@@ -180,8 +180,8 @@ TopoDS_Shape FaceMakerCheese::makeFace(std::list<TopoDS_Wire>& wires)
|
||||
// It seems that orientation is always 'Forward' and we only have to reverse
|
||||
// if the underlying plane have opposite normals.
|
||||
if (axis.Dot(inner_axis) < 0)
|
||||
it->Reverse();
|
||||
mkFace.Add(*it);
|
||||
wire.Reverse();
|
||||
mkFace.Add(wire);
|
||||
}
|
||||
return validateFace(mkFace.Face());
|
||||
}
|
||||
@@ -228,8 +228,8 @@ TopoDS_Shape FaceMakerCheese::makeFace(const std::vector<TopoDS_Wire>& w)
|
||||
TopoDS_Compound comp;
|
||||
BRep_Builder builder;
|
||||
builder.MakeCompound(comp);
|
||||
for (std::list< std::list<TopoDS_Wire> >::iterator it = sep_wire_list.begin(); it != sep_wire_list.end(); ++it) {
|
||||
TopoDS_Shape aFace = makeFace(*it);
|
||||
for (auto & it : sep_wire_list) {
|
||||
TopoDS_Shape aFace = makeFace(it);
|
||||
if (!aFace.IsNull())
|
||||
builder.Add(comp, aFace);
|
||||
}
|
||||
|
||||
@@ -57,10 +57,10 @@ App::DocumentObjectExecReturn *Chamfer::execute()
|
||||
TopExp::MapShapes(baseShape, TopAbs_EDGE, mapOfEdges);
|
||||
|
||||
std::vector<FilletElement> values = Edges.getValues();
|
||||
for (std::vector<FilletElement>::iterator it = values.begin(); it != values.end(); ++it) {
|
||||
int id = it->edgeid;
|
||||
double radius1 = it->radius1;
|
||||
double radius2 = it->radius2;
|
||||
for (const auto & value : values) {
|
||||
int id = value.edgeid;
|
||||
double radius1 = value.radius1;
|
||||
double radius2 = value.radius2;
|
||||
const TopoDS_Edge& edge = TopoDS::Edge(mapOfEdges.FindKey(id));
|
||||
const TopoDS_Face& face = TopoDS::Face(mapEdgeFace.FindFromKey(edge).First());
|
||||
mkChamfer.Add(radius1, radius2, edge, face);
|
||||
|
||||
@@ -68,11 +68,11 @@ App::DocumentObjectExecReturn *Compound::execute()
|
||||
std::set<DocumentObject*> tempLinks;
|
||||
|
||||
const std::vector<DocumentObject*>& links = Links.getValues();
|
||||
for (std::vector<DocumentObject*>::const_iterator it = links.begin(); it != links.end(); ++it) {
|
||||
if (*it) {
|
||||
auto pos = tempLinks.insert(*it);
|
||||
for (auto link : links) {
|
||||
if (link) {
|
||||
auto pos = tempLinks.insert(link);
|
||||
if (pos.second) {
|
||||
const TopoDS_Shape& sh = Feature::getShape(*it);
|
||||
const TopoDS_Shape& sh = Feature::getShape(link);
|
||||
if (!sh.IsNull()) {
|
||||
builder.Add(comp, sh);
|
||||
TopTools_IndexedMapOfShape faceMap;
|
||||
|
||||
@@ -260,8 +260,8 @@ TopoShape Extrusion::extrudeShape(const TopoShape& source, const Extrusion::Extr
|
||||
TopoDS_Compound comp;
|
||||
BRep_Builder builder;
|
||||
builder.MakeCompound(comp);
|
||||
for (std::list<TopoDS_Shape>::iterator it = drafts.begin(); it != drafts.end(); ++it)
|
||||
builder.Add(comp, *it);
|
||||
for (const auto & draft : drafts)
|
||||
builder.Add(comp, draft);
|
||||
result = comp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,10 +61,10 @@ App::DocumentObjectExecReturn *Fillet::execute()
|
||||
TopExp::MapShapes(baseShape, TopAbs_EDGE, mapOfShape);
|
||||
|
||||
std::vector<FilletElement> values = Edges.getValues();
|
||||
for (std::vector<FilletElement>::iterator it = values.begin(); it != values.end(); ++it) {
|
||||
int id = it->edgeid;
|
||||
double radius1 = it->radius1;
|
||||
double radius2 = it->radius2;
|
||||
for (const auto & value : values) {
|
||||
int id = value.edgeid;
|
||||
double radius1 = value.radius1;
|
||||
double radius2 = value.radius2;
|
||||
const TopoDS_Edge& edge = TopoDS::Edge(mapOfShape.FindKey(id));
|
||||
mkFillet.Add(radius1, radius2, edge);
|
||||
}
|
||||
|
||||
@@ -44,8 +44,8 @@ App::DocumentObjectExecReturn *FeatureGeometrySet::execute()
|
||||
const std::vector<Geometry*> &Geoms = GeometrySet.getValues();
|
||||
|
||||
bool first = true;
|
||||
for(std::vector<Geometry*>::const_iterator it=Geoms.begin();it!=Geoms.end();++it){
|
||||
TopoDS_Shape sh = (*it)->toShape();
|
||||
for(auto Geom : Geoms) {
|
||||
TopoDS_Shape sh = Geom->toShape();
|
||||
if (first) {
|
||||
first = false;
|
||||
result.setShape(sh);
|
||||
|
||||
@@ -132,8 +132,8 @@ App::DocumentObjectExecReturn *MultiCommon::execute()
|
||||
history.push_back(hist2);
|
||||
}
|
||||
else {
|
||||
for (std::vector<ShapeHistory>::iterator jt = history.begin(); jt != history.end(); ++jt)
|
||||
*jt = joinHistory(*jt, hist1);
|
||||
for (auto & jt : history)
|
||||
jt = joinHistory(jt, hist1);
|
||||
history.push_back(hist2);
|
||||
}
|
||||
}
|
||||
@@ -154,8 +154,8 @@ App::DocumentObjectExecReturn *MultiCommon::execute()
|
||||
BRepBuilderAPI_RefineModel mkRefine(oldShape);
|
||||
resShape = mkRefine.Shape();
|
||||
ShapeHistory hist = buildHistory(mkRefine, TopAbs_FACE, resShape, oldShape);
|
||||
for (std::vector<ShapeHistory>::iterator jt = history.begin(); jt != history.end(); ++jt)
|
||||
*jt = joinHistory(*jt, hist);
|
||||
for (auto & jt : history)
|
||||
jt = joinHistory(jt, hist);
|
||||
}
|
||||
catch (Standard_Failure&) {
|
||||
// do nothing
|
||||
|
||||
@@ -131,8 +131,8 @@ App::DocumentObjectExecReturn *MultiFuse::execute()
|
||||
throw Base::RuntimeError("MultiFusion failed");
|
||||
|
||||
TopoDS_Shape resShape = mkFuse.Shape();
|
||||
for (std::vector<TopoDS_Shape>::iterator it = s.begin(); it != s.end(); ++it) {
|
||||
history.push_back(buildHistory(mkFuse, TopAbs_FACE, resShape, *it));
|
||||
for (const auto & it : s) {
|
||||
history.push_back(buildHistory(mkFuse, TopAbs_FACE, resShape, it));
|
||||
}
|
||||
if (resShape.IsNull())
|
||||
throw Base::RuntimeError("Resulting shape is null");
|
||||
@@ -151,8 +151,8 @@ App::DocumentObjectExecReturn *MultiFuse::execute()
|
||||
BRepBuilderAPI_RefineModel mkRefine(oldShape);
|
||||
resShape = mkRefine.Shape();
|
||||
ShapeHistory hist = buildHistory(mkRefine, TopAbs_FACE, resShape, oldShape);
|
||||
for (std::vector<ShapeHistory>::iterator jt = history.begin(); jt != history.end(); ++jt)
|
||||
*jt = joinHistory(*jt, hist);
|
||||
for (auto & jt : history)
|
||||
jt = joinHistory(jt, hist);
|
||||
}
|
||||
catch (Standard_Failure&) {
|
||||
// do nothing
|
||||
|
||||
@@ -55,8 +55,8 @@ App::DocumentObjectExecReturn *Part::Polygon::execute()
|
||||
BRepBuilderAPI_MakePolygon poly;
|
||||
const std::vector<Base::Vector3d> nodes = Nodes.getValues();
|
||||
|
||||
for (std::vector<Base::Vector3d>::const_iterator it = nodes.begin(); it != nodes.end(); ++it) {
|
||||
gp_Pnt pnt(it->x, it->y, it->z);
|
||||
for (const auto & node : nodes) {
|
||||
gp_Pnt pnt(node.x, node.y, node.z);
|
||||
poly.Add(pnt);
|
||||
}
|
||||
|
||||
|
||||
@@ -711,9 +711,9 @@ PyObject* BSplineCurve2dPy::toBiArcs(PyObject * args)
|
||||
arcs = curve->toBiArcs(tolerance);
|
||||
|
||||
Py::List list;
|
||||
for (std::list<Geometry2d*>::iterator it = arcs.begin(); it != arcs.end(); ++it) {
|
||||
list.append(Py::asObject((*it)->getPyObject()));
|
||||
delete (*it);
|
||||
for (auto arc : arcs) {
|
||||
list.append(Py::asObject(arc->getPyObject()));
|
||||
delete arc;
|
||||
}
|
||||
|
||||
return Py::new_reference_to(list);
|
||||
|
||||
@@ -1093,8 +1093,8 @@ PyObject* GeometryCurvePy::intersectCC(PyObject *args)
|
||||
}
|
||||
|
||||
Py::List points;
|
||||
for (size_t i = 0; i < pairs.size(); i++) {
|
||||
points.append(Py::asObject(new PointPy(new GeomPoint(pairs[i].first))));
|
||||
for (const auto & pair : pairs) {
|
||||
points.append(Py::asObject(new PointPy(new GeomPoint(pair.first))));
|
||||
}
|
||||
|
||||
return Py::new_reference_to(points);
|
||||
|
||||
@@ -399,10 +399,10 @@ PyObject* GeometryPy::getExtensions(PyObject *args)
|
||||
|
||||
Py::List list;
|
||||
|
||||
for (std::size_t i=0; i<ext.size(); ++i) {
|
||||
for (const auto & it : ext) {
|
||||
|
||||
// const casting only to get the Python object to make a copy
|
||||
std::shared_ptr<GeometryExtension> p = std::const_pointer_cast<GeometryExtension>(ext[i].lock());
|
||||
std::shared_ptr<GeometryExtension> p = std::const_pointer_cast<GeometryExtension>(it.lock());
|
||||
|
||||
if(p) {
|
||||
// we create a python copy and add it to the list
|
||||
|
||||
@@ -599,12 +599,12 @@ ShapeHistory Feature::joinHistory(const ShapeHistory& oldH, const ShapeHistory&
|
||||
ShapeHistory join;
|
||||
join.type = oldH.type;
|
||||
|
||||
for (ShapeHistory::MapList::const_iterator it = oldH.shapeMap.begin(); it != oldH.shapeMap.end(); ++it) {
|
||||
int old_shape_index = it->first;
|
||||
if (it->second.empty())
|
||||
for (const auto & it : oldH.shapeMap) {
|
||||
int old_shape_index = it.first;
|
||||
if (it.second.empty())
|
||||
join.shapeMap[old_shape_index] = ShapeHistory::List();
|
||||
for (ShapeHistory::List::const_iterator jt = it->second.begin(); jt != it->second.end(); ++jt) {
|
||||
ShapeHistory::MapList::const_iterator kt = newH.shapeMap.find(*jt);
|
||||
for (const auto& jt : it.second) {
|
||||
const auto& kt = newH.shapeMap.find(jt);
|
||||
if (kt != newH.shapeMap.end()) {
|
||||
ShapeHistory::List& ary = join.shapeMap[old_shape_index];
|
||||
ary.insert(ary.end(), kt->second.begin(), kt->second.end());
|
||||
|
||||
@@ -409,8 +409,8 @@ App::DocumentObjectExecReturn *Sweep::execute()
|
||||
try {
|
||||
if (!subedge.empty()) {
|
||||
BRepBuilderAPI_MakeWire mkWire;
|
||||
for (std::vector<std::string>::const_iterator it = subedge.begin(); it != subedge.end(); ++it) {
|
||||
TopoDS_Shape subshape = Feature::getTopoShape(spine, it->c_str(), true /*need element*/).getShape();
|
||||
for (const auto & it : subedge) {
|
||||
TopoDS_Shape subshape = Feature::getTopoShape(spine, it.c_str(), true /*need element*/).getShape();
|
||||
mkWire.Add(TopoDS::Edge(subshape));
|
||||
}
|
||||
path = mkWire.Wire();
|
||||
@@ -635,8 +635,8 @@ App::DocumentObjectExecReturn *Thickness::execute()
|
||||
|
||||
TopTools_ListOfShape closingFaces;
|
||||
const std::vector<std::string>& subStrings = Faces.getSubValues();
|
||||
for (std::vector<std::string>::const_iterator it = subStrings.begin(); it != subStrings.end(); ++it) {
|
||||
TopoDS_Face face = TopoDS::Face(shape.getSubShape(it->c_str()));
|
||||
for (const auto & it : subStrings) {
|
||||
TopoDS_Face face = TopoDS::Face(shape.getSubShape(it.c_str()));
|
||||
closingFaces.Append(face);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,8 +54,9 @@ PropertyGeometryList::PropertyGeometryList()
|
||||
|
||||
PropertyGeometryList::~PropertyGeometryList()
|
||||
{
|
||||
for (std::vector<Geometry*>::iterator it = _lValueList.begin(); it != _lValueList.end(); ++it)
|
||||
if (*it) delete *it;
|
||||
for (auto it : _lValueList) {
|
||||
if (it) delete it;
|
||||
}
|
||||
}
|
||||
|
||||
void PropertyGeometryList::setSize(int newSize)
|
||||
@@ -75,8 +76,8 @@ void PropertyGeometryList::setValue(const Geometry* lValue)
|
||||
if (lValue) {
|
||||
aboutToSetValue();
|
||||
Geometry* newVal = lValue->clone();
|
||||
for (unsigned int i = 0; i < _lValueList.size(); i++)
|
||||
delete _lValueList[i];
|
||||
for (auto it : _lValueList)
|
||||
delete it;
|
||||
_lValueList.resize(1);
|
||||
_lValueList[0] = newVal;
|
||||
hasSetValue();
|
||||
|
||||
@@ -559,8 +559,8 @@ void PropertyFilletEdges::SaveDocFile (Base::Writer &writer) const
|
||||
Base::OutputStream str(writer.Stream());
|
||||
uint32_t uCt = (uint32_t)getSize();
|
||||
str << uCt;
|
||||
for (std::vector<FilletElement>::const_iterator it = _lValueList.begin(); it != _lValueList.end(); ++it) {
|
||||
str << it->edgeid << it->radius1 << it->radius2;
|
||||
for (const auto & it : _lValueList) {
|
||||
str << it.edgeid << it.radius1 << it.radius2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -570,8 +570,8 @@ void PropertyFilletEdges::RestoreDocFile(Base::Reader &reader)
|
||||
uint32_t uCt=0;
|
||||
str >> uCt;
|
||||
std::vector<FilletElement> values(uCt);
|
||||
for (std::vector<FilletElement>::iterator it = values.begin(); it != values.end(); ++it) {
|
||||
str >> it->edgeid >> it->radius1 >> it->radius2;
|
||||
for (auto & it : values) {
|
||||
str >> it.edgeid >> it.radius1 >> it.radius2;
|
||||
}
|
||||
setValues(values);
|
||||
}
|
||||
|
||||
@@ -1537,12 +1537,12 @@ bool TopoShape::analyze(bool runBopCheck, std::ostream& str) const
|
||||
for (int i = 1; i <= compsOfShape.Extent();++i)
|
||||
shapes.push_back(compsOfShape(i));
|
||||
|
||||
for (std::vector<TopoDS_Shape>::iterator xp = shapes.begin(); xp != shapes.end(); ++xp) {
|
||||
if (!aChecker.IsValid(*xp)) {
|
||||
const Handle(BRepCheck_Result)& result = aChecker.Result(*xp);
|
||||
for (const auto & shape : shapes) {
|
||||
if (!aChecker.IsValid(shape)) {
|
||||
const Handle(BRepCheck_Result)& result = aChecker.Result(shape);
|
||||
if (result.IsNull())
|
||||
continue;
|
||||
const BRepCheck_ListOfStatus& status = result->StatusOnShape(*xp);
|
||||
const BRepCheck_ListOfStatus& status = result->StatusOnShape(shape);
|
||||
|
||||
BRepCheck_ListIteratorOfListOfStatus it(status);
|
||||
while (it.More()) {
|
||||
@@ -1776,14 +1776,14 @@ TopoDS_Shape TopoShape::cut(const std::vector<TopoDS_Shape>& shapes, Standard_Re
|
||||
mkCut.SetRunParallel(true);
|
||||
TopTools_ListOfShape shapeArguments,shapeTools;
|
||||
shapeArguments.Append(this->_Shape);
|
||||
for (std::vector<TopoDS_Shape>::const_iterator it = shapes.begin(); it != shapes.end(); ++it) {
|
||||
if (it->IsNull())
|
||||
for (const auto & shape : shapes) {
|
||||
if (shape.IsNull())
|
||||
throw Base::ValueError("Tool shape is null");
|
||||
if (tolerance > 0.0)
|
||||
// workaround for http://dev.opencascade.org/index.php?q=node/1056#comment-520
|
||||
shapeTools.Append(BRepBuilderAPI_Copy(*it).Shape());
|
||||
shapeTools.Append(BRepBuilderAPI_Copy(shape).Shape());
|
||||
else
|
||||
shapeTools.Append(*it);
|
||||
shapeTools.Append(shape);
|
||||
}
|
||||
|
||||
mkCut.SetArguments(shapeArguments);
|
||||
@@ -1816,14 +1816,14 @@ TopoDS_Shape TopoShape::common(const std::vector<TopoDS_Shape>& shapes, Standard
|
||||
mkCommon.SetRunParallel(true);
|
||||
TopTools_ListOfShape shapeArguments,shapeTools;
|
||||
shapeArguments.Append(this->_Shape);
|
||||
for (std::vector<TopoDS_Shape>::const_iterator it = shapes.begin(); it != shapes.end(); ++it) {
|
||||
if (it->IsNull())
|
||||
for (const auto & shape : shapes) {
|
||||
if (shape.IsNull())
|
||||
throw Base::ValueError("Tool shape is null");
|
||||
if (tolerance > 0.0)
|
||||
// workaround for http://dev.opencascade.org/index.php?q=node/1056#comment-520
|
||||
shapeTools.Append(BRepBuilderAPI_Copy(*it).Shape());
|
||||
shapeTools.Append(BRepBuilderAPI_Copy(shape).Shape());
|
||||
else
|
||||
shapeTools.Append(*it);
|
||||
shapeTools.Append(shape);
|
||||
}
|
||||
|
||||
mkCommon.SetArguments(shapeArguments);
|
||||
@@ -1857,14 +1857,14 @@ TopoDS_Shape TopoShape::fuse(const std::vector<TopoDS_Shape>& shapes, Standard_R
|
||||
mkFuse.SetRunParallel(true);
|
||||
TopTools_ListOfShape shapeArguments,shapeTools;
|
||||
shapeArguments.Append(this->_Shape);
|
||||
for (std::vector<TopoDS_Shape>::const_iterator it = shapes.begin(); it != shapes.end(); ++it) {
|
||||
if (it->IsNull())
|
||||
for (const auto & shape : shapes) {
|
||||
if (shape.IsNull())
|
||||
throw NullShapeException("Tool shape is null");
|
||||
if (tolerance > 0.0)
|
||||
// workaround for http://dev.opencascade.org/index.php?q=node/1056#comment-520
|
||||
shapeTools.Append(BRepBuilderAPI_Copy(*it).Shape());
|
||||
shapeTools.Append(BRepBuilderAPI_Copy(shape).Shape());
|
||||
else
|
||||
shapeTools.Append(*it);
|
||||
shapeTools.Append(shape);
|
||||
}
|
||||
mkFuse.SetArguments(shapeArguments);
|
||||
mkFuse.SetTools(shapeTools);
|
||||
@@ -1916,14 +1916,14 @@ TopoDS_Shape TopoShape::section(const std::vector<TopoDS_Shape>& shapes,
|
||||
mkSection.Approximation(approximate);
|
||||
TopTools_ListOfShape shapeArguments,shapeTools;
|
||||
shapeArguments.Append(this->_Shape);
|
||||
for (std::vector<TopoDS_Shape>::const_iterator it = shapes.begin(); it != shapes.end(); ++it) {
|
||||
if (it->IsNull())
|
||||
for (const auto & shape : shapes) {
|
||||
if (shape.IsNull())
|
||||
throw Base::ValueError("Tool shape is null");
|
||||
if (tolerance > 0.0)
|
||||
// workaround for http://dev.opencascade.org/index.php?q=node/1056#comment-520
|
||||
shapeTools.Append(BRepBuilderAPI_Copy(*it).Shape());
|
||||
shapeTools.Append(BRepBuilderAPI_Copy(shape).Shape());
|
||||
else
|
||||
shapeTools.Append(*it);
|
||||
shapeTools.Append(shape);
|
||||
}
|
||||
|
||||
mkSection.SetArguments(shapeArguments);
|
||||
@@ -1948,8 +1948,8 @@ TopoDS_Compound TopoShape::slices(const Base::Vector3d& dir, const std::vector<d
|
||||
{
|
||||
std::vector< std::list<TopoDS_Wire> > wire_list;
|
||||
CrossSection cs(dir.x, dir.y, dir.z, this->_Shape);
|
||||
for (std::vector<double>::const_iterator jt = d.begin(); jt != d.end(); ++jt) {
|
||||
wire_list.push_back(cs.slice(*jt));
|
||||
for (double jt : d) {
|
||||
wire_list.push_back(cs.slice(jt));
|
||||
}
|
||||
|
||||
std::vector< std::list<TopoDS_Wire> >::const_iterator ft;
|
||||
@@ -1959,9 +1959,9 @@ TopoDS_Compound TopoShape::slices(const Base::Vector3d& dir, const std::vector<d
|
||||
|
||||
for (ft = wire_list.begin(); ft != wire_list.end(); ++ft) {
|
||||
const std::list<TopoDS_Wire>& w = *ft;
|
||||
for (std::list<TopoDS_Wire>::const_iterator wt = w.begin(); wt != w.end(); ++wt) {
|
||||
if (!wt->IsNull())
|
||||
builder.Add(comp, *wt);
|
||||
for (const auto & wt : w) {
|
||||
if (!wt.IsNull())
|
||||
builder.Add(comp, wt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3112,8 +3112,8 @@ TopoDS_Shape TopoShape::replaceShape(const std::vector< std::pair<TopoDS_Shape,T
|
||||
TopoDS_Shape TopoShape::removeShape(const std::vector<TopoDS_Shape>& s) const
|
||||
{
|
||||
BRepTools_ReShape reshape;
|
||||
for (std::vector<TopoDS_Shape>::const_iterator it = s.begin(); it != s.end(); ++it)
|
||||
reshape.Remove(*it);
|
||||
for (const auto & it : s)
|
||||
reshape.Remove(it);
|
||||
return reshape.Apply(this->_Shape, TopAbs_SHAPE);
|
||||
}
|
||||
|
||||
@@ -3367,8 +3367,7 @@ void TopoShape::getFacesFromDomains(const std::vector<Domain>& domains,
|
||||
Standard_Real x2, y2, z2;
|
||||
Standard_Real x3, y3, z3;
|
||||
|
||||
for (std::vector<Domain>::const_iterator it = domains.begin(); it != domains.end(); ++it) {
|
||||
const Domain& domain = *it;
|
||||
for (const auto & domain : domains) {
|
||||
for (std::vector<Facet>::const_iterator jt = domain.facets.begin(); jt != domain.facets.end(); ++jt) {
|
||||
x1 = domain.points[jt->I1].x;
|
||||
y1 = domain.points[jt->I1].y;
|
||||
@@ -3431,8 +3430,8 @@ void TopoShape::getFacesFromDomains(const std::vector<Domain>& domains,
|
||||
|
||||
std::vector<Base::Vector3d> meshPoints;
|
||||
meshPoints.resize(vertices.size());
|
||||
for (std::set<MeshVertex>::iterator it = vertices.begin(); it != vertices.end(); ++it)
|
||||
meshPoints[it->i] = it->toPoint();
|
||||
for (const auto & vertex : vertices)
|
||||
meshPoints[vertex.i] = vertex.toPoint();
|
||||
points.swap(meshPoints);
|
||||
}
|
||||
|
||||
@@ -3487,18 +3486,18 @@ void TopoShape::setFaces(const std::vector<Base::Vector3d> &Points,
|
||||
gp_XYZ p(v.x, v.y, v.z);
|
||||
return BRepBuilderAPI_MakeVertex(p);
|
||||
};
|
||||
for (std::vector<Facet>::const_iterator it = Topo.begin(); it != Topo.end(); ++it) {
|
||||
if (it->I1 < ctPoints) {
|
||||
if (Vertexes[it->I1].IsNull())
|
||||
Vertexes[it->I1] = CreateVertex(Points[it->I1]);
|
||||
for (const auto& it : Topo) {
|
||||
if (it.I1 < ctPoints) {
|
||||
if (Vertexes[it.I1].IsNull())
|
||||
Vertexes[it.I1] = CreateVertex(Points[it.I1]);
|
||||
}
|
||||
if (it->I2 < ctPoints) {
|
||||
if (Vertexes[it->I2].IsNull())
|
||||
Vertexes[it->I2] = CreateVertex(Points[it->I2]);
|
||||
if (it.I2 < ctPoints) {
|
||||
if (Vertexes[it.I2].IsNull())
|
||||
Vertexes[it.I2] = CreateVertex(Points[it.I2]);
|
||||
}
|
||||
if (it->I3 < ctPoints) {
|
||||
if (Vertexes[it->I3].IsNull())
|
||||
Vertexes[it->I3] = CreateVertex(Points[it->I3]);
|
||||
if (it.I3 < ctPoints) {
|
||||
if (Vertexes[it.I3].IsNull())
|
||||
Vertexes[it.I3] = CreateVertex(Points[it.I3]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3524,18 +3523,18 @@ void TopoShape::setFaces(const std::vector<Base::Vector3d> &Points,
|
||||
auto key = std::make_pair(p1, p2);
|
||||
return Edges[key];
|
||||
};
|
||||
for (std::vector<Facet>::const_iterator it = Topo.begin(); it != Topo.end(); ++it) {
|
||||
CreateEdge(it->I1, it->I2);
|
||||
CreateEdge(it->I2, it->I3);
|
||||
CreateEdge(it->I3, it->I1);
|
||||
for (const auto& it : Topo) {
|
||||
CreateEdge(it.I1, it.I2);
|
||||
CreateEdge(it.I2, it.I3);
|
||||
CreateEdge(it.I3, it.I1);
|
||||
}
|
||||
|
||||
for (std::vector<Facet>::const_iterator it = Topo.begin(); it != Topo.end(); ++it) {
|
||||
if (it->I1 >= ctPoints || it->I2 >= ctPoints || it->I3 >= ctPoints)
|
||||
for (const auto& it : Topo) {
|
||||
if (it.I1 >= ctPoints || it.I2 >= ctPoints || it.I3 >= ctPoints)
|
||||
continue;
|
||||
x1 = Points[it->I1].x; y1 = Points[it->I1].y; z1 = Points[it->I1].z;
|
||||
x2 = Points[it->I2].x; y2 = Points[it->I2].y; z2 = Points[it->I2].z;
|
||||
x3 = Points[it->I3].x; y3 = Points[it->I3].y; z3 = Points[it->I3].z;
|
||||
x1 = Points[it.I1].x; y1 = Points[it.I1].y; z1 = Points[it.I1].z;
|
||||
x2 = Points[it.I2].x; y2 = Points[it.I2].y; z2 = Points[it.I2].z;
|
||||
x3 = Points[it.I3].x; y3 = Points[it.I3].y; z3 = Points[it.I3].z;
|
||||
|
||||
p1.SetCoord(x1,y1,z1);
|
||||
p2.SetCoord(x2,y2,z2);
|
||||
@@ -3544,9 +3543,9 @@ void TopoShape::setFaces(const std::vector<Base::Vector3d> &Points,
|
||||
// Avoid very tiny edges as this may result into broken faces. The tolerance is Approximation
|
||||
// because Confusion might be too tight.
|
||||
if ((!(p1.IsEqual(p2, Precision::Approximation()))) && (!(p1.IsEqual(p3, Precision::Approximation())))) {
|
||||
const TopoDS_Edge& e1 = GetEdge(it->I1, it->I2);
|
||||
const TopoDS_Edge& e2 = GetEdge(it->I2, it->I3);
|
||||
const TopoDS_Edge& e3 = GetEdge(it->I3, it->I1);
|
||||
const TopoDS_Edge& e1 = GetEdge(it.I1, it.I2);
|
||||
const TopoDS_Edge& e2 = GetEdge(it.I2, it.I3);
|
||||
const TopoDS_Edge& e3 = GetEdge(it.I3, it.I1);
|
||||
if (e1.IsNull() || e2.IsNull() || e3.IsNull())
|
||||
continue;
|
||||
|
||||
@@ -3795,8 +3794,8 @@ TopoDS_Shape TopoShape::defeaturing(const std::vector<TopoDS_Shape>& s) const
|
||||
BRepAlgoAPI_Defeaturing defeat;
|
||||
defeat.SetRunParallel(true);
|
||||
defeat.SetShape(this->_Shape);
|
||||
for (std::vector<TopoDS_Shape>::const_iterator it = s.begin(); it != s.end(); ++it)
|
||||
defeat.AddFaceToRemove(*it);
|
||||
for (const auto & it : s)
|
||||
defeat.AddFaceToRemove(it);
|
||||
defeat.Build();
|
||||
if (!defeat.IsDone()) {
|
||||
// error treatment
|
||||
|
||||
@@ -848,8 +848,8 @@ PyObject* TopoShapeFacePy::cutHoles(PyObject *args)
|
||||
if (!wires.empty()) {
|
||||
const TopoDS_Face& f = TopoDS::Face(getTopoShapePtr()->getShape());
|
||||
BRepBuilderAPI_MakeFace mkFace(f);
|
||||
for (std::vector<TopoDS_Wire>::iterator it = wires.begin(); it != wires.end(); ++it)
|
||||
mkFace.Add(*it);
|
||||
for (const auto & wire : wires)
|
||||
mkFace.Add(wire);
|
||||
if (!mkFace.IsDone()) {
|
||||
switch (mkFace.Error()) {
|
||||
case BRepBuilderAPI_NoFace:
|
||||
|
||||
@@ -1003,8 +1003,8 @@ PyObject* TopoShapePy::slice(PyObject *args)
|
||||
Base::Vector3d vec = Py::Vector(dir, false).toVector();
|
||||
std::list<TopoDS_Wire> slice = this->getTopoShapePtr()->slice(vec, d);
|
||||
Py::List wire;
|
||||
for (std::list<TopoDS_Wire>::iterator it = slice.begin(); it != slice.end(); ++it) {
|
||||
wire.append(Py::asObject(new TopoShapeWirePy(new TopoShape(*it))));
|
||||
for (const auto & it : slice) {
|
||||
wire.append(Py::asObject(new TopoShapeWirePy(new TopoShape(it))));
|
||||
}
|
||||
|
||||
return Py::new_reference_to(wire);
|
||||
@@ -1264,9 +1264,9 @@ static const std::map<PyTypeObject*, TopAbs_ShapeEnum> mapTypeShape(
|
||||
// Returns TopAbs_SHAPE if pyType is not a subclass of any of the TopoShape*Py.
|
||||
static TopAbs_ShapeEnum ShapeTypeFromPyType(PyTypeObject* pyType)
|
||||
{
|
||||
for (auto it = vecTypeShape.begin(); it != vecTypeShape.end(); ++it) {
|
||||
if (PyType_IsSubtype(pyType, it->first))
|
||||
return it->second;
|
||||
for (const auto & it : vecTypeShape) {
|
||||
if (PyType_IsSubtype(pyType, it.first))
|
||||
return it.second;
|
||||
}
|
||||
return TopAbs_SHAPE;
|
||||
}
|
||||
@@ -1938,17 +1938,15 @@ PyObject* TopoShapePy::tessellate(PyObject *args)
|
||||
getTopoShapePtr()->getFaces(Points, Facets,tolerance);
|
||||
Py::Tuple tuple(2);
|
||||
Py::List vertex;
|
||||
for (std::vector<Base::Vector3d>::const_iterator it = Points.begin();
|
||||
it != Points.end(); ++it)
|
||||
vertex.append(Py::asObject(new Base::VectorPy(*it)));
|
||||
for (const auto & Point : Points)
|
||||
vertex.append(Py::asObject(new Base::VectorPy(Point)));
|
||||
tuple.setItem(0, vertex);
|
||||
Py::List facet;
|
||||
for (std::vector<Data::ComplexGeoData::Facet>::const_iterator
|
||||
it = Facets.begin(); it != Facets.end(); ++it) {
|
||||
for (const auto& it : Facets) {
|
||||
Py::Tuple f(3);
|
||||
f.setItem(0,Py::Long((long)it->I1));
|
||||
f.setItem(1,Py::Long((long)it->I2));
|
||||
f.setItem(2,Py::Long((long)it->I3));
|
||||
f.setItem(0,Py::Long((long)it.I1));
|
||||
f.setItem(1,Py::Long((long)it.I2));
|
||||
f.setItem(2,Py::Long((long)it.I3));
|
||||
facet.append(f);
|
||||
}
|
||||
tuple.setItem(1, facet);
|
||||
|
||||
@@ -1082,8 +1082,8 @@ bool FaceUniter::process()
|
||||
// by a boolean cut, where one old shape is marked as modified, producing multiple new shapes
|
||||
if (!temp.empty())
|
||||
{
|
||||
for (FaceVectorType::iterator f = temp.begin(); f != temp.end(); ++f)
|
||||
modifiedShapes.emplace_back(*f, newFace);
|
||||
for (const auto & f : temp)
|
||||
modifiedShapes.emplace_back(f, newFace);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1115,11 +1115,11 @@ bool FaceUniter::process()
|
||||
return false;
|
||||
}
|
||||
// update the list of modifications
|
||||
for (std::vector<ShapePairType>::iterator it = modifiedShapes.begin(); it != modifiedShapes.end(); ++it)
|
||||
for (auto & it : modifiedShapes)
|
||||
{
|
||||
if (sew.IsModified(it->second))
|
||||
if (sew.IsModified(it.second))
|
||||
{
|
||||
it->second = sew.Modified(it->second);
|
||||
it.second = sew.Modified(it.second);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1169,11 +1169,11 @@ bool FaceUniter::process()
|
||||
for (mapIt.Initialize(faceMap); mapIt.More(); mapIt.Next())
|
||||
{
|
||||
bool isModifiedFace = false;
|
||||
for (std::vector<ShapePairType>::iterator it = modifiedShapes.begin(); it != modifiedShapes.end(); ++it)
|
||||
for (auto & it : modifiedShapes)
|
||||
{
|
||||
if (mapIt.Key().IsSame(it->second)) {
|
||||
if (mapIt.Key().IsSame(it.second)) {
|
||||
// Note: IsEqual() for some reason does not work
|
||||
it->second = mapIt.Value();
|
||||
it.second = mapIt.Value();
|
||||
isModifiedFace = true;
|
||||
}
|
||||
}
|
||||
@@ -1321,14 +1321,14 @@ void Part::BRepBuilderAPI_RefineModel::Build()
|
||||
void Part::BRepBuilderAPI_RefineModel::LogModifications(const ModelRefine::FaceUniter& uniter)
|
||||
{
|
||||
const std::vector<ShapePairType>& modShapes = uniter.getModifiedShapes();
|
||||
for (std::vector<ShapePairType>::const_iterator it = modShapes.begin(); it != modShapes.end(); ++it) {
|
||||
for (const auto & it : modShapes) {
|
||||
TopTools_ListOfShape list;
|
||||
list.Append(it->second);
|
||||
myModified.Bind(it->first, list);
|
||||
list.Append(it.second);
|
||||
myModified.Bind(it.first, list);
|
||||
}
|
||||
const ShapeVectorType& delShapes = uniter.getDeletedShapes();
|
||||
for (ShapeVectorType::const_iterator it = delShapes.begin(); it != delShapes.end(); ++it) {
|
||||
myDeleted.Append(*it);
|
||||
for (const auto & it : delShapes) {
|
||||
myDeleted.Append(it);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -111,8 +111,8 @@ void BoxSelection::selectionCallback(void * ud, SoEventCallback * cb)
|
||||
polygon.Add(Base::Vector2d(pt2[0], pt1[1]));
|
||||
}
|
||||
else {
|
||||
for (std::vector<SbVec2f>::const_iterator it = picked.begin(); it != picked.end(); ++it)
|
||||
polygon.Add(Base::Vector2d((*it)[0],(*it)[1]));
|
||||
for (const auto& it : picked)
|
||||
polygon.Add(Base::Vector2d(it[0],it[1]));
|
||||
}
|
||||
|
||||
BoxSelection* self = static_cast<BoxSelection*>(ud);
|
||||
|
||||
@@ -260,8 +260,8 @@ std::vector<Part::TopoShape> getShapesFromSelection()
|
||||
{
|
||||
std::vector<App::DocumentObject*> objs = Gui::Selection().getObjectsOfType(App::DocumentObject::getClassTypeId());
|
||||
std::vector <Part::TopoShape> shapes;
|
||||
for (std::vector<App::DocumentObject*>::iterator it = objs.begin(); it != objs.end(); ++it) {
|
||||
Part::TopoShape shp = Part::Feature::getTopoShape(*it);
|
||||
for (auto it : objs) {
|
||||
Part::TopoShape shp = Part::Feature::getTopoShape(it);
|
||||
if (!shp.isNull()){
|
||||
shapes.push_back(shp);
|
||||
}
|
||||
@@ -276,9 +276,9 @@ bool hasShapesInSelection()
|
||||
{
|
||||
bool hasShapes = false;
|
||||
std::vector<App::DocumentObject*> docobjs = Gui::Selection().getObjectsOfType(App::DocumentObject::getClassTypeId());
|
||||
for (std::vector<App::DocumentObject*>::iterator it = docobjs.begin(); it != docobjs.end(); ++it) {
|
||||
for (auto it : docobjs) {
|
||||
// Only check for the existence of a shape but don't perform a transformation
|
||||
if (!Part::Feature::getTopoShape(*it, nullptr, false, nullptr, nullptr, true, false, false).isNull()) {
|
||||
if (!Part::Feature::getTopoShape(it, nullptr, false, nullptr, nullptr, true, false, false).isNull()) {
|
||||
hasShapes = true;
|
||||
break;
|
||||
}
|
||||
@@ -317,8 +317,8 @@ void CmdPartCut::activated(int iMsg)
|
||||
|
||||
bool askUser = false;
|
||||
std::vector<std::string> names;
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = Sel.begin(); it != Sel.end(); ++it) {
|
||||
App::DocumentObject* obj = it->getObject();
|
||||
for (const auto & it : Sel) {
|
||||
const App::DocumentObject* obj = it.getObject();
|
||||
const TopoDS_Shape& shape = Part::Feature::getShape(obj);
|
||||
if (!PartGui::checkForSolids(shape) && !askUser) {
|
||||
int ret = QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Non-solids selected"),
|
||||
@@ -329,7 +329,7 @@ void CmdPartCut::activated(int iMsg)
|
||||
askUser = true;
|
||||
}
|
||||
|
||||
names.push_back(Base::Tools::quoted(it->getFeatName()));
|
||||
names.push_back(Base::Tools::quoted(it.getFeatName()));
|
||||
}
|
||||
|
||||
openCommand(QT_TRANSLATE_NOOP("Command", "Part Cut"));
|
||||
@@ -393,8 +393,8 @@ void CmdPartCommon::activated(int iMsg)
|
||||
|
||||
bool askUser = false;
|
||||
std::vector<std::string> names;
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = Sel.begin(); it != Sel.end(); ++it) {
|
||||
App::DocumentObject* obj = it->getObject();
|
||||
for (const auto & it : Sel) {
|
||||
const App::DocumentObject* obj = it.getObject();
|
||||
const TopoDS_Shape& shape = Part::Feature::getShape(obj);
|
||||
if (!PartGui::checkForSolids(shape) && !askUser) {
|
||||
int ret = QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Non-solids selected"),
|
||||
@@ -405,7 +405,7 @@ void CmdPartCommon::activated(int iMsg)
|
||||
askUser = true;
|
||||
}
|
||||
|
||||
names.push_back(Base::Tools::quoted(it->getFeatName()));
|
||||
names.push_back(Base::Tools::quoted(it.getFeatName()));
|
||||
}
|
||||
|
||||
openCommand(QT_TRANSLATE_NOOP("Command", "Common"));
|
||||
@@ -469,8 +469,8 @@ void CmdPartFuse::activated(int iMsg)
|
||||
|
||||
bool askUser = false;
|
||||
std::vector<std::string> names;
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = Sel.begin(); it != Sel.end(); ++it) {
|
||||
App::DocumentObject* obj = it->getObject();
|
||||
for (const auto & it : Sel) {
|
||||
const App::DocumentObject* obj = it.getObject();
|
||||
const TopoDS_Shape& shape = Part::Feature::getShape(obj);
|
||||
if (!PartGui::checkForSolids(shape) && !askUser) {
|
||||
int ret = QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Non-solids selected"),
|
||||
@@ -481,7 +481,7 @@ void CmdPartFuse::activated(int iMsg)
|
||||
askUser = true;
|
||||
}
|
||||
|
||||
names.push_back(Base::Tools::quoted(it->getFeatName()));
|
||||
names.push_back(Base::Tools::quoted(it.getFeatName()));
|
||||
}
|
||||
|
||||
openCommand(QT_TRANSLATE_NOOP("Command", "Fusion"));
|
||||
@@ -866,10 +866,10 @@ void CmdPartCompound::activated(int iMsg)
|
||||
// avoid duplicates without changing the order
|
||||
std::set<std::string> tempSelNames;
|
||||
str << "App.activeDocument()." << FeatName << ".Links = [";
|
||||
for (std::vector<Gui::SelectionSingleton::SelObj>::iterator it = Sel.begin(); it != Sel.end(); ++it) {
|
||||
auto pos = tempSelNames.insert(it->FeatName);
|
||||
for (const auto & it : Sel) {
|
||||
auto pos = tempSelNames.insert(it.FeatName);
|
||||
if (pos.second) {
|
||||
str << "App.activeDocument()." << it->FeatName << ",";
|
||||
str << "App.activeDocument()." << it.FeatName << ",";
|
||||
}
|
||||
}
|
||||
str << "]";
|
||||
@@ -984,8 +984,8 @@ void CmdPartImport::activated(int iMsg)
|
||||
commitCommand();
|
||||
|
||||
std::list<Gui::MDIView*> views = getActiveGuiDocument()->getMDIViewsOfType(Gui::View3DInventor::getClassTypeId());
|
||||
for (std::list<Gui::MDIView*>::iterator it = views.begin(); it != views.end(); ++it) {
|
||||
(*it)->viewAll();
|
||||
for (auto view : views) {
|
||||
view->viewAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1117,14 +1117,14 @@ void CmdPartMakeSolid::activated(int iMsg)
|
||||
std::vector<App::DocumentObject*> objs = Gui::Selection().getObjectsOfType
|
||||
(App::DocumentObject::getClassTypeId(), nullptr, Gui::ResolveMode::FollowLink);
|
||||
runCommand(Doc, "import Part");
|
||||
for (std::vector<App::DocumentObject*>::iterator it = objs.begin(); it != objs.end(); ++it) {
|
||||
const TopoDS_Shape& shape = Part::Feature::getShape(*it);
|
||||
for (auto it : objs) {
|
||||
const TopoDS_Shape& shape = Part::Feature::getShape(it);
|
||||
if (!shape.IsNull()) {
|
||||
TopAbs_ShapeEnum type = shape.ShapeType();
|
||||
QString str;
|
||||
if (type == TopAbs_SOLID) {
|
||||
Base::Console().Message("%s is ignored because it is already a solid.\n",
|
||||
(*it)->Label.getValue());
|
||||
it->Label.getValue());
|
||||
}
|
||||
else if (type == TopAbs_COMPOUND || type == TopAbs_COMPSOLID) {
|
||||
str = QString::fromLatin1(
|
||||
@@ -1135,8 +1135,8 @@ void CmdPartMakeSolid::activated(int iMsg)
|
||||
"__o__.Shape=__s__\n"
|
||||
"del __s__, __o__"
|
||||
)
|
||||
.arg(QLatin1String((*it)->getNameInDocument()),
|
||||
QLatin1String((*it)->Label.getValue()));
|
||||
.arg(QLatin1String(it->getNameInDocument()),
|
||||
QLatin1String(it->Label.getValue()));
|
||||
}
|
||||
else if (type == TopAbs_SHELL) {
|
||||
str = QString::fromLatin1(
|
||||
@@ -1147,12 +1147,12 @@ void CmdPartMakeSolid::activated(int iMsg)
|
||||
"__o__.Shape=__s__\n"
|
||||
"del __s__, __o__"
|
||||
)
|
||||
.arg(QLatin1String((*it)->getNameInDocument()),
|
||||
QLatin1String((*it)->Label.getValue()));
|
||||
.arg(QLatin1String(it->getNameInDocument()),
|
||||
QLatin1String(it->Label.getValue()));
|
||||
}
|
||||
else {
|
||||
Base::Console().Message("%s is ignored because it is neither a shell nor a compound.\n",
|
||||
(*it)->Label.getValue());
|
||||
it->Label.getValue());
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -1161,7 +1161,7 @@ void CmdPartMakeSolid::activated(int iMsg)
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("Cannot convert %s because %s.\n",
|
||||
(*it)->Label.getValue(), e.what());
|
||||
it->Label.getValue(), e.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1196,10 +1196,10 @@ void CmdPartReverseShape::activated(int iMsg)
|
||||
std::vector<App::DocumentObject*> objs = Gui::Selection().getObjectsOfType
|
||||
(App::DocumentObject::getClassTypeId());
|
||||
openCommand(QT_TRANSLATE_NOOP("Command", "Reverse"));
|
||||
for (std::vector<App::DocumentObject*>::iterator it = objs.begin(); it != objs.end(); ++it) {
|
||||
const TopoDS_Shape& shape = Part::Feature::getShape(*it);
|
||||
for (auto it : objs) {
|
||||
const TopoDS_Shape& shape = Part::Feature::getShape(it);
|
||||
if (!shape.IsNull()) {
|
||||
std::string name = (*it)->getNameInDocument();
|
||||
std::string name = it->getNameInDocument();
|
||||
name += "_rev";
|
||||
name = getUniqueObjectName(name.c_str());
|
||||
|
||||
@@ -1210,18 +1210,18 @@ void CmdPartReverseShape::activated(int iMsg)
|
||||
"del __o__"
|
||||
)
|
||||
.arg(QString::fromLatin1(name.c_str()),
|
||||
QString::fromLatin1((*it)->getNameInDocument()),
|
||||
QString::fromLatin1((*it)->Label.getValue()));
|
||||
QString::fromLatin1(it->getNameInDocument()),
|
||||
QString::fromLatin1(it->Label.getValue()));
|
||||
|
||||
try {
|
||||
runCommand(Doc, str.toLatin1());
|
||||
copyVisual(name.c_str(), "ShapeColor", (*it)->getNameInDocument());
|
||||
copyVisual(name.c_str(), "LineColor" , (*it)->getNameInDocument());
|
||||
copyVisual(name.c_str(), "PointColor", (*it)->getNameInDocument());
|
||||
copyVisual(name.c_str(), "ShapeColor", it->getNameInDocument());
|
||||
copyVisual(name.c_str(), "LineColor" , it->getNameInDocument());
|
||||
copyVisual(name.c_str(), "PointColor", it->getNameInDocument());
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("Cannot convert %s because %s.\n",
|
||||
(*it)->Label.getValue(), e.what());
|
||||
it->Label.getValue(), e.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1482,8 +1482,8 @@ void CmdPartCrossSections::activated(int iMsg)
|
||||
if (!dlg) {
|
||||
std::vector<Part::TopoShape> shapes = PartGui::getShapesFromSelection();
|
||||
Base::BoundBox3d bbox;
|
||||
for (std::vector<Part::TopoShape>::iterator it = shapes.begin(); it != shapes.end(); ++it) {
|
||||
bbox.Add((*it).getBoundBox());
|
||||
for (const auto & it : shapes) {
|
||||
bbox.Add(it.getBoundBox());
|
||||
}
|
||||
dlg = new PartGui::TaskCrossSections(bbox);
|
||||
}
|
||||
@@ -1606,9 +1606,9 @@ void CmdPartOffset::activated(int iMsg)
|
||||
Q_UNUSED(iMsg);
|
||||
std::vector<App::DocumentObject*> docobjs = Gui::Selection().getObjectsOfType(App::DocumentObject::getClassTypeId());
|
||||
std::vector<App::DocumentObject*> shapes;
|
||||
for (std::vector<App::DocumentObject*>::iterator it = docobjs.begin(); it != docobjs.end(); ++it) {
|
||||
if (!Part::Feature::getTopoShape(*it).isNull()) {
|
||||
shapes.push_back(*it);
|
||||
for (auto it : docobjs) {
|
||||
if (!Part::Feature::getTopoShape(it).isNull()) {
|
||||
shapes.push_back(it);
|
||||
}
|
||||
}
|
||||
if (shapes.size() != 1) {
|
||||
@@ -1664,9 +1664,9 @@ void CmdPartOffset2D::activated(int iMsg)
|
||||
std::vector<App::DocumentObject*> docobjs = Gui::Selection().getObjectsOfType(App::DocumentObject::getClassTypeId());
|
||||
std::vector<App::DocumentObject*> shapes;
|
||||
|
||||
for (std::vector<App::DocumentObject*>::iterator it = docobjs.begin(); it != docobjs.end(); ++it) {
|
||||
if (!Part::Feature::getTopoShape(*it).isNull()) {
|
||||
shapes.push_back(*it);
|
||||
for (auto it : docobjs) {
|
||||
if (!Part::Feature::getTopoShape(it).isNull()) {
|
||||
shapes.push_back(it);
|
||||
}
|
||||
}
|
||||
if (shapes.size() != 1) {
|
||||
@@ -1824,8 +1824,8 @@ void CmdPartThickness::activated(int iMsg)
|
||||
for (std::vector<std::string>::const_iterator it = subnames.begin(); it != subnames.end(); ++it) {
|
||||
subShapes.emplace_back(topoShape.getSubShape(subnames[0].c_str()));
|
||||
}
|
||||
for (std::vector<Part::TopoShape>::iterator it = subShapes.begin(); it != subShapes.end(); ++it) {
|
||||
TopoDS_Shape dsShape = (*it).getShape();
|
||||
for (const auto & it : subShapes) {
|
||||
TopoDS_Shape dsShape = it.getShape();
|
||||
if (dsShape.IsNull() || dsShape.ShapeType() != TopAbs_FACE) { //only face selection allowed
|
||||
ok = false;
|
||||
}
|
||||
|
||||
@@ -435,9 +435,9 @@ void CmdPartDefeaturing::activated(int iMsg)
|
||||
|
||||
std::string faces;
|
||||
std::vector<std::string> subnames = it->getSubNames();
|
||||
for (std::vector<std::string>::iterator sub = subnames.begin(); sub != subnames.end(); ++sub) {
|
||||
for (const auto & subname : subnames) {
|
||||
faces.append("sh.");
|
||||
faces.append(*sub);
|
||||
faces.append(subname);
|
||||
faces.append(",");
|
||||
}
|
||||
|
||||
@@ -465,10 +465,10 @@ bool CmdPartDefeaturing::isActive()
|
||||
{
|
||||
Base::Type partid = Base::Type::fromName("Part::Feature");
|
||||
std::vector<Gui::SelectionObject> objs = Gui::Selection().getSelectionEx(nullptr, partid);
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = objs.begin(); it != objs.end(); ++it) {
|
||||
std::vector<std::string> subnames = it->getSubNames();
|
||||
for (std::vector<std::string>::iterator sub = subnames.begin(); sub != subnames.end(); ++sub) {
|
||||
if (sub->substr(0,4) == "Face") {
|
||||
for (const auto & obj : objs) {
|
||||
std::vector<std::string> subnames = obj.getSubNames();
|
||||
for (const auto & subname : subnames) {
|
||||
if (subname.substr(0,4) == "Face") {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,9 +214,9 @@ void CrossSections::apply()
|
||||
std::vector<App::DocumentObject*> docobjs = Gui::Selection().
|
||||
getObjectsOfType(App::DocumentObject::getClassTypeId());
|
||||
std::vector<App::DocumentObject*> obj;
|
||||
for (std::vector<App::DocumentObject*>::iterator it = docobjs.begin(); it != docobjs.end(); ++it){
|
||||
if (!Part::Feature::getTopoShape(*it).isNull()) {
|
||||
obj.push_back((*it));
|
||||
for (auto it : docobjs) {
|
||||
if (!Part::Feature::getTopoShape(it).isNull()) {
|
||||
obj.push_back(it);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,21 +270,21 @@ void CrossSections::apply()
|
||||
Base::SequencerLauncher seq("Cross-sections...", obj.size() * (d.size() +1));
|
||||
Gui::Command::runCommand(Gui::Command::App, "import Part\n");
|
||||
Gui::Command::runCommand(Gui::Command::App, "from FreeCAD import Base\n");
|
||||
for (std::vector<App::DocumentObject*>::iterator it = obj.begin(); it != obj.end(); ++it) {
|
||||
App::Document* doc = (*it)->getDocument();
|
||||
std::string s = (*it)->getNameInDocument();
|
||||
for (auto it : obj) {
|
||||
App::Document* doc = it->getDocument();
|
||||
std::string s = it->getNameInDocument();
|
||||
s += "_cs";
|
||||
Gui::Command::runCommand(Gui::Command::App, QString::fromLatin1(
|
||||
"wires=list()\n"
|
||||
"shape=FreeCAD.getDocument(\"%1\").%2.Shape\n")
|
||||
.arg(QLatin1String(doc->getName()),
|
||||
QLatin1String((*it)->getNameInDocument())).toLatin1());
|
||||
QLatin1String(it->getNameInDocument())).toLatin1());
|
||||
|
||||
for (std::vector<double>::iterator jt = d.begin(); jt != d.end(); ++jt) {
|
||||
for (double jt : d) {
|
||||
Gui::Command::runCommand(Gui::Command::App, QString::fromLatin1(
|
||||
"for i in shape.slice(Base.Vector(%1,%2,%3),%4):\n"
|
||||
" wires.append(i)\n"
|
||||
).arg(a).arg(b).arg(c).arg(*jt).toLatin1());
|
||||
).arg(a).arg(b).arg(c).arg(jt).toLatin1());
|
||||
seq.next();
|
||||
}
|
||||
|
||||
@@ -502,26 +502,26 @@ std::vector<double> CrossSections::getPlanes() const
|
||||
void CrossSections::makePlanes(Plane type, const std::vector<double>& d, double bound[4])
|
||||
{
|
||||
std::vector<Base::Vector3f> points;
|
||||
for (std::vector<double>::const_iterator it = d.begin(); it != d.end(); ++it) {
|
||||
for (double it : d) {
|
||||
Base::Vector3f v[4];
|
||||
switch (type) {
|
||||
case XY:
|
||||
v[0].Set(bound[0],bound[2],*it);
|
||||
v[1].Set(bound[1],bound[2],*it);
|
||||
v[2].Set(bound[1],bound[3],*it);
|
||||
v[3].Set(bound[0],bound[3],*it);
|
||||
v[0].Set(bound[0],bound[2],it);
|
||||
v[1].Set(bound[1],bound[2],it);
|
||||
v[2].Set(bound[1],bound[3],it);
|
||||
v[3].Set(bound[0],bound[3],it);
|
||||
break;
|
||||
case XZ:
|
||||
v[0].Set(bound[0],*it,bound[2]);
|
||||
v[1].Set(bound[1],*it,bound[2]);
|
||||
v[2].Set(bound[1],*it,bound[3]);
|
||||
v[3].Set(bound[0],*it,bound[3]);
|
||||
v[0].Set(bound[0],it,bound[2]);
|
||||
v[1].Set(bound[1],it,bound[2]);
|
||||
v[2].Set(bound[1],it,bound[3]);
|
||||
v[3].Set(bound[0],it,bound[3]);
|
||||
break;
|
||||
case YZ:
|
||||
v[0].Set(*it,bound[0],bound[2]);
|
||||
v[1].Set(*it,bound[1],bound[2]);
|
||||
v[2].Set(*it,bound[1],bound[3]);
|
||||
v[3].Set(*it,bound[0],bound[3]);
|
||||
v[0].Set(it,bound[0],bound[2]);
|
||||
v[1].Set(it,bound[1],bound[2]);
|
||||
v[2].Set(it,bound[1],bound[3]);
|
||||
v[3].Set(it,bound[0],bound[3]);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -222,18 +222,18 @@ void DlgBooleanOperation::findShapes()
|
||||
(Part::Feature::getClassTypeId());
|
||||
|
||||
QTreeWidgetItem *item_left=nullptr, *item_right=nullptr;
|
||||
for (std::vector<App::DocumentObject*>::iterator it = objs.begin(); it!=objs.end(); ++it) {
|
||||
const TopoDS_Shape& shape = static_cast<Part::Feature*>(*it)->Shape.getValue();
|
||||
for (auto obj : objs) {
|
||||
const TopoDS_Shape& shape = static_cast<Part::Feature*>(obj)->Shape.getValue();
|
||||
if (!shape.IsNull()) {
|
||||
QString label = QString::fromUtf8((*it)->Label.getValue());
|
||||
QString name = QString::fromLatin1((*it)->getNameInDocument());
|
||||
QString label = QString::fromUtf8(obj->Label.getValue());
|
||||
QString name = QString::fromLatin1(obj->getNameInDocument());
|
||||
|
||||
QTreeWidgetItem* child = new BooleanOperationItem();
|
||||
child->setCheckState(0, Qt::Unchecked);
|
||||
child->setText(0, label);
|
||||
child->setToolTip(0, label);
|
||||
child->setData(0, Qt::UserRole, name);
|
||||
Gui::ViewProvider* vp = activeGui->getViewProvider(*it);
|
||||
Gui::ViewProvider* vp = activeGui->getViewProvider(obj);
|
||||
if (vp)
|
||||
child->setIcon(0, vp->getIcon());
|
||||
|
||||
@@ -268,7 +268,7 @@ void DlgBooleanOperation::findShapes()
|
||||
}
|
||||
|
||||
if (!item_left || !item_right) {
|
||||
bool selected = Gui::Selection().isSelected(*it);
|
||||
bool selected = Gui::Selection().isSelected(obj);
|
||||
if (!item_left && selected)
|
||||
item_left = child;
|
||||
else if (!item_right && selected)
|
||||
|
||||
@@ -382,8 +382,8 @@ void DlgExtrusion::findShapes()
|
||||
|
||||
std::vector<App::DocumentObject*> objs = activeDoc->getObjectsOfType<App::DocumentObject>();
|
||||
|
||||
for (std::vector<App::DocumentObject*>::iterator it = objs.begin(); it!=objs.end(); ++it) {
|
||||
Part::TopoShape topoShape = Part::Feature::getTopoShape(*it);
|
||||
for (auto obj : objs) {
|
||||
Part::TopoShape topoShape = Part::Feature::getTopoShape(obj);
|
||||
if (topoShape.isNull()) {
|
||||
continue;
|
||||
}
|
||||
@@ -391,9 +391,9 @@ void DlgExtrusion::findShapes()
|
||||
if (shape.IsNull()) continue;
|
||||
if (canExtrude(shape)) {
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(ui->treeWidget);
|
||||
item->setText(0, QString::fromUtf8((*it)->Label.getValue()));
|
||||
item->setData(0, Qt::UserRole, QString::fromLatin1((*it)->getNameInDocument()));
|
||||
Gui::ViewProvider* vp = activeGui->getViewProvider(*it);
|
||||
item->setText(0, QString::fromUtf8(obj->Label.getValue()));
|
||||
item->setData(0, Qt::UserRole, QString::fromLatin1(obj->getNameInDocument()));
|
||||
Gui::ViewProvider* vp = activeGui->getViewProvider(obj);
|
||||
if (vp)
|
||||
item->setIcon(0, vp->getIcon());
|
||||
}
|
||||
@@ -618,8 +618,8 @@ std::vector<App::DocumentObject*> DlgExtrusion::getShapesToExtrude() const
|
||||
throw Base::RuntimeError("Document lost");
|
||||
|
||||
std::vector<App::DocumentObject*> objects;
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
App::DocumentObject* obj = doc->getObject(items[i]->data(0, Qt::UserRole).toString().toLatin1());
|
||||
for (auto item : items) {
|
||||
App::DocumentObject* obj = doc->getObject(item->data(0, Qt::UserRole).toString().toLatin1());
|
||||
if (!obj)
|
||||
throw Base::RuntimeError("Object not found");
|
||||
objects.push_back(obj);
|
||||
|
||||
@@ -612,18 +612,18 @@ void DlgFilletEdges::setupFillet(const std::vector<App::DocumentObject*>& objs)
|
||||
std::vector<std::string> subElements;
|
||||
QStandardItemModel *model = qobject_cast<QStandardItemModel*>(ui->treeView->model());
|
||||
bool block = model->blockSignals(true); // do not call toggleCheckState
|
||||
for (std::vector<Part::FilletElement>::const_iterator et = e.begin(); et != e.end(); ++et) {
|
||||
std::vector<int>::iterator it = std::find(d->edge_ids.begin(), d->edge_ids.end(), et->edgeid);
|
||||
for (const auto & et : e) {
|
||||
std::vector<int>::iterator it = std::find(d->edge_ids.begin(), d->edge_ids.end(), et.edgeid);
|
||||
if (it != d->edge_ids.end()) {
|
||||
int index = it - d->edge_ids.begin();
|
||||
model->setData(model->index(index, 0), Qt::Checked, Qt::CheckStateRole);
|
||||
//model->setData(model->index(index, 1), QVariant(QLocale().toString(et->radius1,'f',Base::UnitsApi::getDecimals())));
|
||||
//model->setData(model->index(index, 2), QVariant(QLocale().toString(et->radius2,'f',Base::UnitsApi::getDecimals())));
|
||||
model->setData(model->index(index, 1), QVariant::fromValue<Base::Quantity>(Base::Quantity(et->radius1, Base::Unit::Length)));
|
||||
model->setData(model->index(index, 2), QVariant::fromValue<Base::Quantity>(Base::Quantity(et->radius2, Base::Unit::Length)));
|
||||
model->setData(model->index(index, 1), QVariant::fromValue<Base::Quantity>(Base::Quantity(et.radius1, Base::Unit::Length)));
|
||||
model->setData(model->index(index, 2), QVariant::fromValue<Base::Quantity>(Base::Quantity(et.radius2, Base::Unit::Length)));
|
||||
|
||||
startRadius = et->radius1;
|
||||
endRadius = et->radius2;
|
||||
startRadius = et.radius1;
|
||||
endRadius = et.radius2;
|
||||
if (startRadius != endRadius)
|
||||
twoRadii = true;
|
||||
|
||||
@@ -771,15 +771,15 @@ void DlgFilletEdges::onShapeObjectActivated(int itemPos)
|
||||
|
||||
model->insertRows(0, d->edge_ids.size());
|
||||
int index = 0;
|
||||
for (std::vector<int>::iterator it = d->edge_ids.begin(); it != d->edge_ids.end(); ++it) {
|
||||
model->setData(model->index(index, 0), QVariant(tr("Edge%1").arg(*it)));
|
||||
model->setData(model->index(index, 0), QVariant(*it), Qt::UserRole);
|
||||
for (int id : d->edge_ids) {
|
||||
model->setData(model->index(index, 0), QVariant(tr("Edge%1").arg(id)));
|
||||
model->setData(model->index(index, 0), QVariant(id), Qt::UserRole);
|
||||
//model->setData(model->index(index, 1), QVariant(QLocale().toString(1.0,'f',Base::UnitsApi::getDecimals())));
|
||||
//model->setData(model->index(index, 2), QVariant(QLocale().toString(1.0,'f',Base::UnitsApi::getDecimals())));
|
||||
model->setData(model->index(index, 1), QVariant::fromValue<Base::Quantity>(Base::Quantity(1.0,Base::Unit::Length)));
|
||||
model->setData(model->index(index, 2), QVariant::fromValue<Base::Quantity>(Base::Quantity(1.0,Base::Unit::Length)));
|
||||
std::stringstream element;
|
||||
element << "Edge" << *it;
|
||||
element << "Edge" << id;
|
||||
if (Gui::Selection().isSelected(part, element.str().c_str()))
|
||||
model->setData(model->index(index, 0), Qt::Checked, Qt::CheckStateRole);
|
||||
else
|
||||
|
||||
@@ -407,16 +407,16 @@ void PartGui::DlgProjectionOnSurface::store_current_selected_parts(std::vector<S
|
||||
if (!it->getSubNames().empty() )
|
||||
{
|
||||
auto parentShape = currentShapeStore.inputShape;
|
||||
for (auto itName = selObj.front().getSubNames().begin(); itName != selObj.front().getSubNames().end(); ++itName)
|
||||
for (const auto & itName : selObj.front().getSubNames())
|
||||
{
|
||||
auto currentShape = aPart->Shape.getShape().getSubShape(itName->c_str());
|
||||
auto currentShape = aPart->Shape.getShape().getSubShape(itName.c_str());
|
||||
|
||||
transform_shape_to_global_position(currentShape, aPart);
|
||||
|
||||
currentShapeStore.inputShape = currentShape;
|
||||
currentShapeStore.partName = *itName;
|
||||
currentShapeStore.partName = itName;
|
||||
auto store = store_part_in_vector(currentShapeStore, iStoreVec);
|
||||
higlight_object(aPart, *itName, store, iColor);
|
||||
higlight_object(aPart, itName, store, iColor);
|
||||
store_wire_in_vector(currentShapeStore, parentShape, iStoreVec, iColor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,8 +247,8 @@ std::vector<App::DocumentObject*> DlgRevolution::getShapesToRevolve() const
|
||||
throw Base::RuntimeError("Document lost");
|
||||
|
||||
std::vector<App::DocumentObject*> objects;
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
App::DocumentObject* obj = doc->getObject(items[i]->data(0, Qt::UserRole).toString().toLatin1());
|
||||
for (auto item : items) {
|
||||
App::DocumentObject* obj = doc->getObject(item->data(0, Qt::UserRole).toString().toLatin1());
|
||||
if (!obj)
|
||||
throw Base::RuntimeError("Object not found");
|
||||
objects.push_back(obj);
|
||||
@@ -341,8 +341,8 @@ void DlgRevolution::findShapes()
|
||||
|
||||
std::vector<App::DocumentObject*> objs = activeDoc->getObjectsOfType<App::DocumentObject>();
|
||||
|
||||
for (std::vector<App::DocumentObject*>::iterator it = objs.begin(); it!=objs.end(); ++it) {
|
||||
Part::TopoShape topoShape = Part::Feature::getTopoShape(*it);
|
||||
for (auto obj : objs) {
|
||||
Part::TopoShape topoShape = Part::Feature::getTopoShape(obj);
|
||||
if (topoShape.isNull()) {
|
||||
continue;
|
||||
}
|
||||
@@ -356,9 +356,9 @@ void DlgRevolution::findShapes()
|
||||
if (xp.More()) continue; // compound solids not allowed
|
||||
// So allowed are: vertex, edge, wire, face, shell and compound
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(ui->treeWidget);
|
||||
item->setText(0, QString::fromUtf8((*it)->Label.getValue()));
|
||||
item->setData(0, Qt::UserRole, QString::fromLatin1((*it)->getNameInDocument()));
|
||||
Gui::ViewProvider* vp = activeGui->getViewProvider(*it);
|
||||
item->setText(0, QString::fromUtf8(obj->Label.getValue()));
|
||||
item->setData(0, Qt::UserRole, QString::fromLatin1(obj->getNameInDocument()));
|
||||
Gui::ViewProvider* vp = activeGui->getViewProvider(obj);
|
||||
if (vp) item->setIcon(0, vp->getIcon());
|
||||
}
|
||||
}
|
||||
@@ -398,8 +398,8 @@ void DlgRevolution::accept()
|
||||
else {
|
||||
symmetric = QString::fromLatin1("False");}
|
||||
|
||||
for (QList<QTreeWidgetItem *>::iterator it = items.begin(); it != items.end(); ++it) {
|
||||
shape = (*it)->data(0, Qt::UserRole).toString();
|
||||
for (auto item : items) {
|
||||
shape = item->data(0, Qt::UserRole).toString();
|
||||
type = QString::fromLatin1("Part::Revolution");
|
||||
name = QString::fromLatin1(activeDoc->getUniqueObjectName("Revolve").c_str());
|
||||
Base::Vector3d axis = this->getDirection();
|
||||
|
||||
@@ -80,11 +80,11 @@ void DlgSettings3DViewPart::saveSettings()
|
||||
|
||||
// search for Part view providers and apply the new settings
|
||||
std::vector<App::Document*> docs = App::GetApplication().getDocuments();
|
||||
for (std::vector<App::Document*>::iterator it = docs.begin(); it != docs.end(); ++it) {
|
||||
Gui::Document* doc = Gui::Application::Instance->getDocument(*it);
|
||||
for (auto it : docs) {
|
||||
Gui::Document* doc = Gui::Application::Instance->getDocument(it);
|
||||
std::vector<Gui::ViewProvider*> views = doc->getViewProvidersOfType(ViewProviderPart::getClassTypeId());
|
||||
for (std::vector<Gui::ViewProvider*>::iterator jt = views.begin(); jt != views.end(); ++jt) {
|
||||
static_cast<ViewProviderPart*>(*jt)->reload();
|
||||
for (auto view : views) {
|
||||
static_cast<ViewProviderPart*>(view)->reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,17 +105,17 @@ void Mirroring::findShapes()
|
||||
this->document = QString::fromLatin1(activeDoc->getName());
|
||||
std::vector<App::DocumentObject*> objs = activeDoc->getObjectsOfType<App::DocumentObject>();
|
||||
|
||||
for (std::vector<App::DocumentObject*>::iterator it = objs.begin(); it!=objs.end(); ++it) {
|
||||
Part::TopoShape shape = Part::Feature::getTopoShape(*it);
|
||||
for (auto obj : objs) {
|
||||
Part::TopoShape shape = Part::Feature::getTopoShape(obj);
|
||||
if (!shape.isNull()) {
|
||||
QString label = QString::fromUtf8((*it)->Label.getValue());
|
||||
QString name = QString::fromLatin1((*it)->getNameInDocument());
|
||||
QString label = QString::fromUtf8(obj->Label.getValue());
|
||||
QString name = QString::fromLatin1(obj->getNameInDocument());
|
||||
|
||||
QTreeWidgetItem* child = new QTreeWidgetItem();
|
||||
child->setText(0, label);
|
||||
child->setToolTip(0, label);
|
||||
child->setData(0, Qt::UserRole, name);
|
||||
Gui::ViewProvider* vp = activeGui->getViewProvider(*it);
|
||||
Gui::ViewProvider* vp = activeGui->getViewProvider(obj);
|
||||
if (vp) child->setIcon(0, vp->getIcon());
|
||||
ui->shapes->addTopLevelItem(child);
|
||||
}
|
||||
@@ -155,9 +155,9 @@ bool Mirroring::accept()
|
||||
double basex = ui->baseX->value().getValue();
|
||||
double basey = ui->baseY->value().getValue();
|
||||
double basez = ui->baseZ->value().getValue();
|
||||
for (QList<QTreeWidgetItem *>::iterator it = items.begin(); it != items.end(); ++it) {
|
||||
shape = (*it)->data(0, Qt::UserRole).toString();
|
||||
std::string escapedstr = Base::Tools::escapedUnicodeFromUtf8((*it)->text(0).toUtf8());
|
||||
for (auto item : items) {
|
||||
shape = item->data(0, Qt::UserRole).toString();
|
||||
std::string escapedstr = Base::Tools::escapedUnicodeFromUtf8(item->text(0).toUtf8());
|
||||
label = QString::fromStdString(escapedstr);
|
||||
|
||||
// if we already have the suffix " (Mirror #<number>)" remove it
|
||||
|
||||
@@ -75,9 +75,9 @@ void ShapeFromMesh::perform()
|
||||
Gui::doCommandT(Gui::Command::Doc, "import Part");
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Convert mesh"));
|
||||
|
||||
for (auto it = meshes.begin(); it != meshes.end(); ++it) {
|
||||
App::Document* doc = (*it)->getDocument();
|
||||
std::string mesh = (*it)->getNameInDocument();
|
||||
for (auto it : meshes) {
|
||||
App::Document* doc = it->getDocument();
|
||||
std::string mesh = it->getNameInDocument();
|
||||
std::string name = doc->getUniqueObjectName(mesh.c_str());
|
||||
|
||||
Gui::cmdAppDocumentArgs(doc, "addObject('%s', '%s')", "Part::Feature", name);
|
||||
|
||||
@@ -304,8 +304,8 @@ void SoBrepEdgeSet::renderSelection(SoGLRenderAction *action, SelContextPtr ctx,
|
||||
|
||||
bool SoBrepEdgeSet::validIndexes(const SoCoordinateElement* coords, const std::vector<int32_t>& pts) const
|
||||
{
|
||||
for (std::vector<int32_t>::const_iterator it = pts.begin(); it != pts.end(); ++it) {
|
||||
if (*it >= coords->getNum()) {
|
||||
for (int32_t it : pts) {
|
||||
if (it >= coords->getNum()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,9 +263,9 @@ void TaskAttacher::documentDeleted(const Gui::Document&)
|
||||
const QString makeHintText(std::set<eRefType> hint)
|
||||
{
|
||||
QString result;
|
||||
for (std::set<eRefType>::const_iterator t = hint.begin(); t != hint.end(); t++) {
|
||||
for (auto t : hint) {
|
||||
QString tText;
|
||||
tText = AttacherGui::getShapeTypeText(*t);
|
||||
tText = AttacherGui::getShapeTypeText(t);
|
||||
result += QString::fromLatin1(result.size() == 0 ? "" : "/") + tText;
|
||||
}
|
||||
|
||||
|
||||
@@ -216,8 +216,8 @@ public:
|
||||
polygon.Add(Base::Vector2d(pt2[0], pt1[1]));
|
||||
}
|
||||
else {
|
||||
for (std::vector<SbVec2f>::const_iterator it = picked.begin(); it != picked.end(); ++it)
|
||||
polygon.Add(Base::Vector2d((*it)[0], (*it)[1]));
|
||||
for (const auto& it : picked)
|
||||
polygon.Add(Base::Vector2d(it[0], it[1]));
|
||||
}
|
||||
|
||||
FaceColors* self = static_cast<FaceColors*>(ud);
|
||||
@@ -340,9 +340,9 @@ void FaceColors::onColorButtonChanged()
|
||||
{
|
||||
if (!d->index.isEmpty()) {
|
||||
QColor color = d->ui->colorButton->color();
|
||||
for (QSet<int>::iterator it = d->index.begin(); it != d->index.end(); ++it) {
|
||||
for (int it : d->index) {
|
||||
// alpha of App::Color is contrary to the one of QColor
|
||||
d->perface[*it].set(color.redF(), color.greenF(), color.blueF(), (1.0 - color.alphaF()));
|
||||
d->perface[it].set(color.redF(), color.greenF(), color.blueF(), (1.0 - color.alphaF()));
|
||||
}
|
||||
d->vp->DiffuseColor.setValues(d->perface);
|
||||
// new color has been applied, unselect so that users can see this
|
||||
@@ -398,8 +398,8 @@ void FaceColors::updatePanel()
|
||||
{
|
||||
QString faces = QString::fromLatin1("[");
|
||||
int size = d->index.size();
|
||||
for (QSet<int>::iterator it = d->index.begin(); it != d->index.end(); ++it) {
|
||||
faces += QString::number(*it + 1);
|
||||
for (int it : d->index) {
|
||||
faces += QString::number(it + 1);
|
||||
if (--size > 0)
|
||||
faces += QString::fromLatin1(",");
|
||||
}
|
||||
|
||||
@@ -100,8 +100,8 @@ void LoftWidget::findShapes()
|
||||
|
||||
std::vector<App::DocumentObject*> objs = activeDoc->getObjectsOfType<App::DocumentObject>();
|
||||
|
||||
for (std::vector<App::DocumentObject*>::iterator it = objs.begin(); it!=objs.end(); ++it) {
|
||||
Part::TopoShape topoShape = Part::Feature::getTopoShape(*it);
|
||||
for (auto obj : objs) {
|
||||
Part::TopoShape topoShape = Part::Feature::getTopoShape(obj);
|
||||
if (topoShape.isNull()) {
|
||||
continue;
|
||||
}
|
||||
@@ -143,13 +143,13 @@ void LoftWidget::findShapes()
|
||||
shape.ShapeType() == TopAbs_WIRE ||
|
||||
shape.ShapeType() == TopAbs_EDGE ||
|
||||
shape.ShapeType() == TopAbs_VERTEX) {
|
||||
QString label = QString::fromUtf8((*it)->Label.getValue());
|
||||
QString name = QString::fromLatin1((*it)->getNameInDocument());
|
||||
QString label = QString::fromUtf8(obj->Label.getValue());
|
||||
QString name = QString::fromLatin1(obj->getNameInDocument());
|
||||
QTreeWidgetItem* child = new QTreeWidgetItem();
|
||||
child->setText(0, label);
|
||||
child->setToolTip(0, label);
|
||||
child->setData(0, Qt::UserRole, name);
|
||||
Gui::ViewProvider* vp = activeGui->getViewProvider(*it);
|
||||
Gui::ViewProvider* vp = activeGui->getViewProvider(obj);
|
||||
if (vp) child->setIcon(0, vp->getIcon());
|
||||
d->ui.selector->availableTreeWidget()->addTopLevelItem(child);
|
||||
}
|
||||
|
||||
@@ -427,25 +427,23 @@ void ShapeBuilderWidget::createShellFromFace()
|
||||
}
|
||||
|
||||
std::vector<Gui::SelectionObject> sel = faceFilter.Result[0];
|
||||
std::vector<Gui::SelectionObject>::iterator it;
|
||||
std::vector<std::string>::const_iterator jt;
|
||||
|
||||
QString list;
|
||||
QTextStream str(&list);
|
||||
if (d->ui.checkFaces->isChecked()) {
|
||||
std::set<App::DocumentObject*> obj;
|
||||
for (it=sel.begin();it!=sel.end();++it)
|
||||
obj.insert(it->getObject());
|
||||
std::set<const App::DocumentObject*> obj;
|
||||
for (const auto& it : sel)
|
||||
obj.insert(it.getObject());
|
||||
str << "[]";
|
||||
for (std::set<App::DocumentObject*>::iterator it = obj.begin(); it != obj.end(); ++it) {
|
||||
str << "+ App.ActiveDocument." << (*it)->getNameInDocument() << ".Shape.Faces";
|
||||
for (auto it : obj) {
|
||||
str << "+ App.ActiveDocument." << it->getNameInDocument() << ".Shape.Faces";
|
||||
}
|
||||
}
|
||||
else {
|
||||
str << "[";
|
||||
for (it=sel.begin();it!=sel.end();++it) {
|
||||
for (jt=it->getSubNames().begin();jt!=it->getSubNames().end();++jt) {
|
||||
str << "App.ActiveDocument." << it->getFeatName() << ".Shape." << jt->c_str() << ", ";
|
||||
for (const auto& it : sel) {
|
||||
for (const auto& jt : it.getSubNames()) {
|
||||
str << "App.ActiveDocument." << it.getFeatName() << ".Shape." << jt.c_str() << ", ";
|
||||
}
|
||||
}
|
||||
str << "]";
|
||||
|
||||
@@ -162,8 +162,8 @@ void SweepWidget::findShapes()
|
||||
|
||||
std::vector<App::DocumentObject*> objs = activeDoc->getObjectsOfType<App::DocumentObject>();
|
||||
|
||||
for (std::vector<App::DocumentObject*>::iterator it = objs.begin(); it!=objs.end(); ++it) {
|
||||
Part::TopoShape topoShape = Part::Feature::getTopoShape(*it);
|
||||
for (auto obj : objs) {
|
||||
Part::TopoShape topoShape = Part::Feature::getTopoShape(obj);
|
||||
if (topoShape.isNull()) {
|
||||
continue;
|
||||
}
|
||||
@@ -205,14 +205,14 @@ void SweepWidget::findShapes()
|
||||
shape.ShapeType() == TopAbs_WIRE ||
|
||||
shape.ShapeType() == TopAbs_EDGE ||
|
||||
shape.ShapeType() == TopAbs_VERTEX) {
|
||||
QString label = QString::fromUtf8((*it)->Label.getValue());
|
||||
QString name = QString::fromLatin1((*it)->getNameInDocument());
|
||||
QString label = QString::fromUtf8(obj->Label.getValue());
|
||||
QString name = QString::fromLatin1(obj->getNameInDocument());
|
||||
|
||||
QTreeWidgetItem* child = new QTreeWidgetItem();
|
||||
child->setText(0, label);
|
||||
child->setToolTip(0, label);
|
||||
child->setData(0, Qt::UserRole, name);
|
||||
Gui::ViewProvider* vp = activeGui->getViewProvider(*it);
|
||||
Gui::ViewProvider* vp = activeGui->getViewProvider(obj);
|
||||
if (vp) child->setIcon(0, vp->getIcon());
|
||||
d->ui.selector->availableTreeWidget()->addTopLevelItem(child);
|
||||
}
|
||||
@@ -232,8 +232,8 @@ bool SweepWidget::isPathValid(const Gui::SelectionObject& sel) const
|
||||
if (!sub.empty()) {
|
||||
try {
|
||||
BRepBuilderAPI_MakeWire mkWire;
|
||||
for (std::vector<std::string>::const_iterator it = sub.begin(); it != sub.end(); ++it) {
|
||||
TopoDS_Shape subshape = shape.getSubShape(it->c_str());
|
||||
for (const auto & it : sub) {
|
||||
TopoDS_Shape subshape = shape.getSubShape(it.c_str());
|
||||
mkWire.Add(TopoDS::Edge(subshape));
|
||||
}
|
||||
pathShape = mkWire.Wire();
|
||||
@@ -300,8 +300,8 @@ bool SweepWidget::accept()
|
||||
for (std::vector<std::string>::const_iterator it = subnames.begin(); it != subnames.end(); ++it) {
|
||||
subShapes.push_back(Part::Feature::getTopoShape(docobj, subnames[0].c_str(), true /*need element*/));
|
||||
}
|
||||
for (std::vector<Part::TopoShape>::iterator it = subShapes.begin(); it != subShapes.end(); ++it) {
|
||||
TopoDS_Shape dsShape = (*it).getShape();
|
||||
for (const auto & it : subShapes) {
|
||||
TopoDS_Shape dsShape = it.getShape();
|
||||
if (dsShape.IsNull() || dsShape.ShapeType() != TopAbs_EDGE) { //only edge selection allowed
|
||||
ok = false;
|
||||
}
|
||||
@@ -408,8 +408,8 @@ void SweepWidget::onButtonPathToggled(bool on)
|
||||
{
|
||||
if (on) {
|
||||
QList<QWidget*> c = this->findChildren<QWidget*>();
|
||||
for (QList<QWidget*>::iterator it = c.begin(); it != c.end(); ++it)
|
||||
(*it)->setEnabled(false);
|
||||
for (auto it : c)
|
||||
it->setEnabled(false);
|
||||
d->buttonText = d->ui.buttonPath->text();
|
||||
d->ui.buttonPath->setText(tr("Done"));
|
||||
d->ui.buttonPath->setEnabled(true);
|
||||
@@ -421,8 +421,8 @@ void SweepWidget::onButtonPathToggled(bool on)
|
||||
}
|
||||
else {
|
||||
QList<QWidget*> c = this->findChildren<QWidget*>();
|
||||
for (QList<QWidget*>::iterator it = c.begin(); it != c.end(); ++it)
|
||||
(*it)->setEnabled(true);
|
||||
for (auto it : c)
|
||||
it->setEnabled(true);
|
||||
d->ui.buttonPath->setText(d->buttonText);
|
||||
d->ui.labelPath->clear();
|
||||
Gui::Selection().rmvSelectionGate();
|
||||
|
||||
@@ -185,8 +185,8 @@ void ThicknessWidget::onFacesButtonToggled(bool on)
|
||||
{
|
||||
if (on) {
|
||||
QList<QWidget*> c = this->findChildren<QWidget*>();
|
||||
for (QList<QWidget*>::iterator it = c.begin(); it != c.end(); ++it)
|
||||
(*it)->setEnabled(false);
|
||||
for (auto it : c)
|
||||
it->setEnabled(false);
|
||||
d->ui.facesButton->setEnabled(true);
|
||||
d->ui.labelFaces->setText(tr("Select faces of the source object and press 'Done'"));
|
||||
d->ui.labelFaces->setEnabled(true);
|
||||
@@ -200,18 +200,18 @@ void ThicknessWidget::onFacesButtonToggled(bool on)
|
||||
}
|
||||
else {
|
||||
QList<QWidget*> c = this->findChildren<QWidget*>();
|
||||
for (QList<QWidget*>::iterator it = c.begin(); it != c.end(); ++it)
|
||||
(*it)->setEnabled(true);
|
||||
for (auto it : c)
|
||||
it->setEnabled(true);
|
||||
d->ui.facesButton->setText(d->text);
|
||||
d->ui.labelFaces->clear();
|
||||
|
||||
d->selection = Gui::Command::getPythonTuple
|
||||
(d->thickness->Faces.getValue()->getNameInDocument(), d->thickness->Faces.getSubValues());
|
||||
std::vector<Gui::SelectionObject> sel = Gui::Selection().getSelectionEx();
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = sel.begin(); it != sel.end(); ++it) {
|
||||
if (it->getObject() == d->thickness->Faces.getValue()) {
|
||||
d->thickness->Faces.setValue(it->getObject(), it->getSubNames());
|
||||
d->selection = it->getAsPropertyLinkSubString();
|
||||
for (auto & it : sel) {
|
||||
if (it.getObject() == d->thickness->Faces.getValue()) {
|
||||
d->thickness->Faces.setValue(it.getObject(), it.getSubNames());
|
||||
d->selection = it.getAsPropertyLinkSubString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,9 +231,10 @@ void ViewProviderMultiFuse::updateData(const App::Property* prop)
|
||||
}
|
||||
else if (prop->getTypeId().isDerivedFrom(App::PropertyLinkList::getClassTypeId())) {
|
||||
std::vector<App::DocumentObject*> pShapes = static_cast<const App::PropertyLinkList*>(prop)->getValues();
|
||||
for (std::vector<App::DocumentObject*>::iterator it = pShapes.begin(); it != pShapes.end(); ++it) {
|
||||
if (*it)
|
||||
Gui::Application::Instance->hideViewProvider(*it);
|
||||
for (auto it : pShapes) {
|
||||
if (it) {
|
||||
Gui::Application::Instance->hideViewProvider(it);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -243,9 +244,10 @@ bool ViewProviderMultiFuse::onDelete(const std::vector<std::string> &)
|
||||
// get the input shapes
|
||||
Part::MultiFuse* pBool = static_cast<Part::MultiFuse*>(getObject());
|
||||
std::vector<App::DocumentObject*> pShapes = pBool->Shapes.getValues();
|
||||
for (std::vector<App::DocumentObject*>::iterator it = pShapes.begin(); it != pShapes.end(); ++it) {
|
||||
if (*it)
|
||||
Gui::Application::Instance->showViewProvider(*it);
|
||||
for (auto it : pShapes) {
|
||||
if (it) {
|
||||
Gui::Application::Instance->showViewProvider(it);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -368,9 +370,10 @@ void ViewProviderMultiCommon::updateData(const App::Property* prop)
|
||||
}
|
||||
else if (prop->getTypeId().isDerivedFrom(App::PropertyLinkList::getClassTypeId())) {
|
||||
std::vector<App::DocumentObject*> pShapes = static_cast<const App::PropertyLinkList*>(prop)->getValues();
|
||||
for (std::vector<App::DocumentObject*>::iterator it = pShapes.begin(); it != pShapes.end(); ++it) {
|
||||
if (*it)
|
||||
Gui::Application::Instance->hideViewProvider(*it);
|
||||
for (auto it : pShapes) {
|
||||
if (it) {
|
||||
Gui::Application::Instance->hideViewProvider(it);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -380,9 +383,10 @@ bool ViewProviderMultiCommon::onDelete(const std::vector<std::string> &)
|
||||
// get the input shapes
|
||||
Part::MultiCommon* pBool = static_cast<Part::MultiCommon*>(getObject());
|
||||
std::vector<App::DocumentObject*> pShapes = pBool->Shapes.getValues();
|
||||
for (std::vector<App::DocumentObject*>::iterator it = pShapes.begin(); it != pShapes.end(); ++it) {
|
||||
if (*it)
|
||||
Gui::Application::Instance->showViewProvider(*it);
|
||||
for (auto it : pShapes) {
|
||||
if (it) {
|
||||
Gui::Application::Instance->showViewProvider(it);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -56,9 +56,9 @@ bool ViewProviderCompound::onDelete(const std::vector<std::string> &)
|
||||
// get the input shapes
|
||||
Part::Compound* pComp = static_cast<Part::Compound*>(getObject());
|
||||
std::vector<App::DocumentObject*> pLinks = pComp->Links.getValues();
|
||||
for (std::vector<App::DocumentObject*>::iterator it = pLinks.begin(); it != pLinks.end(); ++it) {
|
||||
if (*it)
|
||||
Gui::Application::Instance->showViewProvider(*it);
|
||||
for (auto pLink : pLinks) {
|
||||
if (pLink)
|
||||
Gui::Application::Instance->showViewProvider(pLink);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -78,8 +78,8 @@ void ViewProviderCompound::updateData(const App::Property* prop)
|
||||
// See also Compound::execute
|
||||
std::set<App::DocumentObject*> tempSources;
|
||||
std::vector<App::DocumentObject*> filter;
|
||||
for (std::vector<App::DocumentObject*>::iterator it = sources.begin(); it != sources.end(); ++it) {
|
||||
Part::Feature* objBase = dynamic_cast<Part::Feature*>(*it);
|
||||
for (auto source : sources) {
|
||||
Part::Feature* objBase = dynamic_cast<Part::Feature*>(source);
|
||||
if (objBase) {
|
||||
auto pos = tempSources.insert(objBase);
|
||||
if (pos.second) {
|
||||
@@ -135,8 +135,8 @@ void ViewProviderCompound::updateData(const App::Property* prop)
|
||||
}
|
||||
else if (prop->getTypeId().isDerivedFrom(App::PropertyLinkList::getClassTypeId())) {
|
||||
const std::vector<App::DocumentObject *>& pBases = static_cast<const App::PropertyLinkList*>(prop)->getValues();
|
||||
for (std::vector<App::DocumentObject *>::const_iterator it = pBases.begin(); it != pBases.end(); ++it) {
|
||||
if (*it) Gui::Application::Instance->hideViewProvider(*it);
|
||||
for (auto pBase : pBases) {
|
||||
if (pBase) Gui::Application::Instance->hideViewProvider(pBase);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,12 +190,12 @@ bool ViewProviderCurveNet::handleEvent(const SoEvent * const ev, Gui::View3DInve
|
||||
Base::Console().Log("ViewProviderCurveNet::handleEvent() press left\n");
|
||||
|
||||
bool bIsNode = false;
|
||||
for (std::list<Node>::iterator It = NodeList.begin();It != NodeList.end(); It++)
|
||||
for (const auto & It : NodeList)
|
||||
{
|
||||
if (It->pcHighlight->isHighlighted())
|
||||
if (It.pcHighlight->isHighlighted())
|
||||
{
|
||||
bIsNode = true;
|
||||
PointToMove = *It;
|
||||
PointToMove = It;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1253,8 +1253,8 @@ void ViewProviderPartExt::updateVisual()
|
||||
norms[i].normalize();
|
||||
|
||||
std::vector<int32_t> lineSetCoords;
|
||||
for (std::map<int, std::vector<int32_t> >::iterator it = lineSetMap.begin(); it != lineSetMap.end(); ++it) {
|
||||
lineSetCoords.insert(lineSetCoords.end(), it->second.begin(), it->second.end());
|
||||
for (const auto & it : lineSetMap) {
|
||||
lineSetCoords.insert(lineSetCoords.end(), it.second.begin(), it.second.end());
|
||||
lineSetCoords.push_back(-1);
|
||||
}
|
||||
|
||||
|
||||
@@ -220,11 +220,11 @@ void ViewProviderSplineExtension::showControlPointsOfEdge(const TopoDS_Edge& edg
|
||||
|
||||
int index=0;
|
||||
SbVec3f* verts = controlcoords->point.startEditing();
|
||||
for (std::list<gp_Pnt>::iterator p = poles.begin(); p != poles.end(); ++p) {
|
||||
verts[index++].setValue((float)p->X(), (float)p->Y(), (float)p->Z());
|
||||
for (const auto & pole : poles) {
|
||||
verts[index++].setValue((float)pole.X(), (float)pole.Y(), (float)pole.Z());
|
||||
}
|
||||
for (std::list<gp_Pnt>::iterator k = knots.begin(); k != knots.end(); ++k) {
|
||||
verts[index++].setValue((float)k->X(), (float)k->Y(), (float)k->Z());
|
||||
for (const auto & knot : knots) {
|
||||
verts[index++].setValue((float)knot.X(), (float)knot.Y(), (float)knot.Z());
|
||||
}
|
||||
controlcoords->point.finishEditing();
|
||||
|
||||
@@ -296,13 +296,13 @@ void ViewProviderSplineExtension::showControlPointsOfFace(const TopoDS_Face& fac
|
||||
|
||||
int index=0;
|
||||
SbVec3f* verts = coords->point.startEditing();
|
||||
for (std::vector<std::vector<gp_Pnt> >::iterator u = poles.begin(); u != poles.end(); ++u) {
|
||||
for (std::vector<gp_Pnt>::iterator v = u->begin(); v != u->end(); ++v) {
|
||||
verts[index++].setValue((float)v->X(), (float)v->Y(), (float)v->Z());
|
||||
for (const auto & pole : poles) {
|
||||
for (const auto& v : pole) {
|
||||
verts[index++].setValue((float)v.X(), (float)v.Y(), (float)v.Z());
|
||||
}
|
||||
}
|
||||
for (std::list<gp_Pnt>::iterator k = knots.begin(); k != knots.end(); ++k) {
|
||||
verts[index++].setValue((float)k->X(), (float)k->Y(), (float)k->Z());
|
||||
for (const auto & knot : knots) {
|
||||
verts[index++].setValue((float)knot.X(), (float)knot.Y(), (float)knot.Z());
|
||||
}
|
||||
coords->point.finishEditing();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user