# Svg created have no proper path

**URL:** https://discourse.processing.org/t/svg-created-have-no-proper-path/39412
**Category:** Libraries
**Created:** [October 24, 2022, 12:42pm UTC](https://discourse.processing.org/t/svg-created-have-no-proper-path/39412 "2022-10-24T12:42:57Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![matheplica](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/matheplica/32/21035_2.png) [@matheplica](https://discourse.processing.org/u/matheplica)
#### Post date: [October 24, 2022, 12:42pm UTC](https://discourse.processing.org/t/svg-created-have-no-proper-path/39412/1 "2022-10-24T12:42:57Z")

</div>

Hi, I’m trying to create a proper path from shapes.  
I would like to use the svg as path for my pen plotter (here Axidraw).  
The svg file opened in inkscape made has a deepness and is doubled for every line.  
How can I simplify ?  
Here’s the creater svg code :

```auto
ArrayList<Cuber> cubs = new ArrayList<Cuber>();
import processing.svg.*;
boolean record;
void setup() {
  size(360, 240, P2D);
  for (int i=0; i<2; i++) cubs.add(new Cuber(120+i*124, 120, 60));
}
void draw() {
  if (record) beginRaw(SVG, "output.svg");
 background(220);
  stroke(0);
  strokeWeight(1);
  noFill();
  for (Cuber c : cubs) c.display();
  if (record) {
    endRaw();
    record = false;
  }  
}
void keyPressed() {
  if (key == 'r') {
    record = true;
    print("svg saved");
  }
}

```

The class :

```auto
class Cuber {
  int x, y;
  PVector ray, center;
  PVector[] pts = new PVector[6];
  Cuber(int x, int y, int r) {
    this.x = x;
    this.y = y;
    ray = new PVector(0, r);
    center = new PVector(0, 0);
    for (int i=0; i<pts.length; i++) pts[i] = center.copy().add(ray).rotate((PI/3.0)*i);
  }
  void display() {
    pushMatrix();
    translate(x, y);
    beginShape();
    for (int i=0; i<pts.length; i++) vertex(pts[i].x, pts[i].y);
    endShape(CLOSE);
    popMatrix();
  }
}

```

---

<div class="post-metadata">

### Author: ![matheplica](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/matheplica/32/21035_2.png) [@matheplica](https://discourse.processing.org/u/matheplica)
#### Post date: [October 25, 2022, 12:00pm UTC](https://discourse.processing.org/t/svg-created-have-no-proper-path/39412/2 "2022-10-25T12:00:14Z")

</div>

Ok, I found, I just need to replace

```auto
beginRaw() by beginRecord()
and endRaw() by endRecord()

```
