forked from 1b-agent/opencadstudio-upstream
DWF and DGN underlays: attach, display, snaps, frames and references
DWFATTACH / -DWFATTACH and DGNATTACH / -DGNATTACH attach a DWF / DWFx sheet or a DGN (V7 or V8) model with the reference's prompts; ATTACH routes the file types to them. The sheet or model is read into vector paths, drawn as a transparent underlay raster (contrast, fade, monochrome and background adjustment apply) and offers its geometry to object snaps. Definitions are kept in ACAD_DWFDEFINITIONS / ACAD_DGNDEFINITIONS, the External References palette lists and reloads them, and image textures get line-keeping mip levels so thin underlay lines stay visible when zoomed out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7f8f8457c7
commit
cb7860e50e
46 files changed
+2723
-129
No files matched your search
@@ -629,8 +629,7 @@ pub fn underlay_snap_points(
|
||||
let Some(def) = crate::entities::underlay::definition(u, document) else {
|
||||
return Vec::new();
|
||||
};
|
||||
let source = super::pdf_layers::underlay_source(u, &def.file_path);
|
||||
let Some(vectors) = page_vectors(&source, crate::entities::underlay::page_of(def)) else {
|
||||
let Some(vectors) = underlay_vectors(u, def) else {
|
||||
return Vec::new();
|
||||
};
|
||||
let world = |p: [f64; 2]| {
|
||||
@@ -665,6 +664,21 @@ pub fn underlay_snap_points(
|
||||
out
|
||||
}
|
||||
|
||||
/// The page's vectors in page units: PDF through its layer overrides, DWF
|
||||
/// and DGN from their sheet.
|
||||
fn underlay_vectors(
|
||||
u: &codec::entities::Underlay,
|
||||
def: &codec::entities::UnderlayDefinition,
|
||||
) -> Option<Arc<PageVectors>> {
|
||||
let page = crate::entities::underlay::page_of(def);
|
||||
match def.underlay_type {
|
||||
codec::entities::UnderlayType::Pdf => {
|
||||
page_vectors(&super::pdf_layers::underlay_source(u, &def.file_path), page)
|
||||
}
|
||||
kind => super::underlay_vector::page_vectors(kind, &def.file_path, page),
|
||||
}
|
||||
}
|
||||
|
||||
/// Most points of the snap-only geometry wire of one underlay.
|
||||
// ponytail: flat cap; a spatial index over page segments for huge drawings.
|
||||
const MAX_GEOMETRY_POINTS: usize = 200_000;
|
||||
@@ -693,8 +707,7 @@ pub fn underlay_snap_geometry(
|
||||
if def.unloaded {
|
||||
return Vec::new();
|
||||
}
|
||||
let source = super::pdf_layers::underlay_source(u, &def.file_path);
|
||||
let Some(vectors) = page_vectors(&source, crate::entities::underlay::page_of(def)) else {
|
||||
let Some(vectors) = underlay_vectors(u, def) else {
|
||||
return Vec::new();
|
||||
};
|
||||
let world = |p: [f64; 2]| crate::entities::underlay::local_to_world(u, p);
|
||||
|
||||
Reference in new issue
Block a user