feat(proxy): decode proxy-graphics geometry for custom entities

A custom entity without its object enabler (an AutoCAD Architecture door,
wall, ...) arrives as Unknown but ships a cached proxy-graphics preview —
the vector fallback AutoCAD itself draws. The old decoder read only a lone
type-6 polyline; generalise it to the real record stream
([total_size, record_count, {record_size, record_type, data}...]) and decode
the geometry records: polyline (6), polygon (7, closed) and circular arc
(4/5, flattened to a strip). Trait records (colour/lineweight/...) are
skipped for now, so the preview draws in the entity's own colour.

The Unknown-entity path now draws every decoded primitive in one wire, so
these objects appear (and become selectable) instead of vanishing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-07-18 20:33:03 +03:00
1 parent b3e5743808
commit 18d116bb33
2 files changed
+153 -66

No files matched your search

+13 -2
View File
@@ -244,8 +244,19 @@ pub(crate) fn tessellate_entity(
// occupies its real place instead of silently disappearing.
if let EntityType::Unknown(_) = e {
if let Some(blob) = e.common().graphic_data.as_ref() {
if let Some(p) = convert::proxy_graphics::decode_polyline(blob) {
let (pts, pts_low) = convert::tessellate::points_to_ds(p.points);
let polys = convert::proxy_graphics::decode(blob);
if !polys.is_empty() {
// One wire for the whole preview: concatenate the poly-lines
// with NaN separators (arcs are already flattened to points).
let nan = [f64::NAN; 3];
let mut pts64: Vec<[f64; 3]> = Vec::new();
for poly in &polys {
if !pts64.is_empty() {
pts64.push(nan);
}
pts64.extend_from_slice(&poly.points);
}
let (pts, pts_low) = convert::tessellate::points_to_ds(pts64);
let mut w = WireModel::solid(h.value().to_string(), pts, entity_color, sel);
w.points_low = pts_low;
w.line_weight_px = line_weight_px;