Export edges of three-bvh-csg geometry

Hi, I would like to create dxf file from my scene. To do this I need coordinates of all edges. It is quite difficult for me because I work in R3F but it seems that this code works for most of objects I use except three-bvh-csg which still contain all lines including “operation” geometries and EdgesGeometry does not affect it at all. Similar issues are mentioned here or here. After reading those I thought I have to splice geometry attributes according the drawRange but it seems that geometry already includes only those attributes
( geometry.drawRange.count *3== geometry.getAttribute(“position”).array.length ) .
I don’t use groups (multiple materials) when working with csg. Why this code does not work for csg? Is there a way how to solve this? Thank you for help

import { Vector3, EdgesGeometry } from "three";

class DXFExporter {
  parse(scene) {
    const linesCoordinates = [];
    scene.traverse(function (object) {
      if (object.isMesh) {
        const geometry = object.geometry;
        const edges = new EdgesGeometry(geometry);
        const vertices = edges.attributes.position;
        const vector = new Vector3();

        for (let i = 0; i < vertices.count; i++) {
          vector.fromBufferAttribute(vertices, i);

export { DXFExporter };
1 Like