-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Dear all,
thanks for your opensource.
I am an occasional scripter and am trying to serialize a custom object from PyRx. I am banging my head doing as follows:
import traceback
from pyrx_imp import Ap, Db
from serialize import register_class
from serialize import dump, dumps
def textstyletablerecord_to_builtin(u): # take custom object and return python-builtin types
return (u.getName())
def textstyletablerecord_from_builtin(c): # take python-builtin types and return custom object
tstr = Db.TextStyleTableRecord()
tstr.setName(c[0])
return tstr
register_class(Db.TextStyleTableRecord, textstyletablerecord_to_builtin, textstyletablerecord_from_builtin) # registering serialization class TextStyleTableRecord
@Ap.Command()
def jsontest():
db = Db.curDb()
tstr = Db.TextStyleTableRecord() # init the custom object
print(tstr.className()) # output: AcDbTextStyleTableRecord
tstr.setName("test") # setting name att
dumps(tstr, fmt='yaml')BTW className() prints AcDbTextStyleTableRecord. Also the modules PyRx established an intermediate interface

Then dumps throws as follows:
Exception has occurred: RuntimeError
Pickling of "PyDb.TextStyleTableRecord" instances is not enabled (http://www.boost.org/libs/python/doc/v2/pickle.html)The custom object is generated in this (awesome) third party project using boost on different SDKs. I have seen a hint in the docs, but I am not sure whether this leads to anywhere or whether I should take a different path. Maybe I have just been stupid with class names.
Hints appreciated, I try to follow, but brain capacity is limited.
Regards
Seb
Metadata
Metadata
Assignees
Labels
No labels