Skip to content

Fail to set the DIMENSION entities' layer #1152

Answered by mozman
SeanXunIC asked this question in Q&A
Discussion options

You must be logged in to vote

The DIMENSION entity stores the parameters for the dimension line. The visual representation is rendered into an anonymous geometry block "*Dnnnn" .

To change the layer of the visual representation you have to re-render the dimension line - the result will look different than the rendering from CAD applications, or you change the layer of all entities in the geometry block:

The copy/remove procedure of your code is not necessary, layers are not containers they are just attributes.

for dimension in msp.query(f'DIMENSION[layer=="{ori_dim_layer_name}"]'): 
    dimension.dxf.layer = new_dim_layer_name
    block = dimension.get_geometry_block()
    if block:
        for entity in block:
      …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@SeanXunIC
Comment options

Answer selected by SeanXunIC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1151 on August 28, 2024 10:08.