mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-05 19:51:26 -05:00
DXF/DWG import: shaded hatches leave a block's scale check unchanged
Main added Geom::Shaded for gradient and pattern hatches, and the scale check's match did not cover it, so vectorcraft-cad stopped compiling. Gradients fill and pattern lines carry their own dashes at the lineweight, so neither makes a block's look depend on its insert scale.
This commit is contained in:
@@ -1205,7 +1205,8 @@ impl<'d, 'a> Build<'d, 'a> {
|
||||
Geom::Path { width, .. } => {
|
||||
*width > 0.0 || self.d.linetypes.get(&self.linetype(&it.props, inh)).is_some_and(|p| p.iter().take(64).any(|v| *v < 0.0))
|
||||
}
|
||||
Geom::Text(_) | Geom::Image(_) => false,
|
||||
// Gradients fill, and pattern lines carry their own dashes at the lineweight.
|
||||
Geom::Shaded { .. } | Geom::Text(_) | Geom::Image(_) => false,
|
||||
Geom::Insert(ins) => {
|
||||
let child = self.inherit(&it.props, inh);
|
||||
let child = if self.is_sensitive(&ins.block, depth + 1) { child } else { Inherit::default() };
|
||||
|
||||
@@ -1616,6 +1616,53 @@ fn dashes_on_a_hidden_layer_leave_a_block_one_symbol_for_every_scale() {
|
||||
assert_eq!(doc.symbols.len(), 1, "{:?}", doc.symbols.iter().map(|s| &s.name).collect::<Vec<_>>());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_dashed_pattern_hatch_leaves_a_block_one_symbol_for_every_scale() {
|
||||
let tables = [(0, "TABLE"), (2, "LTYPE"), (0, "LTYPE"), (2, "DASHED"), (73, "2"), (40, "15"), (49, "10"), (49, "-5"), (0, "ENDTAB")];
|
||||
// "Mark": a pattern hatch in a dashed linetype, whose lines are drawn without it.
|
||||
let mut blocks = vec![(0, "BLOCK"), (8, "0"), (2, "Mark"), (70, "0"), (10, "0"), (20, "0")];
|
||||
blocks.extend([
|
||||
(0, "HATCH"),
|
||||
(8, "0"),
|
||||
(6, "DASHED"),
|
||||
(10, "0"),
|
||||
(20, "0"),
|
||||
(30, "0"),
|
||||
(2, "ANSI31"),
|
||||
(70, "0"),
|
||||
(71, "0"),
|
||||
(91, "1"),
|
||||
(92, "2"),
|
||||
(72, "0"),
|
||||
(73, "1"),
|
||||
(93, "4"),
|
||||
(10, "0"),
|
||||
(20, "0"),
|
||||
(10, "100"),
|
||||
(20, "0"),
|
||||
(10, "100"),
|
||||
(20, "50"),
|
||||
(10, "0"),
|
||||
(20, "50"),
|
||||
(97, "0"),
|
||||
(75, "0"),
|
||||
(76, "1"),
|
||||
(78, "1"),
|
||||
(53, "0"),
|
||||
(43, "0"),
|
||||
(44, "5"),
|
||||
(45, "0"),
|
||||
(46, "10"),
|
||||
(79, "0"),
|
||||
(98, "0"),
|
||||
(0, "ENDBLK"),
|
||||
]);
|
||||
let inserts = [(0, "INSERT"), (2, "Mark"), (10, "0"), (20, "0"), (0, "INSERT"), (2, "Mark"), (10, "0"), (20, "100"), (41, "10"), (42, "10")];
|
||||
let doc = open(&drawing(&[], &tables, &blocks, &inserts), &points()).document;
|
||||
assert_eq!(leaves(&doc).len(), 2);
|
||||
assert_eq!(doc.symbols.len(), 1, "{:?}", doc.symbols.iter().map(|s| &s.name).collect::<Vec<_>>());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_block_first_seen_at_the_nesting_limit_still_scales_its_dashes_when_placed_shallow() {
|
||||
let tables = [(0, "TABLE"), (2, "LTYPE"), (0, "LTYPE"), (2, "DASHED"), (73, "2"), (40, "15"), (49, "10"), (49, "-5"), (0, "ENDTAB")];
|
||||
|
||||
Reference in New Issue
Block a user