Python rs.ExplodeBlockInstance changes object layer of text objects


#1

I explode a block containing a text object using the script below. The objectlayer property of that text object is unintendetly set to ‘0’. the function rs.ExplodeBlockInstance should not change the objectlayer of the blockInstane contents.

import rhinoscriptsyntax as rs
import os

# main script
def main():
    
    # get objects to explode
    objs = rs.GetObjects("select objects to explode", 0, True, True)
    if not objs: print "aborted"; return

    for obj in objs:
        if rs.IsBlockInstance(obj):
            rs.ExplodeBlockInstance(obj)

if __name__ == "__main__":
    main();

Version 5 SR14 64-bit
(5.14.522.8390, 22-May-17)


(Lowell Walmsley) #2

@timcastelijn - I don’t see that happening here in a simple test running your script.
Can you attach a small file that will show that with the script?


#3

Remember - block instances reside on a particular layer, but they are just references to the original object(s) - which may be on one or more different layers. When you explode the block, the instance disappears from the layer it was on and the resulting “real” geometry goes back to the original layers the block definition objects were on at the moment the block was created.

–Mitch


#4

Hi Lowell,

thanks for your response. See the file attached: test.3dm (188.8 KB)

hi @Helvetosaur, sorry for my explaination. It was a bit poor. I meant that a text object is on ‘layer01’ at time of defining the block. When i explode an instance of that definition, the text object is on layer ‘0’, while I expect it to be on ‘Layer01’ again


#5

Don’t see that here with your test file, on exploding the text goes to layer 0.0.160.0 - 16 Contour outer +0

–Mitch


#6

Ok thanks for checking. That is different behavior from what i see here. I suspect there is a different version of e.g python/ironPython/… on my system. Do you have any suggestions where i can check the versions being used?


#7

Sorry, I just re-read your post, I see you are on Rhino V5, I had tested in V6… I do see that the text goes to the layer 0 in V5 when using rs.ExplodeBlock(). Looks like the bug has been fixed for V6.

–Mitch