Script / macro to hide objects not in block during a block edit session

Hi @dale @wim,

Any way to hide objects not in the block during a block edit session? Like a toggle or so?
I’m aware that isolating the block instance before editing is a solution. But I’m looking for other ways.

So is there a way to close and open block edit sessions by scripting in python?

Why? The isolate solution seems reasonable.

– Dale

I mean yeah. But is there a way when I double click a block the isolate triggers automatically?

Hi @keshavanarayan82,

unless other commands, the _BlockEdit command seems to be a very special case, i’ve tried to explain that in this thread answering a similar question as yours. It is still kind of problematic, either in macros (see my open bug report in the linked thread) or when scripting:

Scripting the _BlockEdit command appears first to be possible, but you will get a nasty message box even when your script is in it’s simplest form…

import rhinoscriptsyntax as rs
rs.Command("_BlockEdit", True)

you’ll notice that you get below message box in Rhino 7:

grafik

Every code (or macro) you try to run before _BlockEdit, eg. hiding all visible objects except the block you’re about to edit will run fine, but since the _BlockEdit has a modeless dialog which does not pause, the script or macro will just keep running so you’re probably showing the previously hidden objects while you’re still editing the block.

You might try below script which uses events. It is a toggle which enables or disables the requested behaviour. To test it, run it once to enable it. Then double click a block. Always click the OK button of the _BlockEdit dialog to finish editing, do not use the X button* of the dialog. To get back to normal block editing behaviour, run it again. Take care with nested blocks and excessive undo/redo of block editing while this behavior is active.

IsolatedBlockEdit.py (2.1 KB)

*more info about that bug from 6 years ago can be found here

@dale, unfortunately, i’m still not able to use _BlockEdit properly in macros. A macro will just run through while the dialog is shown. I’ve reported this here

_
c.

2 Likes

Thank you so much for the help @clement . Will take a look and get back :cowboy_hat_face:

This is such a disappointing tone deaf response, instead of trying to find a solution.
It gets quite annoying after a while to Isolate - block edit - close - UnIsolate.

I tried to find a solution with Macro, but Isolate doesn’t work with Macro. It could be Invert - Hide - Blockedit, but then when you Show objects after closing, it will show everything that had been hidden before block edit. (That is, if Block Edit works with Macro)

Isolating Block Edit is a big missing feature, there should be two ways, in-place edit and isolation edit.
Currently, you can’t even easily use Block Edit because if you lock something then unlock while block editing, it will unlock every object in the file (?!).

In the same token, linked file edit should have an option to edit in-place instead of opening a new Rhino. You lose all the reference if you need it to edit from.

1 Like