|
6 | 6 | #include "PyDbObjectId.h" |
7 | 7 | #include "BrxCvDbPoint.h" |
8 | 8 |
|
| 9 | +#if defined(_BRXTARGET) && (_BRXTARGET == 260) |
| 10 | +#include "PyBrxCvAttribVariant.h" |
| 11 | +#endif |
| 12 | + |
| 13 | + |
9 | 14 | using namespace boost::python; |
10 | 15 | void makePyBrxCvDbPointWrapper() |
11 | 16 | { |
@@ -54,6 +59,16 @@ void makePyBrxCvDbPointWrapper() |
54 | 59 | .def("referencedEntityAt", &PyBrxCvDbPoint::referencedEntityAt, DS.ARGS({ "val : int" })) |
55 | 60 | .def("update", &PyBrxCvDbPoint::update, DS.ARGS()) |
56 | 61 |
|
| 62 | +#if defined(_BRXTARGET) && (_BRXTARGET == 260) |
| 63 | + .def("addUserAttribute", &PyBrxCvDbPoint::addUserAttribute, DS.ARGS({ "name : str", "value : PyBrxCv.CvAttribVariant" })) |
| 64 | + .def("removeUserAttribute", &PyBrxCvDbPoint::removeUserAttribute, DS.ARGS({ "name : str", "value : PyBrxCv.CvDataType" })) |
| 65 | + .def("userAttributes", &PyBrxCvDbPoint::userAttributes, DS.ARGS()) |
| 66 | + .def("userAttribute", &PyBrxCvDbPoint::userAttribute, DS.ARGS({ "name : str", "value : PyBrxCv.CvDataType" })) |
| 67 | + .def("userAttributeNames", &PyBrxCvDbPoint::userAttributeNames, DS.ARGS()) |
| 68 | + .def("userAttributeCount", &PyBrxCvDbPoint::userAttributeCount, DS.ARGS()) |
| 69 | + .def("userAttributeAt", &PyBrxCvDbPoint::userAttributeAt, DS.ARGS({ "index : int" })) |
| 70 | +#endif |
| 71 | + |
57 | 72 | .def("importPointsFromFile", &PyBrxCvDbPoint::importPointsFromFile, |
58 | 73 | DS.SARGS({ "files: list[str]","fmtid: PyDb.ObjectId" })).staticmethod("importPointsFromFile") |
59 | 74 | .def("assignPointToPointGroup", &PyBrxCvDbPoint::assignPointToPointGroup, |
@@ -325,6 +340,57 @@ void PyBrxCvDbPoint::assignStylesToPoints(const boost::python::list& cvpoints, c |
325 | 340 | #endif |
326 | 341 | } |
327 | 342 |
|
| 343 | +#if defined(_BRXTARGET) && (_BRXTARGET == 260) |
| 344 | +bool PyBrxCvDbPoint::addUserAttribute(const std::string& name, const PyBrxCvAttribVariant& value) const |
| 345 | +{ |
| 346 | + return impObj()->addUserAttribute(utf8_to_wstr(name).c_str(), value.impl); |
| 347 | +} |
| 348 | + |
| 349 | +bool PyBrxCvDbPoint::removeUserAttribute(const std::string& name, BrxCvDataType type) const |
| 350 | +{ |
| 351 | + return impObj()->removeUserAttribute(utf8_to_wstr(name).c_str(), type); |
| 352 | +} |
| 353 | + |
| 354 | +boost::python::list PyBrxCvDbPoint::userAttributes() const |
| 355 | +{ |
| 356 | + PyAutoLockGIL lock; |
| 357 | + boost::python::list pylist; |
| 358 | + for (const auto& item : impObj()->userAttributes()) |
| 359 | + pylist.append(PyBrxCvAttribVariant(item)); |
| 360 | + return pylist; |
| 361 | +} |
| 362 | + |
| 363 | +PyBrxCvAttribVariant PyBrxCvDbPoint::userAttribute(const std::string& name, BrxCvDataType spec) const |
| 364 | +{ |
| 365 | + return PyBrxCvAttribVariant(impObj()->userAttribute(utf8_to_wstr(name).c_str(), spec)); |
| 366 | +} |
| 367 | + |
| 368 | +boost::python::list PyBrxCvDbPoint::userAttributeNames() const |
| 369 | +{ |
| 370 | + PyAutoLockGIL lock; |
| 371 | + boost::python::list pylist; |
| 372 | + for (const auto& item : impObj()->userAttributeNames()) |
| 373 | + pylist.append(wstr_to_utf8(item)); |
| 374 | + return pylist; |
| 375 | +} |
| 376 | + |
| 377 | +Adesk::UInt32 PyBrxCvDbPoint::userAttributeCount() const |
| 378 | +{ |
| 379 | + return impObj()->userAttributeCount(); |
| 380 | +} |
| 381 | + |
| 382 | +boost::python::tuple PyBrxCvDbPoint::userAttributeAt(Adesk::UInt32 index) const |
| 383 | +{ |
| 384 | + |
| 385 | + PyAutoLockGIL lock; |
| 386 | + AcString name; |
| 387 | + BrxCvAttribVariant variant; |
| 388 | + bool flag = impObj()->userAttributeAt(index, name, variant); |
| 389 | + return boost::python::make_tuple(flag, wstr_to_utf8(name), PyBrxCvAttribVariant{ variant }); |
| 390 | +} |
| 391 | + |
| 392 | +#endif |
| 393 | + |
328 | 394 | std::string PyBrxCvDbPoint::className() |
329 | 395 | { |
330 | 396 | return "BrxCvDbPoint"; |
|
0 commit comments