Merge pull request #18346 from wwmayer/fix_sketch

Fix SketchObjectPy::addExternal
This commit is contained in:
Chris Hennes
2024-12-13 11:37:51 -05:00
committed by GitHub
2 changed files with 10 additions and 25 deletions

View File

@@ -555,39 +555,24 @@ PyObject* SketchObjectPy::carbonCopy(PyObject* args)
PyObject* SketchObjectPy::addExternal(PyObject* args)
{
char* ObjectName;
char* SubName;
PyObject* defining; // this is an optional argument default false
PyObject* intersection; // this is an optional argument default false
bool isDefining;
bool isIntersection;
char* ObjectName = nullptr;
char* SubName = nullptr;
PyObject* defining = Py_False;
PyObject* intersection = Py_False;
if (!PyArg_ParseTuple(args,
"ssO!O!",
"ss|O!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 = Base::asBoolean(defining);
}
isIntersection = false;
}
else {
isDefining = Base::asBoolean(defining);
isIntersection = Base::asBoolean(intersection);
return nullptr;
}
bool isDefining = Base::asBoolean(defining);
bool isIntersection = Base::asBoolean(intersection);
// get the target object for the external link
Sketcher::SketchObject* skObj = this->getSketchObjectPtr();
App::DocumentObject* Obj = skObj->getDocument()->getObject(ObjectName);