DXF/DWG: annotative multileaders keep their annotation scales on save

An annotative multileader's scale context (ACDB_MLEADEROBJECTCONTEXTDATA_CLASS)
holds the multileader's whole CONTEXT_DATA body at that scale: overall scale
(40), text height, arrowhead size, landing gap, content position and the
leaders. CADCraft dropped AutoCAD's on read and wrote none, so annotative
multileaders came back plain at the default scale's size, and AutoCAD showed
CADCraft's at one size at every scale.

Multileaders now go through the annotation scale contexts like text, MText
and dimensions: written at the default scale with AcadAnnotative xdata and a
context per scale (the entity writer's CONTEXT_DATA at that scale, with its
overall scale and landing gap set), read back at paper size. The DWG bridge
gives acadrust the CONTEXT_DATA{ group it reads the context after, and takes
acadrust's braces and marker out again.

Checked in AutoCAD: its own annotative multileader reads back at 1:2 and
1:10 at paper size, and the saved file reopens with text 0.18 / 0.9 as
before; one made in CADCraft opens with text 2.5 / 25 at 1:1 / 1:10, the text
moved with the scale.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cody Vogt
2026-10-31 16:47:36 -06:00
co-authored by Claude Opus 5.5
parent 3099c82881
commit 0f094da0ae
8 changed files with 199 additions and 27 deletions
+30 -3
View File
@@ -582,8 +582,11 @@ mod native {
/// `AcDbTextObjectContextData` marker, with the rotation in radians (as DWG holds it), and
/// without the marker reads zeros (an annotative reference at scale 0 draws nothing in
/// AutoCAD). Dimension contexts (`ACDB_*DIMOBJECTCONTEXTDATA_CLASS`): AutoCAD names the
/// geometry block in group 2, acadrust reads a BLOCK_RECORD handle there. Text that isn't
/// UTF-8, or has no such context, is returned as it is.
/// geometry block in group 2, acadrust reads a BLOCK_RECORD handle there. Multileader contexts
/// (`ACDB_MLEADEROBJECTCONTEXTDATA_CLASS`): AutoCAD has the multileader's context groups
/// straight after the scale, acadrust reads them only after a `300 CONTEXT_DATA{` group (and
/// writes them between it and `301 }` after an `AcDbMLeaderObjectContextData` marker). Text
/// that isn't UTF-8, or has no such context, is returned as it is.
pub(crate) fn contexts(dxf: &[u8], to_acadrust: bool) -> Vec<u8> {
const KINDS: [(&str, &str); 2] = [
("ACDB_BLKREFOBJECTCONTEXTDATA_CLASS", "AcDbBlkRefObjectContextData"),
@@ -591,7 +594,8 @@ mod native {
];
let is_dim = |k: &str| k.starts_with("ACDB_") && k.ends_with("DIMOBJECTCONTEXTDATA_CLASS");
let Ok(text) = std::str::from_utf8(dxf) else { return dxf.to_vec() };
if !KINDS.iter().any(|(k, _)| text.contains(k)) && !text.contains("DIMOBJECTCONTEXTDATA_CLASS") {
const MLEADER: &str = "ACDB_MLEADEROBJECTCONTEXTDATA_CLASS";
if !KINDS.iter().any(|(k, _)| text.contains(k)) && !text.contains("DIMOBJECTCONTEXTDATA_CLASS") && !text.contains(MLEADER) {
return dxf.to_vec();
}
let lines: Vec<&str> = text.split('\n').collect();
@@ -619,6 +623,8 @@ mod native {
// The marker of the context being read (block reference or text), whether it is a
// dimension's, whether its scale (340) was passed and whether its marker was.
let (mut marker, mut dim, mut scaled, mut marked) = (None::<&str>, false, false, false);
// In a multileader context: whether its scale was passed and its body opened.
let (mut ml, mut ml_scaled, mut ml_open) = (false, false, false);
let mut i = 0;
while let (Some(&code_line), Some(&value_line)) = (lines.get(i), lines.get(i + 1)) {
let (code, value) = (code_line.trim(), value_line.trim_end_matches('\r'));
@@ -627,6 +633,27 @@ mod native {
marker = KINDS.iter().find(|(k, _)| *k == kind).map(|(_, m)| *m);
dim = is_dim(kind);
(scaled, marked) = (false, false);
(ml, ml_scaled, ml_open) = (kind == MLEADER, false, false);
}
if ml {
let v = value.trim();
// acadrust's braces and marker go.
let theirs = (code == "100" && v == "AcDbMLeaderObjectContextData")
|| (code == "300" && v.starts_with("CONTEXT_DATA"))
|| (code == "301" && v == "}");
if theirs && !to_acadrust {
i += 2;
continue;
}
if to_acadrust && ml_scaled && !ml_open {
out.push(format!("300{}", eol(code_line)));
out.push(format!("CONTEXT_DATA{{{}", eol(value_line)));
ml_open = true;
}
// The first 340 is the scale (a later one is the text style).
if code == "340" && !ml_scaled {
ml_scaled = true;
}
}
let mut value = value.to_string();
if let Some(m) = marker {
+50 -11
View File
@@ -1,11 +1,12 @@
//! Annotative text, MText and dimensions in DXF, as AutoCAD keeps them. An annotative object
//! Annotative text, MText, dimensions and multileaders in DXF, as AutoCAD keeps them. An annotative object
//! carries `AcadAnnotative` xdata and, in its extension dictionary under
//! `AcDbContextDataManager`, a dictionary `ACDB_ANNOTATIONSCALES` with one "object context data"
//! object per annotation scale it supports (`*A1`, `*A2`…). Each context names its SCALE object
//! (340), says whether it is the default one (290 = 1, the scale the object's own groups are
//! written at) and holds what changes with the scale: a text's insertion and alignment points, an
//! MText's insertion point, width and columns, a dimension's text position and the anonymous `*D`
//! block with its geometry at that scale.
//! block with its geometry at that scale, a multileader's whole `CONTEXT_DATA{` body at that
//! scale.
//!
//! CADCraft keeps an annotative object at paper size with the list of scales it supports
//! ([`cadcraft_doc::Common::anno_scales`]). It writes the object at its default scale with a
@@ -18,7 +19,7 @@
use std::collections::{BTreeSet, HashMap};
use cadcraft_doc::{AnnoScale, DimKind, Drawing, Entity, EntityKind, HAlign, Handle, MTextColumnType, Text, VAlign};
use cadcraft_doc::{AnnoScale, DimKind, Drawing, Entity, EntityKind, HAlign, Handle, MLeader, MTextColumnType, Text, VAlign};
use cadcraft_dxf::{Section, Tag};
use cadcraft_geom::Vec3;
@@ -30,6 +31,7 @@ const ANGDIM: (&str, &str) = ("ACDB_ANGDIMOBJECTCONTEXTDATA_CLASS", "AcDbAngular
const RADIM: (&str, &str) = ("ACDB_RADIMOBJECTCONTEXTDATA_CLASS", "AcDbRadialDimensionObjectContextData");
const DMDIM: (&str, &str) = ("ACDB_DMDIMOBJECTCONTEXTDATA_CLASS", "AcDbDiametricDimensionObjectContextData");
const ORDDIM: (&str, &str) = ("ACDB_ORDDIMOBJECTCONTEXTDATA_CLASS", "AcDbOrdinateDimensionObjectContextData");
const MLEADER: (&str, &str) = ("ACDB_MLEADEROBJECTCONTEXTDATA_CLASS", "AcDbMLeaderObjectContextData");
/// The extension dictionary entry and the dictionary of contexts.
const MANAGER_KEY: &str = "AcDbContextDataManager";
@@ -39,9 +41,9 @@ const SCALES_KEY: &str = "ACDB_ANNOTATIONSCALES";
const MAX_CONTEXTS: usize = cadcraft_doc::MAX_SCALES;
/// Whether `e` (in model space or a layout) is written with annotation scale contexts: annotative
/// text, MText and dimensions.
/// text, MText, dimensions and multileaders.
pub(crate) fn has_contexts(e: &Entity) -> bool {
cadcraft_doc::is_annotative(e) && matches!(e.kind, EntityKind::Text(_) | EntityKind::MText(_) | EntityKind::Dimension(_))
cadcraft_doc::is_annotative(e) && matches!(e.kind, EntityKind::Text(_) | EntityKind::MText(_) | EntityKind::Dimension(_) | EntityKind::MLeader(_))
}
/// The scales `e` is written at (valid, each name once) and which of them is the default: the
@@ -121,6 +123,7 @@ fn class_of(e: &Entity) -> Option<(&'static str, &'static str)> {
Some(match &e.kind {
EntityKind::Text(_) => TEXT,
EntityKind::MText(_) => MTEXT,
EntityKind::MLeader(_) => MLEADER,
EntityKind::Dimension(dm) => match dm.kind {
DimKind::Linear { .. } | DimKind::Aligned | DimKind::ArcLength => ALDIM,
DimKind::Angular | DimKind::Angular3P => ANGDIM,
@@ -210,8 +213,8 @@ fn dictionary(out: &mut Vec<Tag>, h: &str, owner: &str, cloning: bool, entries:
/// The objects of annotative object `e` planned as `o`: its extension dictionary (unless the
/// DIMASSOC's holds the manager), the context manager, the dictionary of contexts and the
/// contexts.
pub(crate) fn objects(d: &Drawing, e: &Entity, o: &Obj) -> Vec<Tag> {
/// contexts. `mleader` gives a multileader's groups as the entity writer writes them.
pub(crate) fn objects(d: &Drawing, e: &Entity, o: &Obj, mleader: &dyn Fn(&MLeader) -> Vec<Tag>) -> Vec<Tag> {
let mut out = Vec::new();
let eh = e.handle.hex();
if o.own_xdict {
@@ -231,14 +234,26 @@ pub(crate) fn objects(d: &Drawing, e: &Entity, o: &Obj) -> Vec<Tag> {
out.push(Tag::i(290, i64::from(c.default)));
out.push(Tag::s(100, "AcDbAnnotScaleObjectContextData"));
out.push(Tag::s(340, c.scale.clone()));
context_groups(&mut out, d, &at_scale(e, c.factor), c);
context_groups(&mut out, d, &at_scale(e, c.factor), c, mleader);
}
out
}
/// What a context holds of `e` (already at the context's scale).
fn context_groups(out: &mut Vec<Tag>, d: &Drawing, e: &Entity, c: &Context) {
fn context_groups(out: &mut Vec<Tag>, d: &Drawing, e: &Entity, c: &Context, mleader: &dyn Fn(&MLeader) -> Vec<Tag>) {
match &e.kind {
// The multileader's `CONTEXT_DATA{` body, without its braces.
EntityKind::MLeader(m) => {
let mut tags = mleader(m);
mleader_at(&mut tags, c.factor);
let open = tags.iter().position(|t| t.code == 300 && t.str().trim_start().starts_with("CONTEXT_DATA"));
let close = tags.iter().position(|t| t.code == 301);
if let (Some(a), Some(b)) = (open, close)
&& a < b
{
out.extend(tags.get(a + 1..b).unwrap_or(&[]).iter().cloned());
}
}
EntityKind::Text(t) => {
let h = match t.halign {
HAlign::Left => 0,
@@ -310,6 +325,28 @@ fn context_groups(out: &mut Vec<Tag>, d: &Drawing, e: &Entity, c: &Context) {
}
}
/// A multileader's groups (as [`crate::dxf_mleader::entity_tags`] writes them) at annotation
/// scale `f`: its context's overall scale (40) is `f` and its landing gap (145) is at that scale.
pub(crate) fn mleader_at(tags: &mut [Tag], f: f64) {
let Some(open) = tags.iter().position(|t| t.code == 300 && t.str().trim_start().starts_with("CONTEXT_DATA")) else { return };
let (mut scale, mut gap) = (false, false);
for t in tags.iter_mut().skip(open + 1) {
match t.code {
// The context's own groups end where its leaders start.
302 | 301 => break,
40 if !scale => {
*t = Tag::f(40, f);
scale = true;
}
145 if !gap => {
*t = Tag::f(145, t.f64() * f);
gap = true;
}
_ => {}
}
}
}
// ---------------------------------------------------------------------------------------------
// Reading
@@ -362,7 +399,7 @@ pub(crate) fn resolve(secs: &[Section], d: &mut Drawing) {
let mut found: Vec<(Handle, Handle)> = Vec::new();
for s in secs.iter().filter(|s| s.name == "ENTITIES" || s.name == "BLOCKS") {
each_record(&s.tags, |kind, tags| {
if !matches!(kind, "TEXT" | "MTEXT" | "DIMENSION" | "ARC_DIMENSION" | "LARGE_RADIAL_DIMENSION") {
if !matches!(kind, "TEXT" | "MTEXT" | "DIMENSION" | "ARC_DIMENSION" | "LARGE_RADIAL_DIMENSION" | "MULTILEADER") {
return;
}
let h = own(tags).iter().find(|t| t.code == 5).and_then(|t| key(&t.str()));
@@ -373,7 +410,7 @@ pub(crate) fn resolve(secs: &[Section], d: &mut Drawing) {
}
for (h, xdict) in found {
let Some(e) = d.entity(h) else { continue };
if !matches!(e.kind, EntityKind::Text(_) | EntityKind::MText(_) | EntityKind::Dimension(_)) {
if !matches!(e.kind, EntityKind::Text(_) | EntityKind::MText(_) | EntityKind::Dimension(_) | EntityKind::MLeader(_)) {
continue;
}
let dict = objs
@@ -431,6 +468,8 @@ fn to_paper(e: &mut Entity, f: f64) {
c.scale(inv);
}
}
// Its sizes, and its content's place about the landing, scale linearly.
EntityKind::MLeader(_) => e.kind = cadcraft_doc::anno_scaled(e, inv).kind,
_ => {}
}
}
+10 -1
View File
@@ -1,4 +1,4 @@
use super::{DimVal, Entity, Handle, HashMap, K, Vec3, Version, W, dxf_ext};
use super::{DimVal, Drawing, Entity, Handle, HashMap, K, MLeader, Tag, Vec3, Version, W, dxf_ext};
/// The `DIMASSOC` object of an associative dimension (stored in the dimension's extension
/// dictionary under `ACAD_DIMASSOC`).
@@ -70,6 +70,15 @@ impl Ctx {
pub(super) fn at_default(&self, e: &Entity) -> Option<Entity> {
self.anno.objs.get(&e.handle).map(|o| crate::dxf_anno::at_scale(e, crate::dxf_anno::default_factor(o)))
}
/// A native MULTILEADER's groups after its `AcDbMLeader` marker.
pub(super) fn mleader_tags(&self, d: &Drawing, m: &MLeader) -> Vec<Tag> {
let refs = crate::dxf_mleader::Refs {
style: self.mleader_style(&m.style),
text_style: m.text.as_ref().and_then(|t| self.style(&t.style)),
block: m.block.as_ref().and_then(|b| self.block_records.get(&b.block.to_ascii_uppercase()).cloned()),
};
crate::dxf_mleader::entity_tags(d, m, &refs)
}
/// `AcadAnnotative` xdata of an object written with contexts.
pub(super) fn anno_xdata(&self, w: &mut W, e: &Entity) {
if self.anno.objs.contains_key(&e.handle) {
+11 -6
View File
@@ -504,14 +504,19 @@ fn write_annotations_entity(w: &mut W, d: &Drawing, e: &Entity, owner: &str, pap
match &e.kind {
EntityKind::MLeader(m) if !cx.native_mleader() => mleader_fallback(w, d, e, m, owner, paper, cx),
EntityKind::MLeader(m) => {
let scaled = cx.at_default(e);
let m = match scaled.as_ref().map(|s| &s.kind) {
Some(EntityKind::MLeader(s)) => s,
_ => m,
};
w.s(0, "MULTILEADER");
common(w, e, owner, paper, "AcDbMLeader");
let refs = crate::dxf_mleader::Refs {
style: cx.mleader_style(&m.style),
text_style: m.text.as_ref().and_then(|t| cx.style(&t.style)),
block: m.block.as_ref().and_then(|b| cx.block_records.get(&b.block.to_ascii_uppercase()).cloned()),
};
w.t.extend(crate::dxf_mleader::entity_tags(d, m, &refs));
let mut tags = cx.mleader_tags(d, m);
if let Some(o) = cx.anno.objs.get(&e.handle) {
crate::dxf_anno::mleader_at(&mut tags, crate::dxf_anno::default_factor(o));
}
w.t.extend(tags);
cx.anno_xdata(w, e);
}
EntityKind::Leader(l) => {
w.s(0, "LEADER");
+1 -1
View File
@@ -744,7 +744,7 @@ fn write_annotation_objects(w: &mut W, plan: &ObjectWritePlan<'_>) {
annos.sort_by_key(|(h, _)| **h);
for (h, o) in annos {
if let Some(e) = plan.d.entity(*h) {
w.t.extend(crate::dxf_anno::objects(plan.d, e, o));
w.t.extend(crate::dxf_anno::objects(plan.d, e, o, &|m| plan.cx.mleader_tags(plan.d, m)));
}
}
}
@@ -685,3 +685,93 @@ fn text_mtext_and_dimensions_keep_their_scales_through_dwg() {
assert!(get(t, 2).is_some_and(|b| b.starts_with("*D")), "{t:?}");
}
}
/// A drawing made in CADCraft with an annotative multileader (text 2.5 on paper, 1:1 and 1:10,
/// 1:10 current).
fn with_mleader() -> (Drawing, Handle) {
let mut d = Drawing::default();
d.header.set_str("CANNOSCALE", "1:10");
let common = Common { anno_scales: vec![AnnoScale::new("1:1", 1.0, 1.0), AnnoScale::new("1:10", 1.0, 10.0)], ..Common::default() };
let text = cadcraft_doc::MText {
insert: Vec3::new(10.5, 10.1, 0.0),
height: 2.5,
width: 0.0,
attach: 1,
rotation: 0.0,
style: "Standard".into(),
contents: "Note".into(),
line_spacing: 1.0,
line_spacing_exact: false,
columns: None,
};
let m = cadcraft_doc::MLeader {
leaders: vec![vec![Vec3::ZERO]],
landing: Vec3::new(10.0, 10.0, 0.0),
dogleg: 0.36,
text: Some(text),
style: "Standard".into(),
arrow_size: 0.18,
spline: false,
block: None,
};
let h = d.add(&Space::Model, common, EntityKind::MLeader(m)).unwrap();
(d, h)
}
#[test]
fn a_multileader_gets_its_context_data_at_each_scale() {
let (d, h) = with_mleader();
let text = save(&d);
let recs = records(&text);
let ent = recs.iter().find(|(k, t)| k == "MULTILEADER" && get(t, 5) == Some(h.hex().as_str())).unwrap();
assert!(ent.1.iter().any(|(c, v)| *c == 1001 && v == "AcadAnnotative"));
// The entity is at 1:10, the current scale: overall scale 10 and text 25.
assert_eq!(num(&ent.1, 40), 10.0);
assert_eq!(num(&ent.1, 41), 25.0);
let ctx = contexts_of(&text, &h.hex());
let got: Vec<(&str, bool, &str)> = ctx.iter().map(|c| (c.scale.as_str(), c.default, c.class.as_str())).collect();
assert_eq!(got, [("1:1", false, "ACDB_MLEADEROBJECTCONTEXTDATA_CLASS"), ("1:10", true, "ACDB_MLEADEROBJECTCONTEXTDATA_CLASS")]);
for (c, f) in ctx.iter().zip([1.0, 10.0]) {
// AutoCAD's layout: the context groups straight after the scale, no braces of their own.
assert_eq!(c.tags.first().map(|t| t.0), Some(40), "{:?}", c.tags);
assert!(c.tags.iter().all(|(code, v)| !(*code == 300 && v.starts_with("CONTEXT_DATA")) && *code != 301));
assert_eq!(num(&c.tags, 40), f);
assert!((num(&c.tags, 41) - 2.5 * f).abs() < 1e-9);
assert!((num(&c.tags, 140) - 0.18 * f).abs() < 1e-9);
// The text keeps its place about the landing, at the scale's size.
assert!((num(&c.tags, 12) - (10.0 + 0.5 * f)).abs() < 1e-9 && (num(&c.tags, 22) - (10.0 + 0.1 * f)).abs() < 1e-9);
}
let back = cadcraft_io::read_dxf(text.as_bytes()).unwrap();
let (a, b) = (d.entity(h).unwrap(), back.entity(h).unwrap());
assert_eq!(a.common.anno_scales, b.common.anno_scales);
let (EntityKind::MLeader(x), EntityKind::MLeader(y)) = (&a.kind, &b.kind) else { panic!("multileader") };
let (tx, ty) = (x.text.as_ref().unwrap(), y.text.as_ref().unwrap());
assert!((tx.height - ty.height).abs() < 1e-9 && (tx.insert - ty.insert).len() < 1e-9, "{ty:?}");
assert!((x.arrow_size - y.arrow_size).abs() < 1e-9 && (x.dogleg - y.dogleg).abs() < 1e-9, "{y:?}");
}
#[cfg(not(target_arch = "wasm32"))]
#[test]
fn a_multileader_keeps_its_scales_through_dwg() {
let (d, _) = with_mleader();
let dwg = cadcraft_io::write(&d, "x.dwg").unwrap();
let back = cadcraft_io::read(&dwg, "x.dwg").unwrap();
let e = back.model.iter().find(|e| matches!(e.kind, EntityKind::MLeader(_))).unwrap();
let got: Vec<&str> = e.common.anno_scales.iter().map(|s| s.name.as_str()).collect();
assert_eq!(got, ["1:1", "1:10"]);
let EntityKind::MLeader(m) = &e.kind else { panic!("multileader") };
assert!((m.text.as_ref().unwrap().height - 2.5).abs() < 1e-9, "{m:?}");
// The DXF read back from the DWG has AutoCAD's layout and each context at its scale.
let text = String::from_utf8_lossy(&cadcraft_dwg::dwg_to_dxf(&dwg).unwrap()).into_owned();
let ctx: Vec<Rec> = records(&text).into_iter().filter(|(k, _)| k == "ACDB_MLEADEROBJECTCONTEXTDATA_CLASS").collect();
let mut scales: Vec<f64> = ctx
.iter()
.map(|(_, t)| {
assert!(t.iter().all(|(c, v)| !(*c == 300 && v.starts_with("CONTEXT_DATA"))), "{t:?}");
let at = t.iter().position(|(c, _)| *c == 340).unwrap();
num(&t[at + 1..], 40)
})
.collect();
scales.sort_by(f64::total_cmp);
assert_eq!(scales, [1.0, 10.0]);
}
+3 -2
View File
@@ -1,6 +1,6 @@
# File-format parity
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-29 · **Change:** minor (R2000 DXF CLASS records without instance counts, so AutoCAD LT 2026 opens them; annotative text, MText and dimensions keep their scales on save) · **Target:** Autodesk AutoCAD 2027
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-29 · **Change:** minor (R2000 DXF CLASS records without instance counts, so AutoCAD LT 2026 opens them; annotative text, MText, dimensions and multileaders keep their scales on save) · **Target:** Autodesk AutoCAD 2027
Every format AutoCAD 2027 reads or writes, with CADCraft's support, fidelity and tests. Work
items are in [gaps.md](gaps.md#file-formats); the weighted score feeds
@@ -80,7 +80,7 @@ on read with a note, so such files no longer exceed the DXF limit (#1482). **DWG
| DIMENSION (all 7 kinds) | yes; annotative ones from their scale contexts | yes, with anonymous `*D` blocks; an annotative dimension gets a context and a `*D` block per scale | a reopened dimension's `*D` block is regenerated under its name, unreferenced ones dropped (#495); DIMASSOC objects written; angular block text honors DIMDSEP, including per-dimension overrides (#1646) |
| DIMENSION (all 7 kinds) | yes; annotative ones from their scale contexts | yes, with anonymous `*D` blocks; their text keeps the diameter sign as `%%c`, so SHX styles plot it (#1645); an annotative dimension gets a context and a `*D` block per scale | a reopened dimension's `*D` block is regenerated under its name, unreferenced ones dropped (#495); DIMASSOC objects written |
| LEADER | yes | yes | |
| MULTILEADER | yes (#459) | yes, native MULTILEADER with MLEADERSTYLE (#459) | several landings per multileader are folded into one; per-object overrides and annotative scale contexts not kept |
| MULTILEADER | yes (#459) | yes, native MULTILEADER with MLEADERSTYLE (#459) | several landings per multileader are folded into one; per-object overrides not kept; annotative ones keep their scales as AutoCAD's scale contexts (2007 and later) |
| HATCH pattern / solid | yes | yes; associative hatches keep their boundary objects in blocks too, and the boundary carries the hatch reactor (stretched dynamic blocks drag the fill in AutoCAD) | |
| HATCH gradient | yes | yes (#162, fixes #80) | |
| SOLID, TRACE, 3DFACE | yes | yes | |
@@ -150,6 +150,7 @@ our output in AutoCAD black-box.
| 2026-10-20 | minor | DIMENSION: the `*D` block's MTEXT, and the MTEXT EXPLODE leaves, hold the diameter sign as `%%c` instead of the decoded U+2300, which no SHX font has, so other programs plotted diameter dimensions in an SHX style without the sign (#1645) |
| 2026-10-21 | minor | Proxy objects and entities keep their class through a save: group 91 renumbered to the written CLASSES (the class it names is kept), a proxy whose number names no class dropped (#1812) |
| 2026-10-17 | minor | DWG read: DGN line style components no line style definition reaches are left out before the DXF bridge, with a read note; an 83 MB site plan with 888,483 of them (1.2 GB of DXF, over the limit) now opens (#1482) |
| 2026-10-15 | minor | Annotative multileaders read and write AutoCAD's annotation scale contexts (each context the multileader's `CONTEXT_DATA` at its scale), DXF and DWG |
| 2026-10-15 | minor | Annotative text, MText and dimensions read and write AutoCAD's annotation scale contexts (DXF and DWG 2007 and later): written at their default scale with a context per scale, a dimension with a `*D` block per scale; read back at paper size. Before, AutoCAD's were dropped (the objects read as not annotative) and CADCraft's kept only in its own record |
| 2026-10-12 | minor | PDF output: object transparency plotted as PDF alpha (`/ExtGState` `/ca` `/CA`) when the page setup's or the plot's "Plot transparency" is on; PNG plots blend it, SVG uses `opacity`; plots without it are unchanged byte for byte |
| 2026-10-12 | minor | DXF/DWG save: the Model layout's plot settings are written as CADCraft plots model space, drawing extents scaled to fit (PLOTSETTINGS 74 = 1, 75 = 0), instead of plot type 5 "Layout information", which other programs' Plot dialogs can't use for model space |
+4 -3
View File
@@ -1,6 +1,6 @@
# Where CADCraft falls short of AutoCAD
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-28 · **Change:** minor (F12: annotative text, MText and dimensions keep their scales on save) · **Target:** Autodesk AutoCAD 2027
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-28 · **Change:** minor (F12, FF2: annotative text, MText, dimensions and multileaders keep their scales on save) · **Target:** Autodesk AutoCAD 2027
Every known shortfall, one row each, ranked within each section by user impact. This is the work
list: agents pick from here (top of a section first). A PR names the rows it closes in its
@@ -34,7 +34,7 @@ do them first.
| F10 | MLEADEREDIT (add/remove leader), MLEADERALIGN and MLEADERCOLLECT landed, but a multileader has one landing and one block (a collection keeps the other blocks as block references beside it; MLEADERALIGN has no Options-menu preview); MLEADERSTYLE has 5 fields (block content and spline/no-leader types are per command, not in the style; block content has no attributes) | `annotate.rs`, `cmd/mleader_content.rs`, `tables.rs:417` | Medium | 8–12 |
| F9 | MTEXT is typed in an on-canvas editor with a formatting toolbar (font, height, bold, italic, underline, overline, colour, alignment, lists, tab and special characters) and a ruler for indents and tab stops (#532); left: the box does not lay the text out by the indents, tabs, columns or font weights while typing (bold shows wider, overline is not drawn), no justification (attachment) or columns controls in the editor, existing MTEXT cannot be edited (no DDEDIT/MTEDIT), stacked fractions and other codes show as placeholders; no fields (FIELD, UPDATEFIELD) and no spell check (SPELL): open PR #551. Paragraph indents, tabs, bullets, numbering and columns landed (#547) | `ui-egui/mtext_editor.rs`, `engine/mtext_edit.rs` | Medium | 10–18 |
| F11 | Tables (cell styles, formulas, TABLEDIT, TABLEEXPORT, table breaking and CSV data links landed, #534): formulas aren't read from or written as AutoCAD FIELD objects (other programs see values); number formats apply to formula results only; cell text doesn't wrap; custom cell styles, breaks and data links travel as CADCraft xdata (not through DWG); data links read CSV only (no Excel ranges, no write-back, not on the web); no cell-style tab in the Table Style dialog | `cmd/table/*`, `io/dxf_table.rs` | Low-medium | 6–10 |
| F12 | Annotative scaling done (#468): scale list (SCALELISTEDIT), CANNOSCALE, OBJECTSCALE, ANNOALLVISIBLE/ANNOAUTOSCALE, viewport scale, DXF, status bar list. Left: per-scale positions (ANNORESET is a no-op), a viewport annotation scale apart from its viewport scale, annotative objects inside blocks and old LEADERs, scale contexts of hatches and multileaders (text, MText, dimensions and block references read and write AutoCAD's contexts) | `cmd/annoscale.rs`, `doc/src/anno.rs` | Low-medium | 4–8 |
| F12 | Annotative scaling done (#468): scale list (SCALELISTEDIT), CANNOSCALE, OBJECTSCALE, ANNOALLVISIBLE/ANNOAUTOSCALE, viewport scale, DXF, status bar list. Left: per-scale positions (ANNORESET is a no-op), a viewport annotation scale apart from its viewport scale, annotative objects inside blocks and old LEADERs, scale contexts of hatches (text, MText, dimensions, multileaders and block references read and write AutoCAD's contexts) | `cmd/annoscale.rs`, `doc/src/anno.rs` | Low-medium | 4–8 |
| F14 | **[alpha blocker]** Plotting leftovers: binary `.ctb`/`.stb`/`.pc3` files can't be read; model-space PDF plots keep the default margins (a device paper's margins apply to layouts and PNG plots); no system printers (H3); the page setup's "Plot transparency" is not saved in DXF/DWG (the public DXF Reference has no plot layout flag for it), so it lasts for the session and in JSON only. The Plot dialog (#160), Plot Preview and PUBLISH (#186), plot styles (CTB and STB, [plot-styles.md](plot-styles.md), #410) with their end, join and fill styles, plotter devices with paper sizes and printable areas ([plotters.md](plotters.md), #564), and plotted transparency (page setup and Plot dialog option, PLOTTRANSPARENCYOVERRIDE) landed | `io/src/plotter.rs`, `cmd/plotters.rs` | Medium | 4–8 |
| F13 | Hatch: 23 patterns (AutoCAD ~85; ours must stay original); the Hatch and Gradient and Hatch Edit dialogs have no Preview or Inherit Properties (HPDLGMODE 0 keeps HATCH on the command line); no MPolygon; HATCHEDIT and -HATCHEDIT add boundaries from picked points or closed objects and remove chosen loops, but a hatch copied with its boundary isn't linked to the copy; HPGAPTOL closes gaps between curve ends only | `doc/src/library.rs`, `cmd/hatch.rs`, `cmd/hatch/edit.rs` | Medium | 6–10 |
| F15 | Viewports: a clipped viewport and its clip boundary move and scale separately. Polygonal, object and clipped viewports, VPCLIP, MVIEW ON/OFF/Lock/2/3/4 and the status-bar scale list landed (#453), MVIEW Restore in #633 | `cmd/layout/viewports.rs` | Low | 2–4 |
@@ -74,7 +74,7 @@ Detail: [file-format-parity.md](file-format-parity.md).
| # | Gap | User impact | Est. |
|---|---|---|---|
| FF1 | **[alpha blocker]** Round-trip what we don't model. DXF done (#528): unknown entities and objects (with their CLASS records), foreign xdata (hyperlinks included), extension dictionaries, persistent reactors, DICTIONARYVAR and XRECORDs, layer states, colour book colours, references remapped on save; IMAGE, VIEW/UCS, groups, block descriptions, true colours, transparency (#201, #204, #208, #209, #213, #223); WIPEOUT and gradients (#147, #162). Left: through DWG, acadrust drops custom-class entities and objects, xdata on table records and blocks, entity colour book names and reactors; UCS elevation; MTEXT background colours; unknown entities follow only layer edits, and renamed layers and blocks lose their foreign data A user's QSAVE now asks before such a loss and keeps the previous file as `.bak`; the loss itself remains. | High | 6–10 |
| FF2 | Multileader leftovers (native MULTILEADER read/write landed, #459): several landings per multileader (extra leader roots are folded into the lines), per-object overrides (leader colour and linetype, arrowhead symbol, text frame), annotative scale contexts; check the text placement of our MULTILEADER output in AutoCAD | Medium | 3–5 |
| FF2 | Multileader leftovers (native MULTILEADER read/write landed, #459): several landings per multileader (extra leader roots are folded into the lines), per-object overrides (leader colour and linetype, arrowhead symbol, text frame); check the text placement of our MULTILEADER output in AutoCAD | Medium | 3–5 |
| FF3 | Save-version leftovers (DXF/DWG 2000–2018, binary DXF, SAVEAS `version`/`binary` and the default save version landed, #421): no R14 DWG or R12 DXF output; the Save dialog can't pick the version per file (the file picker doesn't report the chosen type; File > Default Save Format sets it); no command-line SAVEAS format prompt | Low | 2–4 |
| FF4 | Code-page leftovers (pre-2007 DXF read in their `$DWGCODEPAGE` landed, #505): Johab (ANSI_1361) and DOS 855/857/860–865/869 read as ANSI_1252; saving declares `ANSI_1252` instead of the file's code page (the text is pure ASCII, so still correct); acadrust approximates DOS code pages in pre-2007 DWG (DOS437 as 866, DOS850 as 1252) | Low | 1–2 |
| FF5 | **[alpha blocker]** Real-file corpus (`storytold/cadcraft-corpus`), open → save → reopen tests, black-box check in AutoCAD | High | 10–15 + human |
@@ -167,6 +167,7 @@ Detail: [localization-parity.md](localization-parity.md).
| 2026-10-15 | minor | BREAKLINE (Tools ▸ Express Tools ▸ Break-line Symbol): one polyline between two points with a break symbol, Block/Size/Extension options, size times DIMSCALE: E3 narrowed |
| 2026-10-15 | minor | TXT2MTXT (Tools ▸ Express Tools ▸ Convert Text to Mtext): selected TEXT, and MTEXT, combined into one MTEXT top-down or in selection order with optional word wrap, or one MTEXT per TEXT; SEttings remembered for the session: E3 narrowed |
| 2026-10-13 | minor | Selection window gesture preference (PICKDRAG 0/2) added to Options ▸ Selection and saved in the profile (U6), with Portuguese and Ukrainian labels |
| 2026-10-15 | minor | F12, FF2: annotative multileaders keep their annotation scales on save (AutoCAD's scale contexts) |
| 2026-10-15 | minor | F12: annotative text, MText and dimensions keep their annotation scales on save as AutoCAD's scale contexts (AutoCAD files' contexts were dropped) |
| 2026-10-12 | minor | Object transparency (entity, ByLayer, ByBlock) is drawn: on screen (TRANSPARENCYDISPLAY, on by default), in PNG/SVG exports, and in plots when the page setup's "Plot transparency" is on (PDF alpha, PNG blending, SVG opacity; PLOTTRANSPARENCYOVERRIDE): F14 narrowed |
| 2026-10-12 | minor | Hatch and Gradient dialog (HATCH, GRADIENT; HPDLGMODE) and Hatch Edit dialog (HATCHEDIT, right-click, double-click a hatch): F13 narrowed to Preview, Inherit Properties and boundary add/remove in edit mode |