[TD]2 pass autoscale for DVD, DVS

This commit is contained in:
wandererfan
2020-02-12 07:37:20 -05:00
committed by WandererFan
parent 3a42205cb4
commit 48fc14efcb
6 changed files with 70 additions and 27 deletions

View File

@@ -225,6 +225,29 @@ App::DocumentObjectExecReturn *DrawViewDetail::execute(void)
//unblock
}
detailExec(shape, dvp, dvs);
//second pass if required
if (ScaleType.isValue("Automatic")) {
if (!checkFit()) {
double newScale = autoScale();
Scale.setValue(newScale);
Scale.purgeTouched();
if (geometryObject != nullptr) {
delete geometryObject;
geometryObject = nullptr;
detailExec(shape, dvp, dvs);
}
}
}
dvp->requestPaint(); //to refresh detail highlight!
return DrawView::execute();
}
void DrawViewDetail::detailExec(TopoDS_Shape shape,
DrawViewPart* dvp,
DrawViewSection* dvs)
{
Base::Vector3d anchor = AnchorPoint.getValue(); //this is a 2D point (in unrotated coords)
Base::Vector3d dirDetail = dvp->Direction.getValue();
@@ -269,7 +292,7 @@ App::DocumentObjectExecReturn *DrawViewDetail::execute(void)
TopoDS_Face aProjFace = mkFace.Face();
if(aProjFace.IsNull()) {
Base::Console().Warning("DVD::execute - %s - failed to create tool base face\n", getNameInDocument());
return DrawView::execute();
return;
}
Base::Vector3d extrudeVec = dirDetail * extrudeLength;
@@ -279,11 +302,11 @@ App::DocumentObjectExecReturn *DrawViewDetail::execute(void)
BRepAlgoAPI_Common mkCommon(copyShape,tool);
if (!mkCommon.IsDone()) {
Base::Console().Warning("DVD::execute - %s - detail cut operation failed (1)\n", getNameInDocument());
return DrawView::execute();
return;
}
if (mkCommon.Shape().IsNull()) {
Base::Console().Warning("DVD::execute - %s - detail cut operation failed (2)\n", getNameInDocument());
return DrawView::execute();
return;
}
//Did we get a solid?
@@ -310,7 +333,7 @@ App::DocumentObjectExecReturn *DrawViewDetail::execute(void)
}
dvp->requestPaint();
Base::Console().Warning("DVD::execute - %s - detail area contains no geometry\n", getNameInDocument());
return DrawView::execute();
return;
}
//for debugging show compound instead of common
@@ -358,7 +381,7 @@ App::DocumentObjectExecReturn *DrawViewDetail::execute(void)
}
catch (Standard_Failure& e4) {
Base::Console().Log("LOG - DVD::execute - extractFaces failed for %s - %s **\n",getNameInDocument(),e4.GetMessageString());
return new App::DocumentObjectExecReturn(e4.GetMessageString());
return;
}
}
@@ -366,18 +389,12 @@ App::DocumentObjectExecReturn *DrawViewDetail::execute(void)
}
catch (Standard_Failure& e1) {
Base::Console().Message("LOG - DVD::execute - failed to create detail %s - %s **\n",getNameInDocument(),e1.GetMessageString());
return new App::DocumentObjectExecReturn(e1.GetMessageString());
return;
}
addCosmeticVertexesToGeom();
addCosmeticEdgesToGeom();
addCenterLinesToGeom();
requestPaint();
dvp->requestPaint(); //to refresh detail highlight!
return DrawView::execute();
}
double DrawViewDetail::getFudgeRadius()