forked from 1b-agent/opencadstudio-upstream
feat(annotative): scale text/dims/tables/blocks at the annotation scale + editable property pickers
Render: annotative-ness is resolved centrally in scene::annotative::is_annotative (per-object context dictionary, legacy XDATA, or annotative style) so the bake and the properties panel agree. Text, dimensions, tables and blocks now display at the current annotation scale in model space. An annotative block scales as one uniform unit about its insertion point — its internal geometry and attributes are carried by that scale instead of being scaled individually, fixing the block-attribute size regression. Tables scale their column/row/margin geometry. Properties: the handle- and flag-backed rows are now editable pickers — MLEADER multileader style / text style / arrowhead / leader linetype, General Material, and Plot style (named plot-style mode only; the color-dependent mode stays read-only, which is correct). A picked name is resolved back to its handle in the update loop, where the document is in scope. Annotative Yes/No and the annotation-scale row are shown per object. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
8ef65f59f8
commit
1b037a68aa
9 files changed
+539
-228
No files matched your search
@@ -438,8 +438,16 @@ pub(crate) fn tessellate_entity(
|
||||
// No baked block (e.g. a table created in-app) — synthesise coloured
|
||||
// geometry from the rows + TableStyle so fills/colours/borders/margins
|
||||
// are honoured instead of the monochrome fallback.
|
||||
// Annotative tables scale with the current annotation scale (their
|
||||
// stored geometry is at paper size); non-annotative tables are already
|
||||
// model-size, so pass 1.0.
|
||||
let table_anno = if crate::scene::annotative::is_annotative(document, e) {
|
||||
anno_scale
|
||||
} else {
|
||||
1.0
|
||||
};
|
||||
let mut wires = crate::entities::table::tessellate_table(
|
||||
tab, document, sel, entity_color, line_weight_px,
|
||||
tab, document, sel, entity_color, line_weight_px, table_anno,
|
||||
);
|
||||
if !wires.is_empty() {
|
||||
let aabb = entity_aabb(e);
|
||||
@@ -516,6 +524,7 @@ pub(crate) fn tessellate_entity(
|
||||
world_per_pixel,
|
||||
is_xref,
|
||||
bg_color,
|
||||
anno_scale,
|
||||
) {
|
||||
// XCLIP: if this INSERT carries an enabled spatial filter,
|
||||
// clip the expanded block geometry to the boundary polygon so
|
||||
|
||||
@@ -103,26 +103,17 @@ pub fn tessellate(
|
||||
};
|
||||
let name = handle.value().to_string();
|
||||
|
||||
// Determine effective annotation scale for this entity.
|
||||
// Determine the effective annotation scale for this entity.
|
||||
//
|
||||
// AutoCAD's R2007+ "annotative" system marks objects via extension-
|
||||
// dictionary records or "AcAnnoPO" / "AcAnnotativeData" xdata. Only
|
||||
// entities so marked should be auto-scaled by the viewport's
|
||||
// paper-scale; everything else is treated as manually pre-scaled
|
||||
// (old DXF/DWG convention with $DIMSCALE and oversized text).
|
||||
//
|
||||
// Default: NOT annotative (anno_scale = 1.0). Opt-in via explicit
|
||||
// xdata marker. Files that mark every entity annotative are rare; the
|
||||
// pre-R2007 manual-scale convention is far more common in field data.
|
||||
let anno_scale = {
|
||||
let xdata = &entity.common().extended_data;
|
||||
let is_annotative = xdata.get_record("AcAnnoPO").is_some()
|
||||
|| xdata.get_record("AcAnnotativeData").is_some();
|
||||
if is_annotative {
|
||||
anno_scale
|
||||
} else {
|
||||
1.0
|
||||
}
|
||||
// Only annotative entities are auto-scaled by the current annotation scale;
|
||||
// everything else is manually pre-scaled (old convention with $DIMSCALE and
|
||||
// oversized text). Annotative-ness is resolved centrally from the entity's
|
||||
// per-object context, legacy XDATA, or annotative style (see
|
||||
// `scene::annotative::is_annotative`) so the bake and the panel agree.
|
||||
let anno_scale = if crate::scene::annotative::is_annotative(document, entity) {
|
||||
anno_scale
|
||||
} else {
|
||||
1.0
|
||||
};
|
||||
|
||||
// A HATCH is drawn as a fill by the hatch pipeline and highlighted via a
|
||||
|
||||
Reference in new issue
Block a user