-
Hi, I want to set Block's base_point attribute after it is created, such as blk = doc.new_anonymous_block() I try to use ways below, and always return blk.base_point = Vec3(-10, -10, 0) and blk.__setattr__("base_point", Vec3(-10, -10, 0)) and setattr(blk, "base_point", Vec3(-10, -10, 0)) and some other ways This is my source code: import ezdxf
from ezdxf.math import Vec3
from ezdxf.enums import TextEntityAlignment
from ezdxf.tools.text_size import text_size
doc = ezdxf.new(dxfversion="R2018", setup=["linetypes"])
msp = doc.modelspace()
blk = doc.blocks.new_anonymous_block()
text = blk.add_text(text="0.1", dxfattribs={"height": 4, "width": 1, }).set_placement((10, 10), align=TextEntityAlignment.MIDDLE)
blk.__setattr__("base_point", Vec3((-10, -10, 0)))
msp.add_blockref(blk.name, insert=(0, 0))
doc.saveas("output/set_block_base_point.dxf") Anyone here can help me? Thanks very much:) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The method If that's not good enough, the method returns a blk.block.dxf.base_point = Vec3(-10, -10, 0) |
Beta Was this translation helpful? Give feedback.
The method
new_anonymous_block()
has an argumentbase_point
to define the block base point.If that's not good enough, the method returns a
BlockLayout
instance that has an attributeblock
which is aBlock
instance of the relatedBLOCK
entity, which represents thatBlockLayout
. TheBlock
entity contains the desired DXF attributebase_point
.