Hi there,

need a little help figuring this one out…

Ive had a search but havent found any topics that I think would help mw…

Basically Im trying to mask some lines ive generated with a rectangle.

I’ve seen a few posts about using image masking but I need to be able to save as a.pdf, to edit in vector image software.

In this image, I’d like the purple rectangle to trim/crop the diagonal lines.

thanks very much

```
float blockSize = 100;
void setup() {
size(480,480);
}
void draw() {
background(255);
strokeWeight(2);
stroke(255,0,255);
rect(mouseX,mouseY,blockSize,blockSize);
ladder(width/2,height/2+blockSize/2);
}
//function to create diagonal lines
void ladder(float x_,float y_) {
stroke(0);
strokeWeight(1);
float diag = sqrt(sq(blockSize) + sq(blockSize));
float x = x_;
float y = y_;
float space = blockSize/10;
pushMatrix();
translate(x + blockSize/2,y);
rotate(radians(45));
for(int i = 0; i < diag; i += space) {
line(-diag/2,i-diag/2,diag/2,i-diag/2);
}
popMatrix();
}
```