Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to fill an object in random tileable way with other objects

Community Beginner ,
May 04, 2021 May 04, 2021

Does anyone know by any chance if there are any script that can play it ,or any action plan for this?
here is an illustration what I mean, basically filling an object by creating grids from random objectScreenshot 2021-05-04 at 11.45.32.pngexpand image

its done in after effect here is the source: workbench

TOPICS
Draw and design , Feature request , Scripting , Third party plugins , Tools
3.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
May 04, 2021 May 04, 2021

The options to fill are:

- plugin Phantasm: does a good job with the grid, can do custom objects in the grid, but only one of them.

- plugins ColliderScribe and Stipplism: do a good job with randomization, but the positions will also be random and not a grid.

 

So what you can do is first create the grid with Object > Create object mosaic

Then use a script or the plugin FindReplace to select random objects and replace them by symbols using the Replace script by kelsocartography.com

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 04, 2021 May 04, 2021

thanks but I dont have the plugin

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 04, 2021 May 04, 2021

There are scripts for random selection, such as: https://github.com/marcusguttenplan/adobe_scripts

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 05, 2021 May 05, 2021

tried with findandreplace but it can handle only one object fill

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 05, 2021 May 05, 2021

What exactly did you do?

Can you show your artwork?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
May 06, 2021 May 06, 2021

Replacing tiles with random items is easy with scripting (if a bit pernickety); filling a path with tiles isn't. Doing the latter manually is easy though. This is a basic idea:

 

Step one, filling a path with tiles:

  1. Select the path and apply a fill to the path.
  2. Click Object > Rasterize.
  3. Click object > Create Object Mosaic.
  4. Ungroup the tiles.
  5. Select and delete the blank and unwanted tiles.

 

A.pngexpand image

 

Step two, replacing tiles with random items:

  1. Import or create the paths to randomly replace the tiles.
  2. Bring the paths to randomly replace the tiles to the front (Ctrl + Shift + ]), i.e. they should be at the top of the layers panel.  This is a key step. 
  3. Select all.
  4. Run the script:

 

var n = prompt("", 8, "No. of items to randomly replace tiles:");
for (var i = app.selection.length - 1; i > n - 1; i--) {
    var pos = app.selection[i].position,
    w = app.selection[i].width,
    h = app.selection[i].height;
    app.selection[i].remove();
    var index = Math.floor(Math.random() * n);
    var duple = app.selection[index].duplicate(app.activeDocument, ElementPlacement.PLACEATEND);
    duple.position = pos;
    duple.width = w;
    duple.height = h;
}

 

B.pngexpand image

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 06, 2021 May 06, 2021

Thank you femkeblanco.

A simple elegant script, it works!

I have been searching for someting like this, but could not find it.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 15, 2022 Feb 15, 2022

Hello, thanks for the script!!! Does this script exist without a randomizer?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 15, 2022 Feb 15, 2022

I mean version of this script without a randomizer

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 15, 2022 Feb 15, 2022

The problem for me is that some objects are not always used (for example, the red square in the screenshot) or the same object is duplicated twice (I also marked two blue squares in the screenshot)

кркцооцк.pngexpand image

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Feb 17, 2022 Feb 17, 2022

So you want items to randomly replace other items such that each item must be used once and only once?  (That is, the items doing the replacement and being replaced have to be equal in number, as shown in your image.)  If so, that can be easily done.  

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 17, 2022 Feb 17, 2022

Hello, Thanks for the answer! Yesterday I asked on other forums about this script, one user told to replace
"var index = Math.floor(Math.random() * n);" 
on
"var index=i%n;"

And now everything works fine! But thank you anyway for your script, this script is very good

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Feb 18, 2022 Feb 18, 2022

"var index=i%n;" will give you the same particular order each time.  To do it randomly (you can run repeatedly until you get a result you like), you can use the snippet below.  (Items doing the replacement and being replaced should be equal in number; otherwise the instructions are the same:  (1) select all items and (2) the items doing the replacement should be in front, i.e. at the top of the layers panel.)

 

var sel = app.activeDocument.selection;
var subs = [];
for (var i = 0; i < sel.length / 2; i++) {
    subs.push(sel[i]);
}
for (var i = sel.length - 1; i > sel.length / 2 - 1; i--) {
    var pos = sel[i].position,
    w = sel[i].width,
    h = sel[i].height;
    sel[i].remove();
    var index = Math.floor(Math.random() * subs.length);
    var duple = subs[index].duplicate(
        app.activeDocument, ElementPlacement.PLACEATEND);
    duple.position = pos;
    duple.width = w;
    duple.height = h;
    subs.splice(index, 1);
}

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 18, 2022 Feb 18, 2022
LATEST

Thanks! It works now without dialog window after script activation 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines