[TD]Long and link dim refs (fix #13375) (#18641)

* [Meas]Changes for TD dimension refs for links

* [TD]App changes for dim refs to links

* [TD]Gui changes for dim refs to links

* [TD]fix 2 lint messages

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
WandererFan
2024-12-23 17:36:22 -05:00
committed by GitHub
parent a13ecd87db
commit f144a87539
16 changed files with 1092 additions and 198 deletions

View File

@@ -48,6 +48,7 @@
#include "Measurement.h"
#include "MeasurementPy.h"
#include "ShapeFinder.h"
using namespace Measure;
@@ -278,43 +279,12 @@ MeasureType Measurement::getType()
return measureType;
}
TopoDS_Shape Measurement::getShape(App::DocumentObject* rootObj, const char* subName) const
TopoDS_Shape Measurement::getShape(App::DocumentObject* obj, const char* subName) const
{
std::vector<std::string> names = Base::Tools::splitSubName(subName);
if (names.empty()) {
TopoDS_Shape shape = Part::Feature::getShape(rootObj);
if (shape.IsNull()) {
throw Part::NullShapeException("null shape in measurement");
}
return shape;
}
try {
App::DocumentObject* obj = rootObj->getSubObject(subName);
Part::TopoShape partShape = Part::Feature::getTopoShape(obj);
partShape.setPlacement(App::GeoFeature::getGlobalPlacement(obj, rootObj, subName));
TopoDS_Shape shape = partShape.getSubShape(names.back().c_str());
if (shape.IsNull()) {
throw Part::NullShapeException("null shape in measurement");
}
return shape;
}
catch (const Base::Exception&) {
// re-throw original exception
throw;
}
catch (Standard_Failure& e) {
throw Base::CADKernelError(e.GetMessageString());
}
catch (...) {
throw Base::RuntimeError("Measurement: Unknown error retrieving shape");
}
return ShapeFinder::getLocatedShape(*obj, subName);
}
// TODO:: add lengthX, lengthY (and lengthZ??) support
// Methods for distances (edge length, two points, edge and a point
double Measurement::length() const