Sketcher: Intersection externals

This commit is contained in:
PaddleStroke
2024-11-08 10:57:18 +01:00
committed by WandererFan
parent c0f64a9850
commit 8c6b437314
12 changed files with 1309 additions and 168 deletions

View File

@@ -557,19 +557,35 @@ PyObject* SketchObjectPy::addExternal(PyObject* args)
{
char* ObjectName;
char* SubName;
PyObject* defining; // this is an optional argument default false
PyObject* defining; // this is an optional argument default false
PyObject* intersection; // this is an optional argument default false
bool isDefining;
if (!PyArg_ParseTuple(args, "ssO!", &ObjectName, &SubName, &PyBool_Type, &defining)) {
PyErr_Clear();
if (!PyArg_ParseTuple(args, "ss", &ObjectName, &SubName)) {
return nullptr;
bool isIntersection;
if (!PyArg_ParseTuple(args,
"ssO!O!",
&ObjectName,
&SubName,
&PyBool_Type,
&defining,
&PyBool_Type,
&intersection)) {
if (!PyArg_ParseTuple(args, "ssO!", &ObjectName, &SubName, &PyBool_Type, &defining)) {
PyErr_Clear();
if (!PyArg_ParseTuple(args, "ss", &ObjectName, &SubName)) {
return nullptr;
}
else {
isDefining = false;
}
}
else {
isDefining = false;
isDefining = Base::asBoolean(defining);
}
isIntersection = false;
}
else {
isDefining = Base::asBoolean(defining);
isIntersection = Base::asBoolean(intersection);
}
// get the target object for the external link
@@ -590,7 +606,7 @@ PyObject* SketchObjectPy::addExternal(PyObject* args)
}
// add the external
if (skObj->addExternal(Obj, SubName, isDefining) < 0) {
if (skObj->addExternal(Obj, SubName, isDefining, isIntersection) < 0) {
std::stringstream str;
str << "Not able to add external shape element " << SubName;
PyErr_SetString(PyExc_ValueError, str.str().c_str());