-
Dear all, I would like to be able to develop (label) styles and export/import them in clear text. This way it is possible to store them for versioning in a repository. Import/export workflow should overwrite style independant of its objectId. I have seen the following approaches Formats could be json, txt, csv etc. I would start out as follows: import traceback
from pyrx_imp import Ap, Db, Cv
def PyRxCmd_doit9():
try:
db = Db.curDb()
bt = Db.BlockTable(db.blockTableId())
styleid = Cv.CvDbSymbolStyleManager.getManagerId(db)
manager = Cv.CvDbSymbolStyleManager(styleid, Db.OpenMode.kForRead)
for id in manager.ids():
style = Cv.CvDbStyle(id)
print(style.name())
except Exception:
traceback.print_exc() Suggestions appreciated. Best Seb |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
I need a deeper introduction to comment (I don't work on Bricscad). I don't fully understand what you want to do, what the goal is and what are the issues to solve. |
Beta Was this translation helpful? Give feedback.
-
Without knowing what I do I have discovered a pickle interface for import traceback
from pyrx_imp import Ap, Db, Ge
from serialize import dump, dumps
from serialize import load, loads
@Ap.Command()
def serializetest():
try:
db = Db.curDb()
p2 = Ge.Point3d(50, 25, 0)
print(dumps(p2, fmt='yaml'))
tmp = dumps(p2, fmt='yaml')
tmp = loads(tmp, fmt='yaml')
print(tmp)
except Exception as err:
traceback.print_exception(err) I receive the output
To my disorientated understanding this respresents a complete workthrough for pickling. Is it correct thus to assume, that when adding the method Don't know whether this leads anywhere... Best Seb |
Beta Was this translation helpful? Give feedback.
-
Unfortunately, I don’t think pickle would work on Database objects due to them having ownership and relationships with other objects. If: Style is in the database, update the properties |
Beta Was this translation helpful? Give feedback.
BTW, I had mentioned DXF, consider this sample where you can make a text style, you would need to look up the DXF codes, but this would be easy to serialize