# Problem with geomerative and list

**URL:** https://discourse.processing.org/t/problem-with-geomerative-and-list/27199
**Category:** Libraries
**Created:** [January 19, 2021, 12:53pm UTC](https://discourse.processing.org/t/problem-with-geomerative-and-list/27199 "2021-01-19T12:53:44Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![robottini](https://avatars.discourse-cdn.com/v4/letter/r/439d5e/32.png) [@robottini](https://discourse.processing.org/u/robottini)
#### Post date: [January 19, 2021, 12:53pm UTC](https://discourse.processing.org/t/problem-with-geomerative-and-list/27199/1 "2021-01-19T12:53:44Z")

</div>

I have a problem with geomerative and a list of shapes. I think it is trivial, but I don’t understand my error.

If I use this sketch I don’t have any problem.

```auto
import geomerative.*;

void setup() 
{
  size(800, 400); 
  smooth();
  background(255);
  noFill();
  RG.init(this);
  stroke(0);
  RShape R = RShape.createRectangle(0, 100, 100, 100);

  for (int i = 0; i < 5; i++)
  {
    R.translate(120, 0);
    R.draw();
  }
}

void draw() {
}

```

I obtain the right result  
If I use a list with this code, I see only the last item of the list:

```auto
import geomerative.*;
ArrayList<RShape> shapeList = new ArrayList<RShape>();

void setup() 
{
  size(800, 400); 
  smooth();
  background(255);
  noFill();
  RG.init(this);
  stroke(0);
  RShape R = RShape.createRectangle(0, 100, 100, 100);

  for (int i = 0; i < 5; i++)
  {
    R.translate(120, 0);
    shapeList.add(R);
  }

  for (int i=0; i<shapeList.size(); i++) {
    shapeList.get(i).draw();
  }
}

void draw() {
}

```

The two results.

 ![3](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/7/7e6ea1658df4c319058bc6a0f1bc18c21735ab2b.png)

Where is the problem?

---

<div class="post-metadata">

### Author: ![CodeMasterX](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/codemasterx/32/2942_2.png) [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)
#### Post date: [January 19, 2021, 12:58pm UTC](https://discourse.processing.org/t/problem-with-geomerative-and-list/27199/2 "2021-01-19T12:58:03Z")

</div>

the issue is that you don’t change the positions. What you are currently doing is stacking them on top of eachother  
the R.translate(120,0) doesn’t work this way.  
In the for loop just do

```auto
for8int i = 0; i < 5; i++) {
   shapeList.add(RShape.createRectangle(i*50,100,100,100));
}

```

(I am not shore about the syntax for geomerative library

---

<div class="post-metadata">

### Author: ![robottini](https://avatars.discourse-cdn.com/v4/letter/r/439d5e/32.png) [@robottini](https://discourse.processing.org/u/robottini)
#### Post date: [January 19, 2021, 12:59pm UTC](https://discourse.processing.org/t/problem-with-geomerative-and-list/27199/3 "2021-01-19T12:59:32Z")

</div>

I change the position. I translate every time the position with the R.translate(120,0).

---

<div class="post-metadata">

### Author: ![CodeMasterX](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/codemasterx/32/2942_2.png) [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)
#### Post date: [January 19, 2021, 1:01pm UTC](https://discourse.processing.org/t/problem-with-geomerative-and-list/27199/4 "2021-01-19T13:01:38Z")

</div>

> [@CodeMasterX](#):
>
> the R.translate(120,0) doesn’t work this way.

it doesn’t work that way : P

---

<div class="post-metadata">

### Author: ![robottini](https://avatars.discourse-cdn.com/v4/letter/r/439d5e/32.png) [@robottini](https://discourse.processing.org/u/robottini)
#### Post date: [January 19, 2021, 1:04pm UTC](https://discourse.processing.org/t/problem-with-geomerative-and-list/27199/5 "2021-01-19T13:04:09Z")

</div>

OK thanks! I have to try an another way
