Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 6013

How to change the style of annotations in a block with Python?

$
0
0

@david.bismuth.archi wrote:

Hi,

I’m working on a cleaning script.
My goal is to associate every annotation of my drawing to the “Default” style.

This is the part of the script for simple objects (not in block):

def clean_annotations(annotations):
    annotations_nb=len(annotations)
    for i in range(0, annotations_nb):
        rs.DimensionStyle(annotations[i], "Default")

clean_annotations(dim)

It works : dimensions, texts and leaders style become “Default”.

I want to apply the same thing inside blocks :

blocks_names=rs.BlockNames(sort=False)
blocks_count=rs.BlockCount()

for i in range (0, blocks_count):
    objs_block_id=rs.BlockObjects(blocks_names[i])
    objs_block_nb=len(objs_block_id)
    for j in range(0, objs_block_nb):
        rs.DimensionStyle(objs_block_id[j], "Default")

This one doesn’t work and I don’t know why.

When I debug :

print objs_block_id[j]

… display the GUID (it’s good)…

print rs.DimensionStyle(objs_block_id[j])

… display the style (it’s good) but…

rs.DimensionStyle(objs_block_id[j], "Default")

doesn’ modify the style (it’s not good!).

Thank you!

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6013

Trending Articles