Replace Block Behaviour

I would like to use ReplaceBlock in an alias, however, it has two different options depending on whether or not you’ve selected all or just some instances of the block. Is there any way around this?

The end result that I’m looking for is to have an alias that behaves something like this:

Select the instances to replace.
Input the command.
The SelectFromBlockDefinitionList window opens.

Any insight would be greatly appreciated.

Cheers!

Hello -

! _ReplaceBlock _Pause _SelectFromBlockDefinitionList

should do it.

-Pascal

Lightning fast! No luck though. Unfortunately, that only works if you select all of the instances but if you select any less than that it fails. I was able to get it to work one way or the other but was unable to have a single catch all command because of the the two different paths it takes you on.

Yeah, I see - I do not see a good way around this, currently. The flow needs to change to include that All option regardless of the selection, I would say - it is not clear to me what the ‘additional instances’ thing brings to the party that is not just inherent in just plain selection for the command - but I confess I do not use the command in real life.

-Pascal

dirty trick seems to work:

ReplaceBlock _Pause _SelectFromBlockDefinitionList _None _SelectFromBlockDefinitionList

3 Likes

so that you can select one instance and pick ‘all’ without having to search it in your file

Hi Gijs - I get All, I don’t get the selection (via picking) prompt. Should be an All=Yes/No toggle…?

-Pascal

Ha, I see what you did there. Nice one!

Thanks!

so that you can visually select another block definition/instance in the scene instead of through the list

Hi Gijs - but you have that anyway when you initially select, is what I was thinking - seems like you’d select what you want to select to begin with and not need an opportunity to do it again, just an All option… but maybe I need to play more.

-Pascal

1 Like

I’m not sure we talk about the same thing, but if I preselect, and select not all but 1 instance of the same block, I get the question All/none, then the next question is
Select instance using desired block definition ( SelectFromBlockDefinitionList )
here I can change the selected block instance with another block instance definition visually or through the list. I think the text is a bit confusing though and should more read like::
Select an instance block to replace it with or…SelectFromBlockDefinitionList

Hi Gijs - it’s the prompt for ‘Additional selectable instances to change (None All):’ that (I think) is superfluous. I can’t grok why this step is in there.

-Pascal

To me it is not superfluous. For example: suppose I want to change all instances of a block, then I can select one, and use the option ‘All’ to select the remaining of the same kind, without having to go through the scene selecting them, I use this quite often this way. At this stage I cannot pick additional block instances manually only ‘no additional of the same’ or ‘all of the same’

There are more command-line prompt scenarios in case there are instances that are hidden, locked or both… but I agree in some scenarios each case could be useful while seemingly superfluos.

Hi Gijs, Jarek - selecting All makes perfect sense to me; the prompt to manually select more blocks to change is what seems peculiar - it needlessly messes up the flow of the command as the OP encountered, and your dirty trick works around.

I think All can be a toggle ChangeAllInstances=Yes/No, so that after the initial selection, or with pre-selection, the next prompt is for blocks to replace with, or select from a list.

Select instances for block definition change (SelectFromBlockDefinitionList):

Select replacement block (ChangeAllInstances=Yes/No SelectFromBlockDefinitionList):

etc etc.

Anyway, that seems cleaner to me… it makes the OP’s macro possible with no trickery and allows your All. I don’t think it breaks any functionality.

OK, two hearts = YT item.
https://mcneel.myjetbrains.com/youtrack/issue/RH-56772
Thanks, all.

-Pascal

4 Likes