feat(xclip): clip block references to their SPATIAL_FILTER boundary

Block references carrying an XCLIP spatial filter were drawn in full,
ignoring the clip boundary. Resolve the filter through the INSERT's
extension dictionary (ACAD_FILTER -> SPATIAL) and clip the expanded
block geometry to the boundary polygon: polylines are split into the
inside runs, fill triangles are clipped, and snap/key vertices outside
the boundary are dropped.

The boundary vertices live in the clip-definition space, so they are
placed with world = T_insert * (inverse_block_transform * vert); this
keeps the clip correct even when the insert was rescaled after the clip
was created. Bumps acadrust to the build that decodes SPATIAL_FILTER.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-06-15 12:29:10 +03:00
1 parent ec865a95aa
commit dd1ec3ad40
3 files changed
+473 -2

No files matched your search

+9
View File
@@ -34,6 +34,7 @@ pub mod transform;
pub mod truck_tess;
pub mod viewport_pane;
pub mod wire_model;
pub mod xclip;
use camera::Camera;
pub use camera::Projection;
@@ -7327,6 +7328,14 @@ fn tessellate_entity(
is_xref,
bg_color,
) {
// XCLIP: if this INSERT carries an enabled spatial filter,
// clip the expanded block geometry to the boundary polygon so
// only the portion inside the clip is drawn.
if let Some(sf) = xclip::insert_spatial_filter(document, ins) {
let poly = xclip::world_clip_polygon(sf, ins, world_offset);
xclip::clip_wires(&mut wires, &poly);
}
// Per-INSERT attribute values. The block defn carries the
// AttributeDefinitions (templates) which expand_insert skips;
// the AttributeEntity instances live on the Insert itself in