Repository navigation
Replies: 3 comments 5 replies
|
I’ll have to look into this, I think either |
0 replies
|
try this from pyrx import Ap, Db, Ed, Ge
import traceback
def deep_clone(id: Db.ObjectId, ownerId: Db.ObjectId):
db = id.database()
idmap = Db.IdMapping()
idmap.setDestDb(db)
db.deepCloneObjects([id], ownerId, idmap)
for pr in idmap.idPairs():
idmap.compute(pr)
if pr.key() == id:
clone = Db.Entity(pr.value(), Db.OpenMode.kForWrite)
clone.recordGraphicsModified()
return pr.value()
@Ap.Command()
def doit():
try:
_, id, _ = Ed.Editor.entSel("\nGetIt: ", Db.BlockReference.desc())
db = id.database()
cloneid = deep_clone(id, db.modelSpaceId())
#test
orig = Db.BlockReference(id)
clone = Db.BlockReference(cloneid)
print(orig.blockTableRecord() == clone.blockTableRecord())
except Exception as err:
traceback.print_exception(err) |
1 reply
|
Maybe you can add on the other hand, the interface would be incompatible with other |
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I'm trying to clone a dynamic block reference. I can only do this successfully if the bref isn't assigned an anonymous BTR.
All reactions