Sketcher: Chamfer tool (and fillet refactor)

This commit is contained in:
PaddleStroke
2024-03-12 11:45:08 +01:00
committed by WandererFan
parent 9d43e7fda7
commit b3fe5bba28
12 changed files with 1342 additions and 420 deletions

View File

@@ -1196,11 +1196,12 @@ PyObject* SketchObjectPy::fillet(PyObject* args)
int geoId1, geoId2, posId1;
int trim = true;
PyObject* createCorner = Py_False;
PyObject* chamfer = Py_False;
double radius;
// Two Lines, radius
if (PyArg_ParseTuple(args,
"iiO!O!d|iO!",
"iiO!O!d|iO!O!",
&geoId1,
&geoId2,
&(Base::VectorPy::Type),
@@ -1210,15 +1211,23 @@ PyObject* SketchObjectPy::fillet(PyObject* args)
&radius,
&trim,
&PyBool_Type,
&createCorner)) {
&createCorner,
&PyBool_Type,
&chamfer)) {
// The i for &trim should probably have been a bool like &createCorner, but we'll leave it
// an int for backward compatibility (and because python will accept a bool there anyway)
Base::Vector3d v1 = static_cast<Base::VectorPy*>(pcObj1)->value();
Base::Vector3d v2 = static_cast<Base::VectorPy*>(pcObj2)->value();
if (this->getSketchObjectPtr()
->fillet(geoId1, geoId2, v1, v2, radius, trim, Base::asBoolean(createCorner))) {
if (this->getSketchObjectPtr()->fillet(geoId1,
geoId2,
v1,
v2,
radius,
trim,
Base::asBoolean(createCorner),
Base::asBoolean(chamfer))) {
std::stringstream str;
str << "Not able to fillet curves with ids : (" << geoId1 << ", " << geoId2
<< ") and points (" << v1.x << ", " << v1.y << ", " << v1.z << ") & "
@@ -1232,18 +1241,21 @@ PyObject* SketchObjectPy::fillet(PyObject* args)
PyErr_Clear();
// Point, radius
if (PyArg_ParseTuple(args,
"iid|iO!",
"iid|iO!O!",
&geoId1,
&posId1,
&radius,
&trim,
&PyBool_Type,
&createCorner)) {
&createCorner,
&PyBool_Type,
&chamfer)) {
if (this->getSketchObjectPtr()->fillet(geoId1,
static_cast<Sketcher::PointPos>(posId1),
radius,
trim,
Base::asBoolean(createCorner))) {
Base::asBoolean(createCorner),
Base::asBoolean(chamfer))) {
std::stringstream str;
str << "Not able to fillet point with ( geoId: " << geoId1 << ", PointPos: " << posId1
<< " )";