-
|
When setting the position and scale of a block reference, the corresponding attribute parameters don't change. Is this normal? Do I have to go through all the attributes and do it manually? from pyrx import Db, Ge, command
from pyrx.ed.prompt import entsel
@command
def doit2():
bref_id = entsel("\nSelect a block reference: ")
set_pos(bref_id)
def set_pos(obj_id: Db.ObjectId):
bref = Db.BlockReference(obj_id, Db.OpenMode.kForWrite)
bref.setPosition(Ge.Point3d(100.0, 100.0, 0.0))
bref.recordGraphicsModified() |
Beta Was this translation helpful? Give feedback.
Answered by
CEXT-Dan
Feb 11, 2026
Replies: 2 comments 4 replies
-
|
seems so, or use def set_ref_pos(obj_id: Db.ObjectId, pnt: Ge.Point3d):
bref = Db.BlockReference(obj_id, Db.OpenMode.kForWrite)
bref.transformBy(Ge.Matrix3d.translation(pnt - bref.position())) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
gswifort
-
|
I do it like this: cur_block_transform = bref.blockTransform()
bref.setPosition(...)
bref.setRotation(...)
bref.setScaleFactors(...)
new_block_transform = bref.blockTransform()
diff_transform = new_block_transform * cur_block_transform.inverse()
for attr in (
Db.AttributeReference(attr, Db.OpenMode.kForWrite)
for attr in self.bref.attributeIds()
):
attr.transformBy(diff_transform) |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

seems so, or use
transformBy