I need a plugin for random replacement


what I want is this: on the facada of a building I want to show some windows open, some closed and some half-closed. for that purpose I created 3 similar components. now I want to distribute them randomly on the facade. but how?

do you know of any plugins that would do that? there used to be one but I cannot find it.

thanks for any help.



There might be several. I once had a similar problem and I used @TIG 's Random Select, but I don’t know if it works with recent versions of Sketchup. I first filled the facade with identical windows, then selected a random part of them and used the “Replace selected” function in the Component Browser to substitute them.



It can be done natively using Dynamic Components and the rand or randbetween functions. Note that you can only do this with Sketchup Pro (your profile doesn’t indicate which version you’re using).

Isolate the piece(s) that change between closed, half-open, and open states. Generate a placeholder variable with either of the random functions. Create only one window as a DC. For the position/rotation of the part that changes, populate with some logic that chooses how to display it based on the placeholder variable. It could be as simple as (for a casement window that opens by hinging on one vertical edge):

placeholder = randbetween(1,3)
rotz = (placeholder-1)*45

If placeholder is 1, window is closed (rotz=0). If placeholder is 2, window is half open (rotz=45). And if placeholder is 3, window is full open (rotz=90)

By varying the logic, you can change the distribution from equal probability of each state to something like: 50% closed, 35% half open, 15% full open (rand between 1-20, 1-10 ==>closed, 11-17==> half open, 18-20 ==> fully open)

Note that either random function returns a new result each time the component is redrawn. For (IMHO) visual “wow”, instead of using many copies of the component, group what you can (those that are spaced regularly) as a single DC with copies and in the top level component, add an onclick action: REDRAW(). With this, you can click on any of the window copies in a single component and they will ALL redraw, thus redistributing the ones that appear each way!

Here’s an example of the use of randbetween, a single component with multiple copies, and onclick redrawing that I did for some kitchen w/ breakfast bar brainstorming:

You’ll have to download it into a SketchUp model to see the dynamism.
EDIT: Since I can’t figure out how to get the download link from the 3D Warehouse Viewer that I managed to put above, Here’s the 3D Warehouse link.