| 186 | } |
| 187 | |
| 188 | void PropertyPartShape::setPyObject(PyObject* value) |
| 189 | { |
| 190 | if (PyObject_TypeCheck(value, &(TopoShapePy::Type))) { |
| 191 | auto shape = *static_cast<TopoShapePy*>(value)->getTopoShapePtr(); |
| 192 | auto owner = dynamic_cast<App::DocumentObject*>(getContainer()); |
| 193 | if (owner && owner->getDocument()) { |
| 194 | if (shape.Tag || shape.getElementMapSize()) { |
| 195 | // We can't trust the meaning of the input shape tag, so we |
| 196 | // remap anyway |
| 197 | TopoShape res(owner->getID(), owner->getDocument()->getStringHasher(), shape.getShape()); |
| 198 | res.mapSubElement(shape); |
| 199 | shape = res; |
| 200 | } |
| 201 | else { |
| 202 | shape.Tag = owner->getID(); |
| 203 | if (shape.Hasher) { // TODO: This null guard added during TNP transition |
| 204 | shape.Hasher->clear(); |
| 205 | } |
| 206 | } |
| 207 | } |
| 208 | setValue(shape); |
| 209 | } |
| 210 | else { |
| 211 | std::string error = std::string("type must be 'Shape', not "); |
| 212 | error += value->ob_type->tp_name; |
| 213 | throw Base::TypeError(error); |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | App::Property* PropertyPartShape::Copy() const |
| 218 | { |
nothing calls this directly
no test coverage detected