[TD]fix Landmark dim with datum points

This commit is contained in:
wandererfan
2023-12-20 19:31:53 -05:00
parent 2cc6c1f504
commit 6ce41201cd
3 changed files with 24 additions and 14 deletions

View File

@@ -87,19 +87,16 @@ short LandmarkDimension::mustExecute() const
App::DocumentObjectExecReturn *LandmarkDimension::execute()
{
Base::Console().Message("LD::execute() - %s\n", getNameInDocument());
if (!keepUpdated()) {
// Base::Console().Message("LD::execute() - %s\n", getNameInDocument());
if (!okToProceed()) {
return App::DocumentObject::StdReturn;
}
DrawViewPart* dvp = getViewPart();
if (!dvp) {
return App::DocumentObject::StdReturn;
}
References2D.setValue(dvp);
std::vector<DocumentObject*> features = References3D.getValues();
Base::Console().Message("LD::execute - features: %d\n", features.size());
// Base::Console().Message("LD::execute - features: %d\n", features.size());
//if distance, required size = 2
//if angle, required size = 3; //not implemented yet
unsigned int requiredSize = 2;
@@ -130,18 +127,18 @@ App::DocumentObjectExecReturn *LandmarkDimension::execute()
index++;
}
}
Base::Console().Message("LD::execute - front: %s back: %s\n",
DrawUtil::formatVector(points.front()).c_str(),
DrawUtil::formatVector(points.back()).c_str());
// Base::Console().Message("LD::execute - front: %s back: %s\n",
// DrawUtil::formatVector(points.front()).c_str(),
// DrawUtil::formatVector(points.back()).c_str());
setLinearPoints(points.front(), points.back());
App::DocumentObjectExecReturn* dvdResult = DrawViewDimension::execute();
// App::DocumentObjectExecReturn* dvdResult = DrawViewDimension::execute();
dvp->addReferencesToGeom();
dvp->requestPaint();
// dvp->requestPaint();
overrideKeepUpdated(false);
return dvdResult;
return DrawView::execute();
}
Base::Vector3d LandmarkDimension::projectPoint(const Base::Vector3d& pt, DrawViewPart* dvp) const

View File

@@ -406,13 +406,15 @@ bool ShapeExtractor::isEdgeType(App::DocumentObject* obj)
bool ShapeExtractor::isPointType(App::DocumentObject* obj)
{
// Base::Console().Message("SE::isPointType(%s)\n", obj->getNameInDocument());
// Base::Console().Message("SE::isPointType(%s)\n", obj->getNameInDocument());
if (obj) {
Base::Type t = obj->getTypeId();
if (t.isDerivedFrom(Part::Vertex::getClassTypeId())) {
return true;
} else if (isDraftPoint(obj)) {
return true;
} else if (isDatumPoint(obj)) {
return true;
}
}
return false;
@@ -433,11 +435,21 @@ bool ShapeExtractor::isDraftPoint(App::DocumentObject* obj)
return false;
}
bool ShapeExtractor::isDatumPoint(App::DocumentObject* obj)
{
std::string objTypeName = obj->getTypeId().getName();
std::string pointToken("Point");
if (objTypeName.find(pointToken) != std::string::npos) {
return true;
}
return false;
}
//! get the location of a point object
Base::Vector3d ShapeExtractor::getLocation3dFromFeat(App::DocumentObject* obj)
{
Base::Console().Message("SE::getLocation3dFromFeat()\n");
// Base::Console().Message("SE::getLocation3dFromFeat()\n");
if (!isPointType(obj)) {
return Base::Vector3d(0.0, 0.0, 0.0);
}

View File

@@ -50,6 +50,7 @@ public:
static bool isEdgeType(App::DocumentObject* obj);
static bool isPointType(App::DocumentObject* obj);
static bool isDraftPoint(App::DocumentObject* obj);
static bool isDatumPoint(App::DocumentObject* obj);
static Base::Vector3d getLocation3dFromFeat(App::DocumentObject *obj);
static TopoDS_Shape stripInfiniteShapes(TopoDS_Shape inShape);