Blocks auto-export (and linking)

Background: we need two things.

  • linked blocks
  • editing blocks “in context”

I wrote a function in python that exports all the blocks to different subfolders depending on their name, and then link them to this fresh export. So we set all the blocks to Embedded and linked, we can edit the block’s embedded version, giving us access to the context (add/remove objects, and just seeing what’s around), and then launch this function. And this is great!

But, I wanted to make this automatic, whenever a block is modified or renamed, and for some reason I cannot. success is always False when this code runs in an InstanceDefinitionEvent handler.

# ...
export_command= '_-BlockManager _Export "{}" "{}" _Enter _Enter'.format(idef.Name, file_path)
success = rs.Command(export_command)
# ...

Any idea why, anyone? Thanks.

There must be something in the order / timing of events that I don’t quite get right. Anyway, I solved my issue by filling a queue in command and block table events, and processing it in idle events. Feels like a hack, but it works.

hello @Becquelin , would you share how you work with this function and the function? I am very curios if and how I could implement it in my work and with it maybe make the handling of big files easier.

best regards,
sebowim

Sorry I can’t, it’s company IP!