MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / setPyObject

Method setPyObject

src/Mod/Part/App/PropertyTopoShape.cpp:188–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

186}
187
188void 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
217App::Property* PropertyPartShape::Copy() const
218{

Callers

nothing calls this directly

Calls 15

getContainerFunction · 0.85
setValuesFunction · 0.85
getStringHasherMethod · 0.80
reserveMethod · 0.80
setValueFunction · 0.70
getDocumentMethod · 0.45
getElementMapSizeMethod · 0.45
getIDMethod · 0.45
getShapeMethod · 0.45
mapSubElementMethod · 0.45
clearMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected