Centralize the check for valid external geometry to ensure consistency (part 2)
This commit is contained in:
parent
be9365679f
commit
02ce7395aa
|
@ -384,20 +384,10 @@ PyObject* SketchObjectPy::addExternal(PyObject *args)
|
||||||
PyErr_SetString(PyExc_ValueError, str.str().c_str());
|
PyErr_SetString(PyExc_ValueError, str.str().c_str());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// check if it is a datum feature
|
// check if this type of external geometry is allowed
|
||||||
// TODO: Allow selection only from Body which this sketch belongs to?
|
if (!skObj->isExternalAllowed(Obj->getDocument(), Obj)) {
|
||||||
if (Obj->getTypeId().isDerivedFrom(Part::Datum::getClassTypeId())) {
|
|
||||||
// OK
|
|
||||||
} else if (Obj->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
|
||||||
if (!skObj->allowOtherBody && (skObj->Support.getValue() != Obj)) {
|
|
||||||
std::stringstream str;
|
std::stringstream str;
|
||||||
str << ObjectName << " is not supported by this sketch";
|
str << ObjectName << " is not allowed as external geometry of this sketch";
|
||||||
PyErr_SetString(PyExc_ValueError, str.str().c_str());
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
} else if (!Obj->getTypeId().isDerivedFrom(App::Plane::getClassTypeId())) {
|
|
||||||
std::stringstream str;
|
|
||||||
str << ObjectName << " must be a Part feature or a datum feature";
|
|
||||||
PyErr_SetString(PyExc_ValueError, str.str().c_str());
|
PyErr_SetString(PyExc_ValueError, str.str().c_str());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user