fixes #19582 Sketcher - cannot project BSpline from another sketch (#19700)

Also fixes some other types of external geo

---------

Co-authored-by: Andrew Shkolik <andrew.shkolik@selerix.com>
Co-authored-by: realthunder <realthunder.dev@gmail.com>
This commit is contained in:
Andrew
2025-02-24 10:17:24 -06:00
committed by GitHub
parent df2c6637e6
commit 0aed23ca81
3 changed files with 251 additions and 60 deletions

View File

@@ -1136,6 +1136,30 @@ Base::BoundBox3d TopoShape::getBoundBox() const
return box;
}
Base::BoundBox3d TopoShape::getBoundBoxOptimal() const
{
Base::BoundBox3d box;
try {
// If the shape is empty an exception may be thrown
Bnd_Box bounds;
BRepBndLib::AddOptimal(_Shape, bounds, false, false);
bounds.SetGap(0.0);
Standard_Real xMin, yMin, zMin, xMax, yMax, zMax;
bounds.Get(xMin, yMin, zMin, xMax, yMax, zMax);
box.MinX = xMin;
box.MaxX = xMax;
box.MinY = yMin;
box.MaxY = yMax;
box.MinZ = zMin;
box.MaxZ = zMax;
}
catch (Standard_Failure&) {
}
return box;
}
namespace {
bool getShapeProperties(const TopoDS_Shape& shape, GProp_GProps& prop)
{

View File

@@ -316,6 +316,8 @@ public:
Base::Matrix4D getTransform() const override;
/// Bound box from the CasCade shape
Base::BoundBox3d getBoundBox() const override;
/// More precise bound box from the CasCade shape
Base::BoundBox3d getBoundBoxOptimal() const;
bool getCenterOfGravity(Base::Vector3d& center) const override;
static void convertTogpTrsf(const Base::Matrix4D& mtrx, gp_Trsf& trsf);
static void convertToMatrix(const gp_Trsf& trsf, Base::Matrix4D& mtrx);