@@ -150,7 +150,6 @@ bool MeasureDistance::getShape(App::PropertyLinkSub* prop, TopoDS_Shape& rShape)
|
||||
}
|
||||
|
||||
auto handler = getGeometryHandler(mod);
|
||||
std::string obName = static_cast<std::string>(ob->getNameInDocument());
|
||||
App::SubObjectT subject{ob, subName.c_str()};
|
||||
auto info = handler(subject);
|
||||
if (!info->valid) {
|
||||
@@ -158,7 +157,7 @@ bool MeasureDistance::getShape(App::PropertyLinkSub* prop, TopoDS_Shape& rShape)
|
||||
}
|
||||
auto distanceInfo = std::dynamic_pointer_cast<Part::MeasureDistanceInfo>(info);
|
||||
|
||||
rShape = *distanceInfo->getShape();
|
||||
rShape = distanceInfo->getShape();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -410,8 +410,7 @@ MeasureDistanceInfoPtr MeasureDistanceHandler(const App::SubObjectT& subject)
|
||||
|
||||
// return a persistent copy of the TopoDS_Shape here as shape will go out of scope at end
|
||||
BRepBuilderAPI_Copy copy(shape);
|
||||
const TopoDS_Shape* newShape = new TopoDS_Shape(copy.Shape());
|
||||
return std::make_shared<MeasureDistanceInfo>(true, newShape);
|
||||
return std::make_shared<MeasureDistanceInfo>(true, copy.Shape());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -37,8 +37,7 @@
|
||||
#include <App/DocumentObserver.h>
|
||||
#include <Base/Vector3D.h>
|
||||
#include <Base/Placement.h>
|
||||
|
||||
class TopoDS_Shape;
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
namespace Part {
|
||||
|
||||
@@ -93,14 +92,14 @@ public:
|
||||
class PartExport MeasureDistanceInfo : public MeasureInfo {
|
||||
public:
|
||||
MeasureDistanceInfo() = default;
|
||||
explicit MeasureDistanceInfo(bool val, const TopoDS_Shape* shp) :
|
||||
explicit MeasureDistanceInfo(bool val, const TopoDS_Shape& shp) :
|
||||
MeasureInfo(val), shape(shp) {}
|
||||
~MeasureDistanceInfo() override = default;
|
||||
|
||||
const TopoDS_Shape* getShape() { return shape; }
|
||||
const TopoDS_Shape& getShape() { return shape; }
|
||||
|
||||
private:
|
||||
const TopoDS_Shape* shape{nullptr};
|
||||
TopoDS_Shape shape;
|
||||
};
|
||||
|
||||
class PartExport MeasureLengthInfo : public MeasureInfo {
|
||||
|
||||
Reference in New Issue
Block a user