-
Should this work on ZWCAD? or is dynamic block properties support only available in AutoCAD? bref: Db.BlockReference = ...
ax_bref = Ax.AcadBlockReference.cast(bref.objectId().acadObject())
ax_bref.dynamicBlockProperties()
#
RuntimeError:
Exception! Object is NULL, in function GetDynamicBlockProperties, Line 4728, File PyAcadEntityImpl.cpp: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
seems to work from pyrx import Rx, Ge, Gi, Db, Ap, Ed, Ax, command
#M:\Dev\Projects\PyRxGit\PySamples\dwg\dynamicBlock.dwg
@command
def xdoit():
ps, id, _ = Ed.Editor.entSel("\nSel", Db.BlockReference.desc())
axRef = Ax.AcadBlockReference.cast(id.acadObject())
if axRef.isDynamicBlock():
props: list[Ax.AcadDynamicBlockReferenceProperty] # hint
props = axRef.dynamicBlockProperties()
for prop in props:
print(prop.value()) |
Beta Was this translation helpful? Give feedback.
-
Just a note, you should not mix Db and Ax if the object is opened, otherwise it’s undefined behavior. Make sure bref is closed or garbage collected before getting ax_bref This is a flaw in AutoCAD’s .net API because your forced to have the Db object opened kForead to get the AcadObject, then all ‘set functions fail because the object is opened kForread hope that makes sense |
Beta Was this translation helpful? Give feedback.
Just a note, you should not mix Db and Ax if the object is opened, otherwise it’s undefined behavior.
Ax opens and closes on every function call, possibly changing the state of the DbObject
Make sure bref is closed or garbage collected before getting ax_bref
This is a flaw in AutoCAD’s .net API because your forced to have the Db object opened kForead to get the AcadObject, then all ‘set functions fail because the object is opened kForread
hope that makes sense