Preserving Stroke Color in PGS Library when subtracting Shapes

Hello everyone,

I have a question about using the Processing Geometry Suite (PGS) library.

I’m working on a code that subtracts a ‘circleShape’ from a collection of lines called ‘lines’.
When generating the ‘lines’, I assign a randomly chosen stroke color.
I’m trying to apply ‘PGS_ShapeBoolean.subtractMesh(lines, circleShape)’ to subtract the ‘circleShape’, but the stroke color assigned during the creation of ‘lines’ gets lost.

I’ve looked into various solutions, but I haven’t found any way to resolve this issue. Is there any way to maintain the stroke color?

import micycle.pgs.*;

int nLines = 7;
int nColors = 20;
color[] strokeColors = new color[nColors];

void setup() {
  size(800, 800);
  background(255);

  for (int i = 0; i < nColors; i++) {
    strokeColors[i] = color(random(255), random(255), random(255));
  }
}

void draw() {
  PShape lines = createShape(GROUP); 

  float step = width / float(nLines);

  for (int i = 0; i < nLines; i++) {
    float x = i * step;
    PShape lineShape = createShape();
    lineShape.beginShape();
    lineShape.stroke(color(strokeColors[i]));
    lineShape.vertex(x, 0);
    lineShape.vertex(x, height);
    lineShape.endShape();
    lines.addChild(lineShape);
  }
  
    PShape circleShape = createShape();
    circleShape = createShape(ELLIPSE, 300, 300, 400, 400);
    circleShape.setFill(255);
    circleShape.setStroke(strokeColors[int(random(nColors))]);

   PShape subtructedLines = createShape();
   subtructedLines = PGS_ShapeBoolean.subtractMesh(lines, circleShape);   
  
  shape(circleShape);
  shape(subtructedLines);
  //shape(lines);


  noLoop();
}

There’s not a way to maintain shape style during the operation (though the upcoming release will support this).

How about assigning the same stroke colors to the output instead (each child shape of subtructedLines)?

Thanks for the reply. I’m excited to hear about the next release.
I’ve thought about it, and it seems like the only current solution is to reassign the colors at the output stage. I’m exploring the world of PGS…