Line taken from the team
64-bitTurns shared geometry into feature line points in the drawing's unit.
k = 1 (same unit), 0.3048 (ft → m) or 1 ÷ 0.3048 (m → ft); p′ = p × k
Each coordinate is one 64-bit product. The meters to feet factor is the reciprocal of 0.3048 computed once, so a coordinate can differ by one unit in the last place from a division by 0.3048. A missing z is taken as 0.
/** Geometry from the site → { pts, closed }, in `units` (a line made in the other unit is scaled). null when it is not usable. */
export function fromGeometry(geo, units = 'ft') {
if (!geo || !Array.isArray(geo.points) || geo.points.length < 2) return null;
const from = /units=(ft|m)\b/.exec(String(geo.style || ''))?.[1] || units;
const k = from === units ? 1 : from === 'm' ? 1 / FT : FT;
const pts = [];
for (const p of geo.points) {
if (!Array.isArray(p) || p.length < 2 || !p.every((v) => Number.isFinite(v))) return null;
pts.push({ x: p[0] * k, y: p[1] * k, z: (p[2] || 0) * k });
}
return { pts, closed: !!geo.closed && pts.length >= 3 };
}