forked from 1b-agent/opencadstudio-upstream
JOIN previously only merged collinear lines or co-circular arcs into a single Line/Arc and rejected everything else as "not co-linear" — so the segments of a broken polyline, which meet at vertices but run at angles, could never rejoin. It also flattened endpoints to the first segment's Z, silently discarding height. Rewrite the geometry pass to chain segments wherever their endpoints touch, regardless of angle: a collinear straight run still collapses to one Line, a planar chain becomes an LwPolyline (arcs carried as bulges), and a chain with varying Z becomes a Polyline3D, preserving height. Open/closed is detected from the endpoints; a selection that isn't a single connected chain, or holds an unsupported entity / tilted arc, is refused with a clearer message. Co-Authored-By: Claude Opus 4.8 <[email protected]>