Merge branch 'FreeCAD:main' into cleanmodPart
This commit is contained in:
@@ -113,6 +113,7 @@
|
||||
#include "SolverGeometryExtension.h"
|
||||
|
||||
#include "ExternalGeometryFacade.h"
|
||||
#include <Mod/Part/App/Datums.h>
|
||||
|
||||
|
||||
#undef DEBUG
|
||||
@@ -8265,6 +8266,9 @@ void SketchObject::validateExternalLinks()
|
||||
const Part::Datum* datum = static_cast<const Part::Datum*>(Obj);
|
||||
refSubShape = datum->getShape();
|
||||
}
|
||||
else if (Obj->isDerivedFrom<App::DatumElement>()) {
|
||||
// do nothing - shape will be calculated later during rebuild
|
||||
}
|
||||
else {
|
||||
const Part::Feature* refObj = static_cast<const Part::Feature*>(Obj);
|
||||
const Part::TopoShape& refShape = refObj->Shape.getShape();
|
||||
@@ -9202,6 +9206,35 @@ void SketchObject::rebuildExternalGeometry(std::optional<ExternalToAdd> extToAdd
|
||||
TopoDS_Face f = TopoDS::Face(fBuilder.Shape());
|
||||
refSubShape = f;
|
||||
}
|
||||
else if (Obj->isDerivedFrom<Part::DatumLine>()) {
|
||||
auto* line = static_cast<const Part::DatumLine*>(Obj);
|
||||
Base::Placement plm = line->Placement.getValue();
|
||||
Base::Vector3d base = plm.getPosition();
|
||||
Base::Vector3d dir = line->getDirection();
|
||||
gp_Lin l(gp_Pnt(base.x, base.y, base.z), gp_Dir(dir.x, dir.y, dir.z));
|
||||
BRepBuilderAPI_MakeEdge eBuilder(l);
|
||||
if (!eBuilder.IsDone()) {
|
||||
throw Base::RuntimeError(
|
||||
"Sketcher: addExternal(): Failed to build edge from Part::DatumLine");
|
||||
}
|
||||
|
||||
TopoDS_Edge e = TopoDS::Edge(eBuilder.Shape());
|
||||
refSubShape = e;
|
||||
}
|
||||
else if (Obj->isDerivedFrom<Part::DatumPoint>()) {
|
||||
auto* point = static_cast<const Part::DatumPoint*>(Obj);
|
||||
Base::Placement plm = point->Placement.getValue();
|
||||
Base::Vector3d base = plm.getPosition();
|
||||
gp_Pnt p(base.x, base.y, base.z);
|
||||
BRepBuilderAPI_MakeVertex eBuilder(p);
|
||||
if (!eBuilder.IsDone()) {
|
||||
throw Base::RuntimeError(
|
||||
"Sketcher: addExternal(): Failed to build vertex from Part::DatumPoint");
|
||||
}
|
||||
|
||||
TopoDS_Vertex v = TopoDS::Vertex(eBuilder.Shape());
|
||||
refSubShape = v;
|
||||
}
|
||||
else {
|
||||
throw Base::TypeError(
|
||||
"Datum feature type is not yet supported as external geometry for a sketch");
|
||||
|
||||
Reference in New Issue
Block a user