[TD]GlobalPlacement for loose 2D objects

This commit is contained in:
wandererfan
2020-04-12 09:43:22 -04:00
committed by WandererFan
parent 27a475d84b
commit e537972ef9

View File

@@ -73,17 +73,24 @@ std::vector<TopoDS_Shape> ShapeExtractor::getShapes2d(const std::vector<App::Doc
std::vector<App::DocumentObject*> objs = gex->Group.getValues();
for (auto& d: objs) {
if (is2dObject(d)) {
auto shape = Part::Feature::getShape(d);
if(!shape.IsNull()) {
shapes2d.push_back(shape);
if (d->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
//need to apply global placement here. ??? because 2d shapes (Points so far)
//don't get gp from Part::feature::getShape() ????
const Part::Feature* pf = static_cast<const Part::Feature*>(d);
Part::TopoShape ts = pf->Shape.getShape();
ts.setPlacement(pf->globalPlacement());
shapes2d.push_back(ts.getShape());
}
}
}
} else {
if (is2dObject(l)) {
auto shape = Part::Feature::getShape(l);
if(!shape.IsNull()) {
shapes2d.push_back(shape);
if (l->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
//need to apply placement here
const Part::Feature* pf = static_cast<const Part::Feature*>(l);
Part::TopoShape ts = pf->Shape.getShape();
ts.setPlacement(pf->globalPlacement());
shapes2d.push_back(ts.getShape());
}
}
}
@@ -110,6 +117,7 @@ TopoDS_Shape ShapeExtractor::getShapes(const std::vector<App::DocumentObject*> l
if(!shape.IsNull()) {
// BRepTools::Write(shape, "DVPgetShape.brep"); //debug
if (shape.ShapeType() > TopAbs_COMPSOLID) { //simple shape
//do we need to apply placement here too??
sourceShapes.push_back(shape);
} else { //complex shape
std::vector<TopoDS_Shape> drawable = extractDrawableShapes(shape);