From e537972ef95457279c4d1c679c60749664fe6370 Mon Sep 17 00:00:00 2001 From: wandererfan Date: Sun, 12 Apr 2020 09:43:22 -0400 Subject: [PATCH] [TD]GlobalPlacement for loose 2D objects --- src/Mod/TechDraw/App/ShapeExtractor.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/Mod/TechDraw/App/ShapeExtractor.cpp b/src/Mod/TechDraw/App/ShapeExtractor.cpp index 29fac29def..febe6fcd06 100644 --- a/src/Mod/TechDraw/App/ShapeExtractor.cpp +++ b/src/Mod/TechDraw/App/ShapeExtractor.cpp @@ -73,17 +73,24 @@ std::vector ShapeExtractor::getShapes2d(const std::vector 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(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(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 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 drawable = extractDrawableShapes(shape);