Go inside block definitions and run cap - script


I am facing some batch editting problem.

Some of my imported rebars are not closed polysurfaces. Group of same rebars are contained inside a block and one actual rebar visible is one solid geometry put in a block. So its level 2 of nested blocks, all the rebars.

I am looking for a script which would go into all blocks selected (there are not so many definitions because unique rebars are not so many), select geometry which is usually closed polysurface or open polysurface without capped ends (for unknown reason), run cap command, thats it

@pascal I suspect you are the king of this kind of helpful scripts. Could you please have a look? If i want to solve this myself i will spend two days to find a way.

It is a little involved, it looks like, but I will see if I can make something that works.
@ivan.galik - as always, guaranteed ‘somewhat tested’. See if this does the right things -

CapInBlocks.py (2.6 KB)

To use the Python script use RunPythonScript, or a macro:

_-RunPythonScript "Full path to py file inside double-quotes"


1 Like

It worked as expected and executed quite quickly. Thanks. I am putting this in my collection of useful script with anticipated reuse in future :slight_smile: