Compare commits

..
13 Commits
Author SHA1 Message Date
Tanish Manku 6855f76f5a Proxy graphics: a filled polygon's loop has no boundary path flags of its own 2026-11-23 13:09:30 -07:00
Tanish Manku fc82a0d148 Merge #2697: draw the proxy graphics of ACAD_PROXY_ENTITY (#2646) 2026-11-23 12:49:40 -07:00
Walter Haslbeck 4680fd28a6 Merge main (a70b9b02) into fix/2646-proxy-graphics
Conflicts: dxf_read.rs (proxy tables next to the UCS names), render/blocks.rs
(proxy graphics inherit the proxy's own transparency without its locked-layer
fade, as block contents now do), roundtrip test (allow_in_process). Two tests
main added build an Unknown and get the graphics field.
2026-11-23 10:56:07 +01:00
Walter Haslbeck b69dc2a380 Merge main (ed0fbce2) into fix/2646-proxy-graphics 2026-11-16 10:21:09 +01:00
Walter Haslbeck 787929ee50 Merge origin/main into fix/2646-proxy-graphics
Both sides added a test at the same place in crates/render/src/tests.rs; both are kept.
2026-11-12 07:35:17 +01:00
Walter Haslbeck 7b81b92906 Merge origin/main into fix/2646-proxy-graphics
main now draws, measures, picks and transforms OLE2FRAME records (#2587), which are Unknown
too. Keep that working next to the proxy graphics:
- select: `kept_as_read` leaves out every Unknown but an OLE2FRAME, for picks, windows, ALL,
  Last, SELECT by handles and QSELECT;
- render and extents: one Unknown arm for a proxy's graphics and an OLE2FRAME's frame, in
  `draw_unknown` and `unknown_bounds`, which also keeps both functions within the cognitive
  complexity limit;
- new Unknown literals from main get `graphics: Vec::new()`.
2026-11-09 07:47:18 +01:00
Walter Haslbeck 34b4899eee fix(io): text styles keep the file's order too, so a saved proxy text keeps its style
A proxy text takes the first style whose font file it names. The drawing's styles started with
CADCraft's Standard, which the file's Standard replaced in place, so a file listing ISO before
Standard (both on the same font) was saved with Standard first, and the reopened text took it.
Reading now keeps the STYLE table in the file's order as well. Test:
`a_proxy_text_keeps_its_style_after_a_save`.
2026-11-04 14:04:25 +01:00
Walter Haslbeck 6ed01dea96 fix(io): layer and linetype tables keep the file's order, so saved proxies keep their layers; Last searches from the top
Proxy graphics name layers and linetypes by their index in the file's tables, and saving writes
the proxy unchanged. The drawing's LAYER table started with CADCraft's 0 and Defpoints and took
the file's layers after them, so a file without Defpoints at index 1 was saved with its layers
shifted: reopened, the proxy's graphics went to Defpoints, which never plots. Reading now orders
the layer and linetype tables as the file lists them (ByBlock and ByLayer first), with what
CADCraft adds after them. The round-trip test checks that the reopened graphics stay on BALLOONS.

Last searches the store from the top down (`EntityStore::iter_rev`) and stops at the first
selectable object instead of scanning the whole space.
2026-11-04 12:33:07 +01:00
Walter Haslbeck ce4b33ade2 fix(engine): Last takes the last selectable object; SELECT by handles leaves proxies out
Last skipped only proxies, so with a proxy drawn last it could take an object on a layer turned
off or frozen before it. It now takes the last object a selection may take in
(`select::selectable`), at "Select objects" and in STRETCH. SELECT given handles outright leaves
proxies out as well; other named objects are kept as before. The test covers both.
2026-11-04 11:42:57 +01:00
Walter Haslbeck 50a1f833ad fix(engine, doc): keep proxies out of every selection; leave out proxy circles and texts a matrix moves out of range
A proxy's graphics are drawn, measured and snapped to, but no command can edit a proxy, and
saving writes its record as read: a MOVE that took it in left it behind, a COPY stacked a second
one on top. So no selection takes a proxy in: picks, windows, fences, polygons, ALL, Last,
SELECTALL, group members and QSELECT leave it out (`select::selectable`). A test moves a window
round a line and a proxy: the line moves, the proxy stays.

A circle centre or text point that a finite but huge pushed matrix moves past the largest float
is left out, as a polyline's points already were, so no infinity reaches the extents.
2026-11-04 07:38:29 +01:00
Walter Haslbeck e36d1fde4b fix(doc): read UTF-16 proxy text with as_chunks (clippy chunks_exact_to_as_chunks); document the decoder's helpers 2026-11-03 10:26:32 +01:00
Walter Haslbeck 44a4e05506 contributors: add whaslbeck 2026-11-03 09:10:55 +01:00
Walter Haslbeck 0829bfa0eb feat(io, render): draw the proxy graphics of ACAD_PROXY_ENTITY (#2646)
An ACAD_PROXY_ENTITY carries the picture its application left for
programs without it (groups 92/160 and 310); AutoCAD draws it with
PROXYSHOW 1. CADCraft read these entities but drew nothing, so AutoCAD
Mechanical balloons, notes and the like were missing from screen, plots
and extents.

- doc: a decoder for the proxy graphics (ODA DWG specification, "Proxy
  Entity Graphics") into read-only entities: circles, arcs, polylines,
  filled polygons (solid hatch), TEXT/TEXT2 and their Unicode forms,
  colour, layer, linetype, lineweight, ltscale, fill and model matrices.
  Bounds-checked, with capped sizes and counts. TEXT2 draws the number
  of characters its length field gives.
- io: Unknown gets `graphics`, filled for ACAD_PROXY_ENTITY while the
  DXF (and so the DWG bridge) is read. The graphics index layers and
  linetypes by the file's table order, which the reader keeps; CADCraft's
  own tables are ordered differently. The raw tags are written back
  unchanged.
- render, extents, prims: the graphics draw and measure like block
  contents (layer 0 and ByBlock are the proxy's own), and can be picked.
2026-11-03 09:10:55 +01:00
34 changed files with 1271 additions and 1134 deletions
+1 -1
View File
@@ -72,7 +72,7 @@ Generated-in-code assets are original and have no file to list:
| `crates/ui-egui/src/i18n/bs.tsv` | Nine (@nine-codes) with Claude Code (AI-assisted) | Original Bosnian translations of CADCraft English strings, shared with storytold/craft-i18n `locales/bs/` | MIT OR Apache-2.0 (`LICENSE-MIT`, `LICENSE-APACHE`) | No proprietary localization resources copied; not yet reviewed by a native speaker |
| `crates/ui-egui/src/i18n/cs.tsv` | @Losminek (AI-assisted) | Original Czech translations of CADCraft English strings | MIT OR Apache-2.0 (`LICENSE-MIT`, `LICENSE-APACHE`) | No proprietary localization resources copied |
| `crates/ui-egui/src/i18n/ru.tsv` | @pechnikov2026-star | Original Russian translations of CADCraft English strings | MIT OR Apache-2.0 (`LICENSE-MIT`, `LICENSE-APACHE`) | No proprietary localization resources copied |
| `crates/ui-egui/src/i18n/fr.tsv` | @pechnikov2026-star; terminology pass by @YannFR81 | Original French translations of CADCraft English strings; AI-assisted consistency pass (imperative prompts, cote/espace objet/réseau/présentation) | MIT OR Apache-2.0 (`LICENSE-MIT`, `LICENSE-APACHE`) | No proprietary localization resources copied |
| `crates/ui-egui/src/i18n/fr.tsv` | @pechnikov2026-star | Original French translations of CADCraft English strings | MIT OR Apache-2.0 (`LICENSE-MIT`, `LICENSE-APACHE`) | No proprietary localization resources copied |
| `crates/ui-egui/src/i18n/zh.tsv` | @mayloglog | Original Simplified Chinese translations of CADCraft English strings | MIT OR Apache-2.0 (`LICENSE-MIT`, `LICENSE-APACHE`) | No proprietary localization resources copied |
| `crates/ui-egui/src/i18n/sv.tsv` | Erik Holmbom (@holmbom) with Claude Code (AI-assisted) | Original Swedish translations of CADCraft English strings | MIT OR Apache-2.0 (`LICENSE-MIT`, `LICENSE-APACHE`) | No proprietary localization resources copied; terminology and the running app reviewed by a native speaker |
| `crates/ui-egui/src/i18n/it.tsv` | Emanuele Bottelli (AI-assisted); terminology corrections: Andrea Brandi (@starise) with OpenAI Codex (AI-assisted) | Original Italian translations of CADCraft English strings | MIT OR Apache-2.0 (`LICENSE-MIT`, `LICENSE-APACHE`) | No proprietary localization resources copied; targeted Chamfer terminology review by a native speaker |
+5
View File
@@ -123,6 +123,11 @@ sync_github_name = true
[people.helenkwok]
real_name = "Helen Kwok"
[people.whaslbeck]
real_name = "Walter Haslbeck"
display_name = "Walter Haslbeck"
sync_github_name = false
[people.V1dalTheAbidal]
sync_github_name = true
+9 -1
View File
@@ -43,6 +43,7 @@ mod curves;
mod dim;
mod fill;
mod layout;
mod proxy;
mod text;
mod wipeout;
@@ -52,12 +53,18 @@ pub use curves::{Arc, Circle, Ellipse, Face3d, Line, LwPolyline, Point, Polyface
pub use dim::{AssocSnap, DimAssoc, DimBreak, DimKind, DimMarks, Dimension, Inspection, JoggedRadius, Leader, MLeader};
pub use fill::{Gradient, Hatch, HatchLoop};
pub use layout::{Image, Table, TableCell, Viewport};
pub use proxy::{ProxyTables, proxy_entities};
pub use text::{HAlign, MText, MTextColumnType, MTextColumns, Text, VAlign};
pub use wipeout::Wipeout;
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Unknown {
pub dxf_type: String,
pub tags: Vec<RawTag>,
/// What an ACAD_PROXY_ENTITY draws: its proxy graphics as read-only entities, made when the
/// drawing is read (the graphics refer to table rows by their place in the file). Drawn and
/// measured like block contents; saving writes `tags` unchanged.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub graphics: Vec<Entity>,
}
impl Unknown {
@@ -264,7 +271,8 @@ impl EntityKind {
EntityKind::Image(i) => vec![Prim::Point(i.insert.xy())],
EntityKind::Table(t) => vec![Prim::Point(t.insert.xy())],
EntityKind::Tolerance(t) => vec![Prim::Point(t.insert.xy())],
EntityKind::Unknown(_) => Vec::new(),
// What its proxy graphics draw, so a proxy can be picked and snapped to.
EntityKind::Unknown(u) => u.graphics.iter().flat_map(|g| g.kind.prims()).collect(),
}
}
+717
View File
@@ -0,0 +1,717 @@
//! The proxy graphics an ACAD_PROXY_ENTITY carries (DXF groups 92/160 and 310): the picture
//! the owning application left for programs that don't have it, drawn as AutoCAD draws it with
//! PROXYSHOW 1. The layout follows the Open Design Alliance's public DWG specification
//! ("Proxy Entity Graphics"): a header (total size, chunk count), then chunks of (size, type,
//! data), sizes in bytes including the 8-byte chunk header, all little-endian.
//!
//! The picture becomes ordinary, read-only entities: drawn and measured like the contents of a
//! block, with layer 0, ByBlock colour, linetype and lineweight standing for the proxy's own
//! until a chunk sets them. Chunks CADCraft doesn't decode (meshes, shells, lightweight
//! polylines, materials) are skipped.
use super::{Arc, Circle, Common, Entity, EntityKind, Handle, Hatch, HatchLoop, Line, Lineweight, LwPolyline, Text, Unknown};
use cadcraft_color::{Color, Rgb};
use cadcraft_geom::{PolyVertex, Vec2, Vec3};
/// Bytes of proxy graphics read at most from one entity.
const MAX_BYTES: usize = 16 << 20;
/// Entities made at most from one entity's proxy graphics.
const MAX_ENTITIES: usize = 100_000;
/// Vertices read at most from one polyline or polygon chunk.
const MAX_VERTICES: usize = 1_000_000;
/// Matrices pushed at most.
const MAX_MATRICES: usize = 64;
/// The table names proxy graphics refer to by index, in the order of the file's tables.
#[derive(Clone, Debug, Default)]
pub struct ProxyTables {
/// LAYER records in file order.
pub layers: Vec<String>,
/// LTYPE records in file order, without ByBlock and ByLayer (indices count only the others).
pub linetypes: Vec<String>,
/// Text styles (name, font file) in file order: a text chunk names its font, and the first
/// style with that font draws it.
pub styles: Vec<(String, String)>,
}
impl Unknown {
/// The proxy graphics bytes of an ACAD_PROXY_ENTITY: the 310 groups after its size group
/// (92, or 160 in newer files), cut to that size. Empty for other records, for an entity
/// without graphics and for one whose data isn't hex.
pub fn proxy_graphics_bytes(&self) -> Vec<u8> {
if !self.dxf_type.eq_ignore_ascii_case("ACAD_PROXY_ENTITY") {
return Vec::new();
}
let Some(at) = self.tags.iter().position(|t| t.code == 92 || t.code == 160) else { return Vec::new() };
let size = self.tags.get(at).and_then(|t| t.value.trim().parse::<usize>().ok()).unwrap_or(0).min(MAX_BYTES);
let mut out = Vec::with_capacity(size);
for t in self.tags.iter().skip(at + 1).take_while(|t| t.code == 310) {
// Damaged data draws nothing rather than a picture cut at a guess.
if !push_hex(&mut out, &t.value) {
return Vec::new();
}
if out.len() >= size {
break;
}
}
out.truncate(size);
out
}
}
/// Append the bytes of hex string `s`. False on a character that isn't a hex digit.
fn push_hex(out: &mut Vec<u8>, s: &str) -> bool {
let digits: Vec<u8> = s.trim().bytes().collect();
for pair in digits.chunks(2) {
let (Some(&hi), Some(&lo)) = (pair.first(), pair.get(1)) else { return false };
let (Some(hi), Some(lo)) = ((hi as char).to_digit(16), (lo as char).to_digit(16)) else { return false };
out.push((hi * 16 + lo) as u8);
}
true
}
/// The entities the proxy graphics `bytes` draw, all with `handle` (the proxy's): selecting one
/// selects the proxy.
pub fn proxy_entities(bytes: &[u8], tables: &ProxyTables, handle: Handle) -> Vec<Entity> {
let mut r = Decoder {
tables,
handle,
pen: Common { layer: "0".into(), color: Color::ByBlock, linetype: "ByBlock".into(), lineweight: Lineweight::ByBlock, ..Common::default() },
fill: false,
matrices: Vec::new(),
out: Vec::new(),
};
let mut at = 8;
while let (Some(size), Some(kind)) = (u32_at(bytes, at), u32_at(bytes, at + 4)) {
let size = size as usize;
if size < 8 || r.out.len() >= MAX_ENTITIES {
break;
}
let Some(data) = bytes.get(at + 8..at.saturating_add(size)) else { break };
r.chunk(kind, data);
at += size;
}
r.out
}
struct Decoder<'a> {
tables: &'a ProxyTables,
handle: Handle,
/// Layer, colour, linetype and lineweight for the entities that follow.
pen: Common,
fill: bool,
/// Model transforms pushed by PUSH_MATRIX, innermost last (row-major 3x4 of the 4x4).
matrices: Vec<[f64; 12]>,
out: Vec<Entity>,
}
impl Decoder<'_> {
/// Decode one chunk of type `kind`: draw it, or change the pen for what follows.
fn chunk(&mut self, kind: u32, data: &[u8]) {
let mut b = Bytes { data, at: 0 };
match kind {
// CIRCLE: centre, radius, normal.
2 => {
if let (Some(c), Some(r)) = (b.point(), b.f64()) {
self.circle(c, r);
}
}
// CIRCLE_3P: three points on it.
3 => {
if let (Some(p1), Some(p2), Some(p3)) = (b.point(), b.point(), b.point())
&& let Some((c, r)) = circle_through(self.xy(p1), self.xy(p2), self.xy(p3))
{
self.push(EntityKind::Circle(Circle { center: c.to3(0.0), radius: r }));
}
}
// CIRCULAR_ARC: centre, radius, normal, start vector, sweep angle (around the normal).
4 => {
if let (Some(c), Some(r), Some(n), Some(v), Some(sweep)) = (b.point(), b.f64(), b.point(), b.point(), b.f64()) {
self.arc(c, r, n, v, sweep);
}
}
// CIRCULAR_ARC_3P: start, a point on the arc, end.
5 => {
if let (Some(p1), Some(p2), Some(p3)) = (b.point(), b.point(), b.point()) {
self.arc_3p(self.xy(p1), self.xy(p2), self.xy(p3));
}
}
// POLYLINE and POLYGON: a count, then the points.
6 | 7 => {
let Some(n) = b.u32() else { return };
let n = (n as usize).min(MAX_VERTICES);
let pts: Vec<Vec2> = (0..n).map_while(|_| b.point()).map(|p| self.xy(p)).collect();
self.polyline(pts, kind == 7);
}
// TEXT: position, normal, direction, height, width factor, oblique, string.
10 => {
if let (Some(p), Some(_), Some(dir), Some(h), Some(w), Some(o)) = (b.point(), b.point(), b.point(), b.f64(), b.f64(), b.f64()) {
let s = b.string();
self.text(TextChunk { p, dir, height: h, width: w, oblique: o, value: s, font: String::new() });
}
}
// TEXT2: position, normal, direction, string, length (the characters drawn), raw
// flag, height, width factor, oblique, tracking, five style flags, font, big font.
11 => {
if let (Some(p), Some(_), Some(dir)) = (b.point(), b.point(), b.point()) {
let s = b.string();
let s = first_chars(s, b.u32());
b.skip(4);
if let (Some(h), Some(w), Some(o)) = (b.f64(), b.f64(), b.f64()) {
b.skip(8 + 20);
let font = b.string();
self.text(TextChunk { p, dir, height: h, width: w, oblique: o, value: s, font });
}
}
}
// UNICODE_TEXT: as TEXT with a UTF-16 string.
36 => {
if let (Some(p), Some(_), Some(dir), Some(h), Some(w), Some(o)) = (b.point(), b.point(), b.point(), b.f64(), b.f64(), b.f64()) {
let s = b.unicode();
self.text(TextChunk { p, dir, height: h, width: w, oblique: o, value: s, font: String::new() });
}
}
// UNICODE_TEXT2: as TEXT2 with UTF-16 strings, and bold, italic, charset, pitch and
// the typeface before the font file.
38 => {
if let (Some(p), Some(_), Some(dir)) = (b.point(), b.point(), b.point()) {
let s = b.unicode();
let s = first_chars(s, b.u32());
b.skip(4);
if let (Some(h), Some(w), Some(o)) = (b.f64(), b.f64(), b.f64()) {
b.skip(8 + 20 + 16);
let _typeface = b.unicode();
let font = b.unicode();
self.text(TextChunk { p, dir, height: h, width: w, oblique: o, value: s, font });
}
}
}
// ATTRIBUTE_COLOR: ACI, 0 ByBlock, 256 ByLayer.
14 => {
if let Some(c) = b.u32() {
self.pen.color = Color::from_aci(i16::try_from(c).unwrap_or(256));
}
}
// ATTRIBUTE_LAYER: index into the layer table; an index past it leaves the layer.
16 => {
if let Some(name) = b.u32().and_then(|i| self.tables.layers.get(i as usize)) {
self.pen.layer = name.clone();
}
}
// ATTRIBUTE_LINETYPE: index into the linetypes other than ByBlock and ByLayer;
// 32766 is ByBlock, 32767 and anything past the table ByLayer.
18 => {
if let Some(i) = b.u32() {
self.pen.linetype = match i {
32766 => "ByBlock".into(),
_ => self.tables.linetypes.get(i as usize).cloned().unwrap_or_else(|| "ByLayer".into()),
};
}
}
// ATTRIBUTE_FILL: the next polygon is filled.
20 => self.fill = b.u32().is_some_and(|f| f != 0),
// ATTRIBUTE_TRUE_COLOR: a colour with its method in the top byte.
22 => {
if let Some(v) = b.u32() {
self.pen.color = match v >> 24 {
0xC0 => Color::ByLayer,
0xC1 => Color::ByBlock,
0xC2 => Color::True(Rgb::from_u32(v & 0x00FF_FFFF)),
0xC3 => Color::from_aci((v & 0xFF) as i16),
_ => self.pen.color,
};
}
}
// ATTRIBUTE_LINEWEIGHT: hundredths of a millimetre, or -1 ByLayer, -2 ByBlock,
// -3 the default.
23 => {
if let Some(v) = b.u32() {
self.pen.lineweight = Lineweight::from_dxf(i16::try_from(v as i32).unwrap_or(-1));
}
}
// ATTRIBUTE_LTSCALE.
24 => {
if let Some(s) = b.f64().filter(|s| s.is_finite() && *s > 0.0) {
self.pen.ltscale = s;
}
}
// PUSH_MATRIX, PUSH_MATRIX2: a 4x4 model transform for what follows; POP_MATRIX.
29 | 30 => {
let m: Vec<f64> = (0..16).map_while(|_| b.f64()).collect();
if let Some(m) = m.get(..12).and_then(|m| <[f64; 12]>::try_from(m).ok())
&& m.iter().all(|x| x.is_finite())
&& self.matrices.len() < MAX_MATRICES
{
self.matrices.push(m);
}
}
31 => {
self.matrices.pop();
}
_ => {}
}
}
/// Add an entity drawn with the current pen (up to [`MAX_ENTITIES`]).
fn push(&mut self, kind: EntityKind) {
if self.out.len() < MAX_ENTITIES {
self.out.push(Entity { handle: self.handle, common: self.pen.clone(), kind });
}
}
/// `p` through the pushed matrices, innermost first, in the XY plane.
fn xy(&self, p: Vec3) -> Vec2 {
let mut p = p;
for m in self.matrices.iter().rev() {
p = Vec3::new(
m[0] * p.x + m[1] * p.y + m[2] * p.z + m[3],
m[4] * p.x + m[5] * p.y + m[6] * p.z + m[7],
m[8] * p.x + m[9] * p.y + m[10] * p.z + m[11],
);
}
p.xy()
}
/// How much the pushed matrices scale lengths (1 without any).
fn scale(&self) -> f64 {
self.matrices.iter().map(|m| (m[0] * m[5] - m[1] * m[4]).abs().sqrt()).product()
}
/// A full circle around `c`, through the pushed matrices.
fn circle(&mut self, c: Vec3, r: f64) {
let r = r * self.scale();
let c = self.xy(c);
if r.is_finite() && r > 0.0 && c.is_finite() {
self.push(EntityKind::Circle(Circle { center: c.to3(0.0), radius: r }));
}
}
/// An arc around `c` from the direction `start`, turned by `sweep` around `normal`.
fn arc(&mut self, c: Vec3, r: f64, normal: Vec3, start: Vec3, sweep: f64) {
if !(r.is_finite() && r > 0.0 && sweep.is_finite() && sweep != 0.0) || start.xy().len() < 1e-12 {
return;
}
// The start point and the end point (the start vector turned by the sweep around the
// normal: clockwise in plan for a normal pointing down), through the matrices.
let dir = if normal.z < 0.0 { -1.0 } else { 1.0 };
let a0 = start.y.atan2(start.x);
let a1 = a0 + dir * sweep;
let on = |a: f64| c + Vec3::new(r * a.cos(), r * a.sin(), 0.0);
let mid = on((a0 + a1) / 2.0);
if sweep.abs() >= std::f64::consts::TAU - 1e-9 {
return self.circle(c, r);
}
self.arc_3p(self.xy(on(a0)), self.xy(mid), self.xy(on(a1)));
}
/// The arc from `p1` through `p2` to `p3`.
fn arc_3p(&mut self, p1: Vec2, p2: Vec2, p3: Vec2) {
let Some((c, r)) = circle_through(p1, p2, p3) else {
return self.polyline(vec![p1, p3], false);
};
let ang = |p: Vec2| (p.y - c.y).atan2(p.x - c.x);
let (a1, a2, a3) = (ang(p1), ang(p2), ang(p3));
let ccw = |from: f64, to: f64| (to - from).rem_euclid(std::f64::consts::TAU);
// Counter-clockwise from p1 to p3 when p2 lies on that way, else from p3 to p1.
let (start, end) = if ccw(a1, a2) <= ccw(a1, a3) { (a1, a3) } else { (a3, a1) };
self.push(EntityKind::Arc(Arc { center: c.to3(0.0), radius: r, start, end }));
}
/// A polyline, or a closed polygon: filled (a solid hatch) when ATTRIBUTE_FILL asked for it,
/// which applies to this one polygon only.
fn polyline(&mut self, pts: Vec<Vec2>, polygon: bool) {
let fill = std::mem::take(&mut self.fill);
if pts.iter().any(|p| !p.is_finite()) || pts.is_empty() {
return;
}
if polygon && fill && pts.len() >= 3 {
let vertices = pts.iter().map(|&p| PolyVertex { p, bulge: 0.0, start_width: 0.0, end_width: 0.0 }).collect();
return self.push(EntityKind::Hatch(Hatch {
pattern: "SOLID".into(),
solid: true,
loops: vec![HatchLoop { vertices, outer: true, boundary_flags: None, sources: Vec::new() }],
scale: 1.0,
angle: 0.0,
associative: false,
style: 0,
elevation: 0.0,
gradient: None,
origin: Vec2::ZERO,
background: None,
pattern_lines: Vec::new(),
}));
}
match pts.as_slice() {
[a, b] if !polygon => self.push(EntityKind::Line(Line { a: a.to3(0.0), b: b.to3(0.0) })),
_ => {
let vertices = pts.iter().map(|&p| PolyVertex { p, bulge: 0.0, start_width: 0.0, end_width: 0.0 }).collect();
self.push(EntityKind::LwPolyline(LwPolyline { vertices, closed: polygon, const_width: 0.0, elevation: 0.0, plinegen: false }));
}
}
}
/// A single-line text, its style the first one whose font file the chunk names.
fn text(&mut self, t: TextChunk) {
let TextChunk { p, dir, height, width, oblique, value, font } = t;
let font = font.as_str();
let height = height * self.scale();
if !(height.is_finite() && height > 0.0) || value.is_empty() {
return;
}
let at = self.xy(p);
if !at.is_finite() {
return;
}
let towards = self.xy(p + dir) - at;
let rotation = if towards.len() > 1e-12 { towards.y.atan2(towards.x) } else { 0.0 };
let stem = |f: &str| f.trim().rsplit(['/', '\\']).next().unwrap_or_default().split('.').next().unwrap_or_default().to_ascii_lowercase();
let style = self
.tables
.styles
.iter()
.find(|(_, f)| !font.is_empty() && stem(f) == stem(font))
.map(|(n, _)| n.clone())
.unwrap_or_else(|| "Standard".into());
self.push(EntityKind::Text(Text {
insert: at.to3(0.0),
align_pt: None,
height,
value,
rotation,
width_factor: if width.is_finite() && width > 0.0 { width } else { 1.0 },
oblique: if oblique.is_finite() { oblique } else { 0.0 },
style,
halign: Default::default(),
valign: Default::default(),
}));
}
}
/// The first `length` characters of `s`: a text chunk may carry more text than it draws (the
/// rest of a note, drawn by the chunks after it). No length, or one past the end, keeps it all.
fn first_chars(s: String, length: Option<u32>) -> String {
match length.map(|n| n as usize) {
Some(n) if n > 0 && n < s.chars().count() => s.chars().take(n).collect(),
_ => s,
}
}
/// A text chunk: position, direction, height, width factor, oblique, string and font file.
struct TextChunk {
p: Vec3,
dir: Vec3,
height: f64,
width: f64,
oblique: f64,
value: String,
font: String,
}
/// The circle through three points (centre, radius), if they aren't on one line.
fn circle_through(a: Vec2, b: Vec2, c: Vec2) -> Option<(Vec2, f64)> {
let d = 2.0 * (a.x * (b.y - c.y) + b.x * (c.y - a.y) + c.x * (a.y - b.y));
if !d.is_finite() || d.abs() < 1e-12 {
return None;
}
let (a2, b2, c2) = (a.x * a.x + a.y * a.y, b.x * b.x + b.y * b.y, c.x * c.x + c.y * c.y);
let center =
Vec2::new((a2 * (b.y - c.y) + b2 * (c.y - a.y) + c2 * (a.y - b.y)) / d, (a2 * (c.x - b.x) + b2 * (a.x - c.x) + c2 * (b.x - a.x)) / d);
let r = (a - center).len();
(center.is_finite() && r.is_finite() && r > 0.0).then_some((center, r))
}
/// The little-endian u32 at `at`, if `bytes` holds one there.
fn u32_at(bytes: &[u8], at: usize) -> Option<u32> {
bytes.get(at..at.checked_add(4)?).and_then(|b| b.try_into().ok()).map(u32::from_le_bytes)
}
/// A reader over one chunk's data. Strings are padded to four bytes.
struct Bytes<'a> {
data: &'a [u8],
at: usize,
}
impl Bytes<'_> {
/// The next `n` bytes, if there are that many.
fn take(&mut self, n: usize) -> Option<&[u8]> {
let s = self.data.get(self.at..self.at.checked_add(n)?)?;
self.at += n;
Some(s)
}
/// Pass over `n` bytes (reads after the end then find nothing).
fn skip(&mut self, n: usize) {
self.at = self.at.saturating_add(n);
}
/// A little-endian u32.
fn u32(&mut self) -> Option<u32> {
self.take(4).and_then(|b| b.try_into().ok()).map(u32::from_le_bytes)
}
/// A little-endian double.
fn f64(&mut self) -> Option<f64> {
self.take(8).and_then(|b| b.try_into().ok()).map(f64::from_le_bytes)
}
/// Three doubles, if all are finite.
fn point(&mut self) -> Option<Vec3> {
let p = Vec3::new(self.f64()?, self.f64()?, self.f64()?);
(p.x.is_finite() && p.y.is_finite() && p.z.is_finite()).then_some(p)
}
/// Move on to the next multiple of four bytes, where padded strings end.
fn align(&mut self) {
self.at = self.at.saturating_add((4 - self.at % 4) % 4);
}
/// A zero-terminated string in the drawing's code page; bytes above 0x7F as Latin-1.
fn string(&mut self) -> String {
let rest = self.data.get(self.at..).unwrap_or_default();
let end = rest.iter().position(|&c| c == 0).unwrap_or(rest.len());
let s: String = rest.iter().take(end).map(|&c| c as char).collect();
self.at += end + 1;
self.align();
s
}
/// A UTF-16 string ended by a zero code unit.
fn unicode(&mut self) -> String {
let rest = self.data.get(self.at..).unwrap_or_default();
let (pairs, _) = rest.as_chunks::<2>();
let units: Vec<u16> = pairs.iter().map(|&p| u16::from_le_bytes(p)).take_while(|&u| u != 0).collect();
self.at += units.len() * 2 + 2;
self.align();
String::from_utf16_lossy(&units)
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::RawTag;
/// A chunk of type `kind`, its data padded to four bytes.
fn chunk(kind: u32, data: &[u8]) -> Vec<u8> {
let mut d = data.to_vec();
d.resize(d.len().div_ceil(4) * 4, 0);
let mut out = ((8 + d.len()) as u32).to_le_bytes().to_vec();
out.extend(kind.to_le_bytes());
out.extend(d);
out
}
/// Proxy graphics: the header (total size, chunk count), then the chunks.
fn graphics(chunks: &[Vec<u8>]) -> Vec<u8> {
let body: Vec<u8> = chunks.concat();
let mut out = ((8 + body.len()) as u32).to_le_bytes().to_vec();
out.extend((chunks.len() as u32).to_le_bytes());
out.extend(body);
out
}
/// A point in the XY plane as three doubles.
fn pt(x: f64, y: f64) -> Vec<u8> {
[x, y, 0.0].iter().flat_map(|v| v.to_le_bytes()).collect()
}
/// Two layers, two linetypes and two text styles.
fn tables() -> ProxyTables {
ProxyTables {
layers: vec!["0".into(), "BALLOONS".into()],
linetypes: vec!["Continuous".into(), "DASHED".into()],
styles: vec![("Standard".into(), "txt".into()), ("ISO".into(), "isocp.shx".into())],
}
}
/// A balloon as AutoCAD Mechanical stores one: layer, colour, a circle, the leader and the
/// number as TEXT2.
#[test]
fn a_balloon_becomes_circle_line_and_text() {
let mut text2 = pt(173.0, 112.0);
text2.extend(pt(0.0, 0.0).iter().take(16).chain(1.0f64.to_le_bytes().iter()));
text2.extend(pt(1.0, 0.0));
text2.extend(b"12\0\0");
text2.extend(2i32.to_le_bytes());
text2.extend(0i32.to_le_bytes());
for v in [6.0f64, 1.0, 0.0, 0.0] {
text2.extend(v.to_le_bytes());
}
text2.extend([0u8; 20]);
text2.extend(b"ISOCP.SHX\0\0\0\0\0");
let mut circle = pt(175.0, 115.0);
circle.extend(6.0f64.to_le_bytes());
circle.extend(pt(0.0, 0.0).iter().take(16).chain(1.0f64.to_le_bytes().iter()));
let mut leader = 2u32.to_le_bytes().to_vec();
leader.extend(pt(170.0, 111.0));
leader.extend(pt(150.0, 90.0));
let g = graphics(&[chunk(16, &1u32.to_le_bytes()), chunk(14, &1u32.to_le_bytes()), chunk(2, &circle), chunk(6, &leader), chunk(11, &text2)]);
let es = proxy_entities(&g, &tables(), Handle(0x35));
assert_eq!(es.len(), 3);
assert!(es.iter().all(|e| e.handle == Handle(0x35) && e.common.layer == "BALLOONS" && e.common.color == Color::Index(1)));
assert!(matches!(&es[0].kind, EntityKind::Circle(c) if c.center == Vec3::new(175.0, 115.0, 0.0) && c.radius == 6.0));
assert!(matches!(&es[1].kind, EntityKind::Line(l) if l.b == Vec3::new(150.0, 90.0, 0.0)));
assert!(matches!(&es[2].kind, EntityKind::Text(t) if t.value == "12" && t.height == 6.0 && t.style == "ISO" && t.rotation == 0.0));
}
/// A TEXT2 chunk draws only as many characters as its length says.
#[test]
fn text2_draws_its_length() {
let text2 = |value: &[u8], length: i32| {
let mut t = pt(0.0, 0.0);
t.extend([0.0f64, 0.0, 1.0].iter().flat_map(|v| v.to_le_bytes()));
t.extend(pt(1.0, 0.0));
t.extend(value);
t.extend(vec![0u8; 4 - value.len() % 4]);
t.extend(length.to_le_bytes());
t.extend(1i32.to_le_bytes());
for v in [2.5f64, 1.0, 0.0, 0.0] {
t.extend(v.to_le_bytes());
}
t.extend([0u8; 20]);
t.extend(b"txt\0");
let es = proxy_entities(&graphics(&[chunk(11, &t)]), &tables(), Handle(1));
match es.first().map(|e| &e.kind) {
Some(EntityKind::Text(t)) => t.value.clone(),
other => panic!("{other:?}"),
}
};
assert_eq!(text2(b"two lines\\Pof text", 9), "two lines");
assert_eq!(text2(b"whole", 0), "whole");
assert_eq!(text2(b"whole", 99), "whole");
}
/// Without layer and colour chunks the picture takes the proxy's own (layer 0, ByBlock).
#[test]
fn unset_traits_are_the_proxys() {
let mut leader = 3u32.to_le_bytes().to_vec();
for (x, y) in [(0.0, 0.0), (10.0, 0.0), (10.0, 5.0)] {
leader.extend(pt(x, y));
}
let es = proxy_entities(
&graphics(&[chunk(6, &leader), chunk(16, &u32::MAX.to_le_bytes()), chunk(18, &32766u32.to_le_bytes())]),
&tables(),
Handle(1),
);
let e = es.first().expect("polyline");
assert_eq!(
(e.common.layer.as_str(), e.common.color, e.common.linetype.as_str(), e.common.lineweight),
("0", Color::ByBlock, "ByBlock", Lineweight::ByBlock)
);
assert!(matches!(&e.kind, EntityKind::LwPolyline(p) if p.vertices.len() == 3 && !p.closed));
}
#[test]
fn a_filled_polygon_is_a_solid_hatch_and_fill_applies_once() {
let mut tri = 3u32.to_le_bytes().to_vec();
for (x, y) in [(0.0, 0.0), (4.0, 0.0), (2.0, 3.0)] {
tri.extend(pt(x, y));
}
let es = proxy_entities(&graphics(&[chunk(20, &1u32.to_le_bytes()), chunk(7, &tri), chunk(7, &tri)]), &tables(), Handle(1));
assert!(matches!(&es[0].kind, EntityKind::Hatch(h) if h.solid && h.loops[0].vertices.len() == 3));
assert!(matches!(&es[1].kind, EntityKind::LwPolyline(p) if p.closed));
}
/// A quarter arc counter-clockwise from 0°, and the same sweep around a downward normal,
/// which runs clockwise in plan (from 0° to -90°).
#[test]
fn arcs_follow_their_normal() {
let arc = |nz: f64| {
let mut a = pt(0.0, 0.0);
a.extend(2.0f64.to_le_bytes());
a.extend([0.0f64, 0.0, nz].iter().flat_map(|v| v.to_le_bytes()));
a.extend(pt(1.0, 0.0));
a.extend(std::f64::consts::FRAC_PI_2.to_le_bytes());
a.extend(0u32.to_le_bytes());
match proxy_entities(&graphics(&[chunk(4, &a)]), &tables(), Handle(1)).first().map(|e| e.kind.clone()) {
Some(EntityKind::Arc(a)) => (a.start, a.end, a.radius),
other => panic!("{other:?}"),
}
};
let (s, e, r) = arc(1.0);
assert!(s.abs() < 1e-9 && (e - std::f64::consts::FRAC_PI_2).abs() < 1e-9 && (r - 2.0).abs() < 1e-9);
let (s, e, _) = arc(-1.0);
assert!((s + std::f64::consts::FRAC_PI_2).abs() < 1e-9 && e.abs() < 1e-9, "{s} {e}");
}
#[test]
fn a_pushed_matrix_moves_what_follows_until_popped() {
let mut m = [0.0f64; 16];
(m[0], m[5], m[10], m[15], m[3], m[7]) = (2.0, 2.0, 1.0, 1.0, 100.0, 50.0);
let mut circle = pt(1.0, 1.0);
circle.extend(1.0f64.to_le_bytes());
circle.extend(pt(0.0, 0.0));
let push: Vec<u8> = m.iter().flat_map(|v| v.to_le_bytes()).collect();
let es = proxy_entities(&graphics(&[chunk(29, &push), chunk(2, &circle), chunk(31, &[]), chunk(2, &circle)]), &tables(), Handle(1));
assert!(matches!(&es[0].kind, EntityKind::Circle(c) if c.center == Vec3::new(102.0, 52.0, 0.0) && c.radius == 2.0));
assert!(matches!(&es[1].kind, EntityKind::Circle(c) if c.center == Vec3::new(1.0, 1.0, 0.0) && c.radius == 1.0));
}
/// A finite matrix can still move a point past the largest float: a circle or a text that
/// would land there is left out, as a polyline is, so no infinity reaches the extents.
#[test]
fn what_a_matrix_moves_out_of_range_is_left_out() {
let mut m = [0.0f64; 16];
(m[0], m[5], m[10], m[15], m[3]) = (1.0, 1.0, 1.0, 1.0, 1.7e308);
let push: Vec<u8> = m.iter().flat_map(|v| v.to_le_bytes()).collect();
let mut circle = pt(1e308, 0.0);
circle.extend(1.0f64.to_le_bytes());
circle.extend(pt(0.0, 0.0));
let mut text = pt(1e308, 0.0);
text.extend([0.0f64, 0.0, 1.0].iter().flat_map(|v| v.to_le_bytes()));
text.extend(pt(1.0, 0.0));
text.extend(b"far\0");
text.extend(0i32.to_le_bytes());
text.extend(1i32.to_le_bytes());
for v in [2.5f64, 1.0, 0.0, 0.0] {
text.extend(v.to_le_bytes());
}
text.extend([0u8; 20]);
text.extend(b"txt\0");
let es = proxy_entities(&graphics(&[chunk(29, &push), chunk(2, &circle), chunk(11, &text)]), &tables(), Handle(1));
assert!(es.is_empty(), "{es:?}");
// The same text without the matrix is drawn: the chunk itself is sound.
assert_eq!(proxy_entities(&graphics(&[chunk(11, &text)]), &tables(), Handle(1)).len(), 1);
}
#[test]
fn the_bytes_come_from_the_310_groups_after_the_size() {
let tag = |code: i32, value: &str| RawTag { code, value: value.into() };
let u = Unknown {
dxf_type: "ACAD_PROXY_ENTITY".into(),
tags: vec![tag(90, "498"), tag(92, "5"), tag(310, "0102"), tag(310, "030405FF"), tag(93, "0")],
graphics: Vec::new(),
};
assert_eq!(u.proxy_graphics_bytes(), [1, 2, 3, 4, 5]);
let other = Unknown { dxf_type: "ACAD_PROXY_OBJECT".into(), ..u.clone() };
assert!(other.proxy_graphics_bytes().is_empty());
let bad = Unknown { tags: vec![tag(92, "4"), tag(310, "01zz")], ..u };
assert!(bad.proxy_graphics_bytes().is_empty());
}
/// Truncated chunks, sizes past the end, huge counts and garbage draw what they can and
/// never panic.
#[test]
fn hostile_graphics_do_not_panic() {
let mut huge = u32::MAX.to_le_bytes().to_vec();
huge.extend(pt(1.0, 1.0));
let mut nan = pt(f64::NAN, 0.0);
nan.extend(1.0f64.to_le_bytes());
let cases: Vec<Vec<u8>> = vec![
Vec::new(),
vec![0; 7],
graphics(&[chunk(6, &huge)]),
graphics(&[chunk(2, &nan)]),
graphics(&[chunk(11, &[0xFF; 30])]),
graphics(&[chunk(38, &[0x41; 77])]),
graphics(&[chunk(29, &[1; 40])]),
graphics(&[chunk(31, &[]), chunk(31, &[])]),
[graphics(&[chunk(2, &pt(0.0, 0.0))]), vec![0xFF; 9]].concat(),
{
let mut g = graphics(&[]);
g.extend(4u32.to_le_bytes());
g.extend(2u32.to_le_bytes());
g
},
{
let mut g = graphics(&[]);
g.extend(1_000u32.to_le_bytes());
g.extend(2u32.to_le_bytes());
g
},
];
for g in cases {
let _ = proxy_entities(&g, &tables(), Handle(1));
}
}
}
+30 -4
View File
@@ -371,6 +371,28 @@ fn bounds_of<'a>(d: &'a Drawing, e: &Entity, depth: usize, off_counts: bool, blo
bounds_in(d, e, depth, blocks, off_counts)
}
/// The bounds of a record kept as read that draws something: a proxy as its proxy graphics draw
/// (layer 0 in them is the proxy's layer), each at the next depth as a block's contents are, and an
/// OLE2FRAME as its frame.
fn unknown_bounds<'a>(
d: &'a Drawing,
u: &crate::Unknown,
depth: usize,
blocks: &mut HashMap<(&'a str, usize), Bounds2>,
off_counts: bool,
) -> Bounds2 {
if u.graphics.is_empty() {
return ole_frame(&u.tags).map_or(Bounds2::EMPTY, Bounds2::from_points);
}
if depth >= MAX_BLOCK_DEPTH {
return Bounds2::EMPTY;
}
u.graphics
.iter()
.filter(|g| in_block_visible(d, g, off_counts))
.fold(Bounds2::EMPTY, |b, g| b.union(&bounds_in(d, g, depth + 1, blocks, off_counts)))
}
/// [`entity_bounds`] with the bounds of block contents (in block coordinates) already computed,
/// by block name and depth: every further reference to a block at that depth reuses them instead of
/// expanding the block again, so nested or self-referencing blocks cost at most one pass over each
@@ -516,8 +538,9 @@ fn bounds_in<'a>(d: &'a Drawing, e: &Entity, depth: usize, blocks: &mut HashMap<
Bounds2::from_points([o, o + u, o + v, o + u + v])
}
EntityKind::LwPolyline(p) => lwpolyline_bounds(p),
// An OLE object's content is not drawn, but its frame is, so the frame counts (#2422).
EntityKind::Unknown(u) if u.is_ole_frame() => ole_frame(&u.tags).map_or(Bounds2::EMPTY, Bounds2::from_points),
// A proxy measures as its proxy graphics draw. An OLE object's content is not drawn, but its
// frame is, so the frame counts (#2422).
EntityKind::Unknown(u) if !u.graphics.is_empty() || u.is_ole_frame() => unknown_bounds(d, u, depth, blocks, off_counts),
kind => {
let mut b = Bounds2::EMPTY;
for p in kind.prims() {
@@ -718,12 +741,15 @@ mod tests {
#[test]
fn ole_frame_counts_in_extents() {
let tag = |code: i32, value: &str| crate::RawTag { code, value: value.into() };
let frame = |tags: Vec<crate::RawTag>| EntityKind::Unknown(crate::Unknown { dxf_type: "OLE2FRAME".into(), tags });
let frame = |tags: Vec<crate::RawTag>| EntityKind::Unknown(crate::Unknown { dxf_type: "OLE2FRAME".into(), tags, graphics: Vec::new() });
let b = bounds(frame(vec![tag(10, "30"), tag(20, "-19"), tag(11, "35"), tag(21, "-22")]));
assert_eq!((b.min, b.max), (Vec2::new(30.0, -22.0), Vec2::new(35.0, -19.0)));
assert!(bounds(frame(vec![tag(10, "1"), tag(20, "2")])).is_empty(), "one corner is not a frame");
assert!(bounds(frame(vec![tag(10, "NaN"), tag(20, "0"), tag(11, "1"), tag(21, "inf")])).is_empty());
assert!(bounds(EntityKind::Unknown(crate::Unknown { dxf_type: "OTHER".into(), tags: vec![tag(10, "5"), tag(20, "5")] })).is_empty());
assert!(
bounds(EntityKind::Unknown(crate::Unknown { dxf_type: "OTHER".into(), tags: vec![tag(10, "5"), tag(20, "5")], graphics: Vec::new() }))
.is_empty()
);
}
/// Groups 10/20 inside an application-defined `102 {...}` group belong to the application, not
+5
View File
@@ -57,6 +57,10 @@ impl EntityStore {
pub fn iter(&self) -> impl Iterator<Item = &Arc<Entity>> + '_ {
self.chunks.iter().flat_map(|c| c.items.iter())
}
/// Iterate from the top of the draw order down.
pub fn iter_rev(&self) -> impl Iterator<Item = &Arc<Entity>> + '_ {
self.chunks.iter().rev().flat_map(|c| c.items.iter().rev())
}
pub fn handles(&self) -> Vec<Handle> {
self.iter().map(|e| e.handle).collect()
}
@@ -346,6 +350,7 @@ mod tests {
}
assert!(s.move_next_to(Handle(1), Handle(3), true));
assert_eq!(order(&s), [2, 3, 1, 4, 5]);
assert_eq!(s.iter_rev().map(|e| e.handle.0).collect::<Vec<_>>(), [5, 4, 1, 3, 2], "top down");
assert!(s.move_next_to(Handle(5), Handle(2), false));
assert_eq!(order(&s), [5, 2, 3, 1, 4]);
assert!(!s.move_next_to(Handle(5), Handle(5), true));
+3 -1
View File
@@ -593,7 +593,9 @@ fn run_select(s: &mut Session, p: &Value) -> Result<Value> {
} else if let Some(f) = points_param(p, "fence") {
crate::select::select_fence_in(s.doc()?, &space, s.viewport_frozen(), &f)
} else if ["handles", "handle"].iter().any(|k| p.get(*k).is_some_and(|v| !v.is_null())) {
targets(s, p)?
// Handles named outright, less the proxies: no selection takes one in.
let d = s.doc()?;
targets(s, p)?.into_iter().filter(|h| !d.entity(*h).is_some_and(|e| crate::select::kept_as_read(&e.kind))).collect()
} else {
// Nothing to select with: the selection stays, also what the active viewport does not draw.
s.stored_selection()
+6 -2
View File
@@ -219,14 +219,18 @@ fn type_matches(e: &Entity, ty: Option<&str>) -> bool {
}
}
/// The candidate objects: the whole edit space, or the current selection.
/// The candidate objects: the whole edit space (without proxies, which no selection takes in), or
/// the current selection.
fn candidates(s: &Session, p: &Value) -> Result<Vec<Handle>> {
let apply = str_param(p, "applyTo").unwrap_or("drawing").to_ascii_lowercase();
if apply.starts_with("sel") || apply == "current" {
return Ok(s.selection());
}
let space = s.space();
Ok(s.doc()?.space(&space).map(|st| st.iter().take(MAX_SCAN).map(|e| e.handle).collect()).unwrap_or_default())
Ok(s.doc()?
.space(&space)
.map(|st| st.iter().take(MAX_SCAN).filter(|e| !crate::select::kept_as_read(&e.kind)).map(|e| e.handle).collect())
.unwrap_or_default())
}
fn run_qselect(s: &mut Session, p: &Value) -> Result<Value> {
+16 -9
View File
@@ -161,19 +161,25 @@ pub(crate) fn on_frozen_layer(frozen: &[String], e: &Entity) -> bool {
/// The last object of `store`, in draw order, that is not on one of the layers in `frozen`, the
/// layers frozen in the layout viewport the selection is made through: what the Last option
/// takes there. With no such layers it is the last object, whether the drawing shows it or not.
/// A proxy is passed over: no selection takes one in ([`kept_as_read`]).
pub(crate) fn last_in(store: &cadcraft_doc::EntityStore, frozen: &[String]) -> Option<Handle> {
if frozen.is_empty() {
return store.last().map(|e| e.handle);
}
store.iter().filter(|e| !on_frozen_layer(frozen, e)).last().map(|e| e.handle)
store.iter_rev().find(|e| !kept_as_read(&e.kind) && !on_frozen_layer(frozen, e)).map(|e| e.handle)
}
/// Whether a selection can take `e`: the drawing shows it ([`Drawing::is_visible`]) and it is not
/// Whether a selection can take `e`: the drawing shows it ([`Drawing::is_visible`]), it is not
/// on one of the layers in `frozen`, the layers frozen in the layout viewport the selection is
/// made through ([`crate::DocState::viewport_frozen`]; empty anywhere else). A viewport shows
/// model space, so `frozen` goes with a selection in model space only.
/// made through ([`crate::DocState::viewport_frozen`]; empty anywhere else), and commands can
/// edit it. A viewport shows model space, so `frozen` goes with a selection in model space only.
/// A proxy (or another record CADCraft keeps as it was read) is drawn and snapped to, but never
/// selected: commands can't edit it, and saving writes its record as it was read.
pub(crate) fn selectable(d: &Drawing, e: &Entity, frozen: &[String]) -> bool {
d.is_visible(e) && !on_frozen_layer(frozen, e)
d.is_visible(e) && !on_frozen_layer(frozen, e) && !kept_as_read(&e.kind)
}
/// Whether `k` is a record CADCraft keeps as it was read and commands can't edit: every
/// [`EntityKind::Unknown`] but an OLE2FRAME, which moves and scales with its frame.
pub(crate) fn kept_as_read(k: &EntityKind) -> bool {
matches!(k, EntityKind::Unknown(u) if !u.is_ole_frame())
}
/// Entities to test, in the order to test them, each with its bounds when already known.
@@ -599,7 +605,8 @@ mod tests {
#[test]
fn clicking_an_ole_frame_edge_selects_it() {
let tag = |code: i32, value: &str| cadcraft_doc::RawTag { code, value: value.into() };
let frame = |tags: Vec<cadcraft_doc::RawTag>| EntityKind::Unknown(cadcraft_doc::Unknown { dxf_type: "OLE2FRAME".into(), tags });
let frame =
|tags: Vec<cadcraft_doc::RawTag>| EntityKind::Unknown(cadcraft_doc::Unknown { dxf_type: "OLE2FRAME".into(), tags, graphics: Vec::new() });
let mut d = Drawing::new_metric();
let h = d.add(&Space::Model, Common::default(), frame(vec![tag(10, "30"), tag(20, "-19"), tag(11, "35"), tag(21, "-22")])).unwrap();
d.add(&Space::Model, Common::default(), frame(vec![tag(10, "80"), tag(20, "80")])).unwrap();
+44
View File
@@ -1561,6 +1561,50 @@ fn setvar_rejects_non_finite_text_for_real_variables() {
}
}
#[test]
fn a_proxy_is_drawn_but_no_selection_takes_it_in() {
// A proxy's graphics are drawn and measured, but saving writes its record unchanged: an edit
// could not hold. So a window round a line and a proxy, ALL, SELECTALL and a pick on the
// proxy's graphics leave the proxy out, and MOVE moves the line alone.
use cadcraft_doc::{Common, Entity, Handle, Line, Space, Unknown, entity_bounds};
use cadcraft_geom::Vec3;
let mut s = Session::new();
s.execute("line", &json!({"points": [[0, 0], [10, 0]]})).unwrap();
let line = s.doc().unwrap().model.last().unwrap().handle;
let drawn = Entity::new(Handle(0), EntityKind::Line(Line { a: Vec3::new(0.0, 5.0, 0.0), b: Vec3::new(10.0, 5.0, 0.0) }));
let unknown = Unknown { dxf_type: "ACAD_PROXY_ENTITY".into(), tags: Vec::new(), graphics: vec![drawn] };
let proxy = s.doc_mut().unwrap().add(&Space::Model, Common::default(), EntityKind::Unknown(unknown)).unwrap();
let bounds = |s: &Session| entity_bounds(s.doc().unwrap(), s.doc().unwrap().entity(proxy).unwrap(), 0);
let before = bounds(&s);
assert!(!before.is_empty(), "the proxy measures as its graphics");
s.idle_click(Vec2::new(5.0, 5.0), false).unwrap();
assert_eq!(s.selection(), Vec::<Handle>::new(), "a pick on the proxy's graphics");
s.idle_click(Vec2::new(-1.0, -1.0), false).unwrap();
s.idle_click(Vec2::new(11.0, 6.0), false).unwrap();
assert_eq!(s.selection(), vec![line], "a window round both");
s.execute("selectall", &json!({})).unwrap();
assert_eq!(s.selection(), vec![line], "SELECTALL");
s.execute("move", &json!({"delta": [0, 20]})).unwrap();
let d = s.doc().unwrap();
assert!(matches!(&d.entity(line).unwrap().kind, EntityKind::Line(l) if l.a.y == 20.0), "the line moved");
assert_eq!(bounds(&s), before, "the proxy stayed where its record puts it");
// Handles named outright leave the proxy out too.
s.execute("select", &json!({"handles": [proxy.hex(), line.hex()]})).unwrap();
assert_eq!(s.selection(), vec![line], "SELECT by handles");
// Last passes over the proxy drawn last: it takes the line.
s.set_selection(Vec::new());
s.start("erase").unwrap();
s.input(Input::Text("L".into())).unwrap();
s.input(Input::Enter).unwrap();
let d = s.doc().unwrap();
assert!(d.entity(line).is_none(), "Last took the line");
assert!(d.entity(proxy).is_some(), "the proxy is kept");
}
#[test]
fn additional_tools_keeps_compatible_command_ids() {
assert_eq!(crate::cmd::resolve_alias("-blockreplace"), "blockreplace");
+12 -5
View File
@@ -9,8 +9,11 @@ use serde_json::json;
fn session() -> (Session, String) {
let tag = |code: i32, v: &str| RawTag { code, value: v.into() };
let mut d = Drawing::new_imperial();
let kind =
EntityKind::Unknown(Unknown { dxf_type: "OLE2FRAME".into(), tags: vec![tag(10, "30"), tag(20, "-19"), tag(11, "35"), tag(21, "-22")] });
let kind = EntityKind::Unknown(Unknown {
dxf_type: "OLE2FRAME".into(),
tags: vec![tag(10, "30"), tag(20, "-19"), tag(11, "35"), tag(21, "-22")],
graphics: Vec::new(),
});
let h = d.add(&Space::Model, Common::default(), kind).unwrap();
let mut s = Session::empty();
s.open_drawing(d, "ole.dxf", None);
@@ -75,7 +78,8 @@ fn data_session(chunks: &[usize], hex_override: Option<&str>) -> (Session, Strin
tags.push(tag(310, &hex[at..]));
}
let mut d = Drawing::new_imperial();
let h = d.add(&Space::Model, Common::default(), EntityKind::Unknown(Unknown { dxf_type: "OLE2FRAME".into(), tags })).unwrap();
let h =
d.add(&Space::Model, Common::default(), EntityKind::Unknown(Unknown { dxf_type: "OLE2FRAME".into(), tags, graphics: Vec::new() })).unwrap();
let mut s = Session::empty();
s.open_drawing(d, "ole.dxf", None);
(s, h.hex())
@@ -160,8 +164,11 @@ fn a_locked_ole_frame_does_not_block_an_in_place_rotation() {
let mut d = Drawing::new_imperial();
d.ensure_layer("L");
let common = Common { layer: "L".into(), ..Common::default() };
let kind =
EntityKind::Unknown(Unknown { dxf_type: "OLE2FRAME".into(), tags: vec![tag(10, "30"), tag(20, "-19"), tag(11, "35"), tag(21, "-22")] });
let kind = EntityKind::Unknown(Unknown {
dxf_type: "OLE2FRAME".into(),
tags: vec![tag(10, "30"), tag(20, "-19"), tag(11, "35"), tag(21, "-22")],
graphics: Vec::new(),
});
let ole = d.add(&Space::Model, common, kind).unwrap();
if let Some(l) = d.layer_mut("L") {
l.locked = true;
@@ -8,7 +8,7 @@ use cadcraft_engine::doc::{Block, Common, Drawing, EntityKind, RawTag, Space, Un
use serde_json::json;
fn unknown(kind: &str) -> EntityKind {
EntityKind::Unknown(Unknown { dxf_type: kind.into(), tags: vec![RawTag { code: 8, value: "0".into() }] })
EntityKind::Unknown(Unknown { dxf_type: kind.into(), tags: vec![RawTag { code: 8, value: "0".into() }], graphics: Vec::new() })
}
#[test]
@@ -129,6 +129,7 @@ fn proxy_entities_are_reported_only_before_2013() {
RawTag { code: 90, value: "498".into() },
RawTag { code: 91, value: class.to_string() },
],
graphics: Vec::new(),
})
};
let mut d = Drawing::new_imperial();
@@ -190,6 +191,7 @@ fn saving_sat_text_solids_as_dxf_2013_reports_them() {
RawTag { code: 1, value: "400 1 1 0".into() },
RawTag { code: 3, value: "End-of-ACIS-data".into() },
],
graphics: Vec::new(),
});
d.add(&Space::Model, Common::default(), sat).unwrap();
let mut s = Session::empty();
@@ -219,7 +221,7 @@ fn a_dxf_2013_loss_is_known_before_saving() {
set_io(IoHooks { read: |_, _| Err("no reader in this test".into()), write: |_, _| Ok(b"0\nEOF\n".to_vec()), plot: None });
let sat = |d: &mut Drawing| {
let tags = vec![RawTag { code: 8, value: "0".into() }, RawTag { code: 1, value: "400 1 1 0".into() }];
d.add(&Space::Model, Common::default(), EntityKind::Unknown(Unknown { dxf_type: "REGION".into(), tags })).unwrap();
d.add(&Space::Model, Common::default(), EntityKind::Unknown(Unknown { dxf_type: "REGION".into(), tags, graphics: Vec::new() })).unwrap();
};
let mut modern = Drawing::new_imperial();
modern.header.set_str("ACADVER", "AC1032");
@@ -255,6 +257,7 @@ fn the_note_counts_the_host_drawing_while_a_block_is_edited() {
RawTag { code: 1, value: "400 1 1 0".into() },
RawTag { code: 3, value: "End-of-ACIS-data".into() },
],
graphics: Vec::new(),
});
d.add(&Space::Model, Common::default(), sat).unwrap();
d.blocks.insert("Door".into(), std::sync::Arc::new(Block::new("Door")));
@@ -276,7 +279,7 @@ fn the_note_counts_the_host_drawing_while_a_block_is_edited() {
fn a_dwg_keeps_sat_text_solids_only_before_2013() {
use cadcraft_engine::cmd::file::{Version, not_saved_as};
let tag = |code: i32, value: &str| RawTag { code, value: value.into() };
let solid = |tags: Vec<RawTag>| EntityKind::Unknown(Unknown { dxf_type: "3DSOLID".into(), tags });
let solid = |tags: Vec<RawTag>| EntityKind::Unknown(Unknown { dxf_type: "3DSOLID".into(), tags, graphics: Vec::new() });
let mut d = Drawing::new_imperial();
d.add(&Space::Model, Common::default(), solid(vec![tag(100, "AcDbModelerGeometry"), tag(1, "700 0 1 0")])).unwrap();
d.add(&Space::Model, Common::default(), solid(vec![tag(100, "AcDbModelerGeometry"), tag(70, "1")])).unwrap();
@@ -352,6 +355,7 @@ fn proxy_entity(strings: &str) -> EntityKind {
EntityKind::Unknown(Unknown {
dxf_type: "ACAD_PROXY_ENTITY".into(),
tags: tags.iter().map(|(code, value)| RawTag { code: *code, value: (*value).into() }).collect(),
graphics: Vec::new(),
})
}
+30
View File
@@ -62,6 +62,9 @@ struct Rx {
block_arrays: HashMap<String, cadcraft_doc::ArrayParams>,
/// LAYER record handle (upper case) → layer name (VIEWPORT group 331/341 frozen layers).
layers: HashMap<String, String>,
/// Layer, linetype and text style names in the order of the file's tables, which proxy
/// graphics refer to by index (the drawing's own tables are ordered differently).
proxy_tables: cadcraft_doc::ProxyTables,
/// UCS record handle (upper case) → UCS name (a layout's named UCS, group 345).
ucss: HashMap<String, String>,
/// Owner handle, paper flag and enclosing block (upper case) of each generated sheet viewport
@@ -75,6 +78,26 @@ struct Rx {
image_defs: HashMap<Handle, String>,
}
/// Order `items` as the file's table lists them (`order`, names in any case), after the `pinned`
/// names: records the file doesn't have keep their order after the file's own. A file without
/// that table changes nothing.
fn keep_file_order<T>(items: &mut [T], name: impl Fn(&T) -> &str, order: &[String], pinned: &[&str]) {
if order.is_empty() {
return;
}
let mut place: HashMap<String, usize> = HashMap::new();
for (i, n) in order.iter().enumerate() {
place.entry(n.to_ascii_lowercase()).or_insert(i);
}
items.sort_by_key(|it| {
let n = name(it);
match pinned.iter().position(|p| p.eq_ignore_ascii_case(n)) {
Some(i) => (0, i),
None => place.get(&n.to_ascii_lowercase()).map_or((2, 0), |&i| (1, i)),
}
});
}
/// Read a DXF file into a drawing.
pub fn read(bytes: &[u8]) -> Result<Drawing> {
read_budgeted(bytes, 4_000_000, hatch::MAX_READ_CURVE_POINTS)
@@ -179,6 +202,13 @@ fn read_budgeted(bytes: &[u8], mut table_cells_left: usize, curve_points: usize)
_ => {}
}
}
// Proxy graphics name layers and linetypes by their place in the file's tables, and saving
// writes them unchanged: the tables keep the file's order, with what CADCraft adds after it.
keep_file_order(&mut d.layers, |l| &l.name, &rx.proxy_tables.layers, &[]);
keep_file_order(&mut d.linetypes, |l| &l.name, &rx.proxy_tables.linetypes, &["ByBlock", "ByLayer"]);
// A proxy text takes the first style on its font, so the styles keep the file's order too.
let styles: Vec<String> = rx.proxy_tables.styles.iter().map(|(n, _)| n.clone()).collect();
keep_file_order(&mut d.text_styles, |s| &s.name, &styles, &[]);
// A file CADCraft wrote names its own next handle (#495): its table records and objects
// are numbered above it and rebuilt on save, so following $HANDSEED would drift every save.
let own_seed = objs.xrecord_text(crate::dxf_ext::HANDSEED_KEY).and_then(|t| Handle::parse_hex(t.trim()));
+5
View File
@@ -329,6 +329,7 @@ pub(super) fn entity_with_table_budget(
other => EntityKind::Unknown(Unknown {
dxf_type: other.to_string(),
tags: tags.iter().map(|tg| RawTag { code: tg.code, value: tg.str() }).collect(),
graphics: Vec::new(),
}),
};
Some((c, k))
@@ -488,6 +489,10 @@ pub(super) fn entity_plot_style(tags: &[Tag], rx: &Rx) -> Option<String> {
/// needs the file's handle maps.
pub(super) fn entity_extras(kind: &str, tags: &[Tag], h: Handle, k: &mut EntityKind, rx: &mut Rx) {
match (kind, k) {
// Its proxy graphics, with the table indices resolved while the file's order is known.
("ACAD_PROXY_ENTITY", EntityKind::Unknown(u)) => {
u.graphics = cadcraft_doc::proxy_entities(&u.proxy_graphics_bytes(), &rx.proxy_tables, h);
}
("DIMENSION", EntityKind::Dimension(dm)) => {
dm.overrides = crate::dxf_ext::read_dstyle(tags, &rx.styles, &rx.brs, &rx.ltypes);
dm.assoc = crate::dxf_ext::read_assoc(tags);
+5
View File
@@ -299,6 +299,7 @@ fn index_table_handles(recs: &[(String, &[Tag])], rx: &mut Rx) {
let (Some(handle), Some(name)) = (table.s(5), table.s(2)) else { continue };
match kind.as_str() {
"STYLE" => {
rx.proxy_tables.styles.push((name.clone(), table.s(3).unwrap_or_default()));
rx.styles.insert(handle.trim().to_ascii_uppercase(), name);
}
"BLOCK_RECORD" => {
@@ -310,9 +311,13 @@ fn index_table_handles(recs: &[(String, &[Tag])], rx: &mut Rx) {
rx.brs.insert(handle.trim().to_ascii_uppercase(), name);
}
"LTYPE" => {
if !name.eq_ignore_ascii_case("ByBlock") && !name.eq_ignore_ascii_case("ByLayer") {
rx.proxy_tables.linetypes.push(name.clone());
}
rx.ltypes.insert(handle.trim().to_ascii_uppercase(), name);
}
"LAYER" => {
rx.proxy_tables.layers.push(name.clone());
rx.layers.insert(handle.trim().to_ascii_uppercase(), name);
}
"UCS" => {
+6 -2
View File
@@ -39,7 +39,11 @@ fn drawing() -> Drawing {
d.add(
&Space::Model,
Common::default(),
EntityKind::Unknown(Unknown { dxf_type: "ACME_WIDGET".into(), tags: vec![tag(100, "AcDbEntity"), tag(10, "1.0"), tag(20, "2.0")] }),
EntityKind::Unknown(Unknown {
dxf_type: "ACME_WIDGET".into(),
tags: vec![tag(100, "AcDbEntity"), tag(10, "1.0"), tag(20, "2.0")],
graphics: Vec::new(),
}),
)
.unwrap();
d.add(&Space::Paper("Layout1".into()), Common::default(), line((1.0, 1.0), (2.0, 2.0))).unwrap();
@@ -521,7 +525,7 @@ fn corpus_round_trip_report() {
fn types_the_dwg_writer_cannot_write_are_reported_lost() {
use corpus::{CorpusReport, FileReport, Format, round_trip};
crate::dwg_worker::allow_in_process();
let unknown = |t: &str, tags: Vec<RawTag>| EntityKind::Unknown(Unknown { dxf_type: t.into(), tags });
let unknown = |t: &str, tags: Vec<RawTag>| EntityKind::Unknown(Unknown { dxf_type: t.into(), tags, graphics: Vec::new() });
let mut d = Drawing::new_metric();
let widget = vec![tag(100, "AcDbEntity"), tag(100, "AcmeWidget"), tag(10, "1.0"), tag(20, "2.0"), tag(30, "0.0")];
d.add(&Space::Model, Common::default(), unknown("ACME_WIDGET", widget.clone())).unwrap();
+1 -1
View File
@@ -370,7 +370,7 @@ fn top_line_kept_objects_and_unknown(handle: Handle) -> Drawing {
RawTag { code: 100, value: "SyntheticWidget".into() },
RawTag { code: 1, value: "widget".into() },
];
let kind = EntityKind::Unknown(Unknown { dxf_type: "SYNTHETIC_WIDGET".into(), tags });
let kind = EntityKind::Unknown(Unknown { dxf_type: "SYNTHETIC_WIDGET".into(), tags, graphics: Vec::new() });
d.model.push(Entity { handle, common: Common::default(), kind });
d
}
+1 -1
View File
@@ -166,7 +166,7 @@ fn sat_text_is_told_by_its_subclass_and_a_geometry_record() {
use cadcraft_doc::foreign::{Foreign, sat_text_acis};
use cadcraft_doc::{Handle, RawTag, Unknown};
let tag = |code: i32, value: &str| RawTag { code, value: value.into() };
let solid = |tags: Vec<RawTag>| Unknown { dxf_type: "3DSOLID".into(), tags };
let solid = |tags: Vec<RawTag>| Unknown { dxf_type: "3DSOLID".into(), tags, graphics: Vec::new() };
let none = std::collections::BTreeSet::new();
let h = Handle(0x2B);
// A stray 1 or 3 outside AcDbModelerGeometry is not SAT text.
+1
View File
@@ -69,6 +69,7 @@ mod plot_model_png_scale;
mod plot_styles;
mod polyface_roundtrip;
mod portable_fonts;
mod proxy_graphics;
mod region_roundtrip;
#[cfg(not(any(target_arch = "wasm32", all(target_os = "freebsd", target_arch = "aarch64"))))]
mod render_settings_version;
+172
View File
@@ -0,0 +1,172 @@
//! ACAD_PROXY_ENTITY draws its proxy graphics (#2646): read from DXF with the table indices of the
//! file, measured in the extents, and written back unchanged.
use cadcraft_doc::color::Color;
use cadcraft_doc::{EntityKind, Space};
use cadcraft_io::{read_dxf, write_dxf};
/// A proxy graphics chunk of type `kind`, its data padded to four bytes.
fn chunk(kind: u32, data: &[u8]) -> Vec<u8> {
let mut d = data.to_vec();
d.resize(d.len().div_ceil(4) * 4, 0);
let mut out = ((8 + d.len()) as u32).to_le_bytes().to_vec();
out.extend(kind.to_le_bytes());
out.extend(d);
out
}
/// A point in the XY plane as three doubles.
fn pt(x: f64, y: f64) -> Vec<u8> {
[x, y, 0.0].iter().flat_map(|v| v.to_le_bytes()).collect()
}
/// A balloon: layer 1 of the file's LAYER table, colour 1, a circle, a leader and the number.
fn balloon() -> Vec<u8> {
let mut circle = pt(175.0, 115.0);
circle.extend(6.0f64.to_le_bytes());
circle.extend([0.0f64, 0.0, 1.0].iter().flat_map(|v| v.to_le_bytes()));
let mut leader = 2u32.to_le_bytes().to_vec();
leader.extend(pt(170.8, 110.8));
leader.extend(pt(150.0, 90.0));
let mut text = pt(172.9, 112.0);
text.extend([0.0f64, 0.0, 1.0].iter().flat_map(|v| v.to_le_bytes()));
text.extend(pt(1.0, 0.0));
text.extend(b"1\0\0\0");
text.extend(1i32.to_le_bytes());
text.extend(0i32.to_le_bytes());
for v in [6.0f64, 1.0, 0.0, 0.0] {
text.extend(v.to_le_bytes());
}
text.extend([0u8; 20]);
text.extend(b"isocp.shx\0\0\0\0\0\0\0");
let chunks = [chunk(16, &1u32.to_le_bytes()), chunk(14, &1u32.to_le_bytes()), chunk(2, &circle), chunk(6, &leader), chunk(11, &text)];
let body = chunks.concat();
let mut out = ((8 + body.len()) as u32).to_le_bytes().to_vec();
out.extend((chunks.len() as u32).to_le_bytes());
out.extend(body);
out
}
/// A DXF whose LAYER table holds 0 and BALLOONS only (CADCraft keeps Defpoints at index 1 of
/// its own table), a text style on isocp.shx, a line and one proxy balloon.
fn file() -> String {
let graphics = balloon();
let hex: Vec<String> = graphics.chunks(127).map(|c| c.iter().map(|b| format!("{b:02X}")).collect()).collect();
let mut tags: Vec<(i32, String)> = vec![(0, "SECTION".into()), (2, "CLASSES".into())];
for (c, v) in [(0, "CLASS"), (1, "SYNBALLOON"), (2, "SynBalloon"), (3, "SyntheticProxyApp"), (90, "0"), (280, "0"), (281, "1"), (0, "ENDSEC")] {
tags.push((c, v.into()));
}
for (c, v) in [
(0, "SECTION"),
(2, "TABLES"),
(0, "TABLE"),
(2, "LAYER"),
(0, "LAYER"),
(5, "10"),
(2, "0"),
(62, "7"),
(0, "LAYER"),
(5, "11"),
(2, "BALLOONS"),
(62, "3"),
(0, "ENDTAB"),
(0, "TABLE"),
(2, "STYLE"),
(0, "STYLE"),
(5, "12"),
(2, "ISO"),
(3, "isocp.shx"),
(0, "ENDTAB"),
(0, "ENDSEC"),
(0, "SECTION"),
(2, "ENTITIES"),
(0, "LINE"),
(5, "20"),
(8, "0"),
(10, "50"),
(20, "40"),
(11, "150"),
(21, "90"),
(0, "ACAD_PROXY_ENTITY"),
(5, "21"),
(100, "AcDbEntity"),
(8, "0"),
(100, "AcDbProxyEntity"),
(90, "498"),
(91, "500"),
(95, "0"),
(70, "0"),
] {
tags.push((c, v.into()));
}
tags.push((92, graphics.len().to_string()));
tags.extend(hex.into_iter().map(|h| (310, h)));
for (c, v) in [(93, "0"), (94, "0"), (0, "ENDSEC"), (0, "EOF")] {
tags.push((c, v.into()));
}
tags.iter().map(|(c, v)| format!("{c}\n{v}\n")).collect()
}
#[test]
fn a_proxy_draws_its_graphics_with_the_files_table_indices() {
let d = read_dxf(file().as_bytes()).expect("read");
let proxy = d.model.iter().find(|e| matches!(e.kind, EntityKind::Unknown(_))).expect("proxy");
let EntityKind::Unknown(u) = &proxy.kind else { unreachable!() };
let kinds: Vec<(&str, &str, Color)> = u.graphics.iter().map(|g| (g.kind.dxf_name(), g.common.layer.as_str(), g.common.color)).collect();
// Layer index 1 is BALLOONS, the file's second layer, not CADCraft's Defpoints.
assert_eq!(kinds, [("CIRCLE", "BALLOONS", Color::Index(1)), ("LINE", "BALLOONS", Color::Index(1)), ("TEXT", "BALLOONS", Color::Index(1))]);
assert!(matches!(&u.graphics[2].kind, EntityKind::Text(t) if t.value == "1" && t.style == "ISO"));
// The extents reach the balloon (the line alone ends at 150, 90).
let b = d.extents(&Space::Model);
assert!(b.max.x >= 181.0 && b.max.y >= 121.0, "{b:?}");
}
#[test]
fn a_proxy_is_written_back_unchanged_and_draws_again() {
let d = read_dxf(file().as_bytes()).expect("read");
let again = read_dxf(write_dxf(&d).as_bytes()).expect("reopen");
let graphics = |d: &cadcraft_doc::Drawing| {
d.model.iter().find_map(|e| match &e.kind {
EntityKind::Unknown(u) => Some((u.proxy_graphics_bytes(), u.graphics.len())),
_ => None,
})
};
assert_eq!(graphics(&again), graphics(&d));
assert_eq!(graphics(&d).map(|g| g.1), Some(3));
// The saved LAYER table keeps the file's order, so index 1 is still BALLOONS (CADCraft's
// Defpoints comes after it) and the reopened graphics stay on that layer.
let layers = |d: &cadcraft_doc::Drawing| -> Vec<String> {
d.model
.iter()
.find_map(|e| match &e.kind {
EntityKind::Unknown(u) => Some(u.graphics.iter().map(|g| g.common.layer.clone()).collect()),
_ => None,
})
.unwrap_or_default()
};
assert_eq!(layers(&again), ["BALLOONS"; 3]);
let names: Vec<&str> = again.layers.iter().map(|l| l.name.as_str()).collect();
assert_eq!(names, ["0", "BALLOONS", "Defpoints"]);
}
/// A proxy text takes the first style on its font. With ISO and then Standard both on
/// isocp.shx, it is ISO, and stays ISO after a save: CADCraft's own Standard, which the file's
/// replaces, would otherwise come first in the saved STYLE table.
#[test]
fn a_proxy_text_keeps_its_style_after_a_save() {
let iso = "0\nSTYLE\n5\n12\n2\nISO\n3\nisocp.shx\n";
let src = file().replacen(iso, &format!("{iso}0\nSTYLE\n5\n13\n2\nStandard\n3\nisocp.shx\n"), 1);
let style = |d: &cadcraft_doc::Drawing| {
d.model.iter().find_map(|e| match &e.kind {
EntityKind::Unknown(u) => u.graphics.iter().find_map(|g| match &g.kind {
EntityKind::Text(t) => Some(t.style.clone()),
_ => None,
}),
_ => None,
})
};
let d = read_dxf(src.as_bytes()).expect("read");
assert_eq!(style(&d).as_deref(), Some("ISO"));
let again = read_dxf(write_dxf(&d).as_bytes()).expect("reopen");
assert_eq!(style(&again).as_deref(), Some("ISO"), "after a save");
}
+1 -1
View File
@@ -27,7 +27,7 @@ fn drawing() -> Drawing {
RawTag { code: 30, value: "3.75".into() },
RawTag { code: 330, value: target.hex() },
];
d.model.push(Entity::new(handle, EntityKind::Unknown(Unknown { dxf_type: "SYNTHETIC_WIDGET".into(), tags })));
d.model.push(Entity::new(handle, EntityKind::Unknown(Unknown { dxf_type: "SYNTHETIC_WIDGET".into(), tags, graphics: Vec::new() })));
d.model.push(Entity::new(target, EntityKind::Line(Line { a: Vec3::ZERO, b: Vec3::new(5.0, 6.0, 7.0) })));
d
}
+17
View File
@@ -40,6 +40,23 @@ pub(crate) fn sub_ctx<'a>(ctx: &Ctx<'a>, e: &Entity, m: Mat3) -> Ctx<'a> {
}
}
/// A proxy entity draws its proxy graphics as AutoCAD does with PROXYSHOW 1, like block contents:
/// layer 0 and ByBlock in the picture stand for the proxy's own layer and properties. Other
/// unknown records draw nothing. `own` is the proxy's transparency without its locked-layer fade,
/// as for a block reference.
pub(crate) fn proxy(b: &mut Builder, ctx: &Ctx, e: &Entity, u: &cadcraft_doc::Unknown, own: u8) {
if u.graphics.is_empty() || ctx.depth >= cadcraft_doc::MAX_BLOCK_DEPTH {
return;
}
let sub = Ctx { block_pstyle: b.named, block_transparency: own, ..sub_ctx(ctx, e, Mat3::IDENTITY) };
for g in &u.graphics {
if !b.expand() {
break;
}
entity(b, &sub, g);
}
}
/// `own` is the reference's resolved transparency without its locked-layer fade: what ByBlock
/// children inherit (a child fades only for its own layer).
pub(crate) fn insert(b: &mut Builder, ctx: &Ctx, e: &Entity, ins: &cadcraft_doc::Insert, rgb: Ink, own: u8) {
+13 -7
View File
@@ -1,4 +1,4 @@
use super::blocks::{insert, sub_ctx};
use super::blocks::{insert, proxy, sub_ctx};
use super::dim_draw::{MAX_FILL_SOLIDS, MAX_FILL_TEXTS, block_text_box, dim_text_fill, dimension, dimension_in, solid_covers, starts_text_marks};
use super::display::{Kind, NO_LAYER, VIEWPORT_CONTENT};
use super::props::{resolve, transparency};
@@ -240,12 +240,7 @@ fn entity_parts(b: &mut Builder, ctx: &Ctx, e: &Entity) {
b.polyline(ctx, rgb, lw, l);
}
}
// An OLE object's content is not drawn; its frame, from its two corner points, is.
EntityKind::Unknown(u) if u.is_ole_frame() => {
if let Some(q) = cadcraft_doc::ole_frame(&u.tags) {
b.polyline(ctx, rgb, lw, &q);
}
}
EntityKind::Unknown(u) if !u.graphics.is_empty() || u.is_ole_frame() => draw_unknown(b, ctx, e, u, rgb, lw, own),
kind => {
for prim in kind.prims() {
match prim {
@@ -302,6 +297,17 @@ fn draw_mleader(b: &mut Builder, ctx: &Ctx, e: &Entity, m: &cadcraft_doc::MLeade
}
}
/// A record kept as read that draws something: a proxy its proxy graphics, and an OLE object its
/// frame, from its two corner points (its content is not drawn). `own`: the proxy's transparency
/// without its locked-layer fade, for its graphics.
fn draw_unknown(b: &mut Builder, ctx: &Ctx, e: &Entity, u: &cadcraft_doc::Unknown, rgb: Ink, lw: f32, own: u8) {
if !u.graphics.is_empty() {
proxy(b, ctx, e, u, own);
} else if let Some(q) = cadcraft_doc::ole_frame(&u.tags) {
b.polyline(ctx, rgb, lw, &q);
}
}
fn draw_image(b: &mut Builder, ctx: &Ctx, i: &cadcraft_doc::Image, rgb: Ink, lw: f32) {
let o = i.insert.xy();
let u = i.u.xy() * i.size.x;
+47 -1
View File
@@ -1299,7 +1299,8 @@ fn raster_hatch_pattern_matches_one_by_one() {
#[test]
fn ole_frame_draws_its_outline() {
let tag = |code: i32, value: &str| cadcraft_doc::RawTag { code, value: value.into() };
let frame = |tags: Vec<cadcraft_doc::RawTag>| EntityKind::Unknown(cadcraft_doc::Unknown { dxf_type: "OLE2FRAME".into(), tags });
let frame =
|tags: Vec<cadcraft_doc::RawTag>| EntityKind::Unknown(cadcraft_doc::Unknown { dxf_type: "OLE2FRAME".into(), tags, graphics: Vec::new() });
let mut d = Drawing::new_imperial();
d.add(&Space::Model, Common::default(), frame(vec![tag(10, "30"), tag(20, "-19"), tag(11, "35"), tag(21, "-22")])).unwrap();
d.add(&Space::Model, Common::default(), frame(vec![tag(10, "1"), tag(20, "2")])).unwrap();
@@ -1333,6 +1334,51 @@ fn without_linetypes_every_line_is_drawn_whole() {
assert!(drawn.prims.len() > 2 * continuous.prims.len(), "drawn with its linetype: {} primitives", drawn.prims.len());
}
/// A proxy draws its proxy graphics like block contents: layer 0 and ByBlock in the picture are
/// the proxy's own, and the proxy's layer hides all of it.
#[test]
fn proxy_graphics_draw_like_block_contents() {
let mut d = Drawing::new_imperial();
d.layers.push(cadcraft_doc::Layer { name: "Notes".into(), color: Color::Index(3), ..Default::default() });
let byblock = Common { color: Color::ByBlock, ..Default::default() };
let graphics = vec![
block_entity(7, byblock, EntityKind::Line(cadcraft_doc::Line { a: Vec3::ZERO, b: Vec3::new(10.0, 0.0, 0.0) })),
block_entity(
7,
Common { color: Color::Index(1), ..Default::default() },
EntityKind::Circle(cadcraft_doc::Circle { center: Vec3::new(15.0, 0.0, 0.0), radius: 5.0 }),
),
];
let proxy = EntityKind::Unknown(cadcraft_doc::Unknown { dxf_type: "ACAD_PROXY_ENTITY".into(), tags: Vec::new(), graphics });
d.add(&Space::Model, Common { layer: "Notes".into(), ..Default::default() }, proxy).unwrap();
let l = build(&d, &Space::Model, &Options::default());
assert_eq!(l.prims.iter().map(|p| p.color).collect::<Vec<_>>(), [Rgb(0, 255, 0), Rgb(255, 0, 0)]);
let b = d.extents(&Space::Model);
assert!((b.min.x, b.max.x, b.max.y) == (0.0, 20.0, 5.0), "{b:?}");
d.layer_mut("Notes").unwrap().frozen = true;
assert!(build(&d, &Space::Model, &Options::default()).prims.is_empty());
}
/// On a locked layer, a proxy's graphics fade like a block's contents: layer 0 in the picture takes
/// the proxy's fade, a ByBlock part on an unlocked layer only the proxy's own transparency.
#[test]
fn proxy_graphics_on_a_locked_layer_fade_like_block_contents() {
use cadcraft_doc::Transparency::{ByBlock, ByLayer, Percent};
for (own, want) in [(ByLayer, 0), (Percent(20), 20)] {
let mut d = Drawing::new_imperial();
d.layers.push(cadcraft_doc::Layer { name: "Locked".into(), locked: true, ..Default::default() });
d.layers.push(cadcraft_doc::Layer { name: "Open".into(), ..Default::default() });
let line = |x: f64| EntityKind::Line(cadcraft_doc::Line { a: Vec3::new(x, 0.0, 0.0), b: Vec3::new(x + 1.0, 0.0, 0.0) });
let graphics = vec![
block_entity(7, Common::default(), line(0.0)),
block_entity(7, Common { layer: "Open".into(), transparency: ByBlock, ..Default::default() }, line(2.0)),
];
let proxy = EntityKind::Unknown(cadcraft_doc::Unknown { dxf_type: "ACAD_PROXY_ENTITY".into(), tags: Vec::new(), graphics });
d.add(&Space::Model, Common { layer: "Locked".into(), transparency: own, ..Default::default() }, proxy).unwrap();
assert_eq!(faded(&build(&d, &Space::Model, &on_screen(with_transparency()))), vec![50.max(want), want], "{own:?}");
}
}
/// A broken table whose parts, with their repeated labels, together hold more cells than a table may
/// lay out is drawn as its outline, though the table's own cells are within the limit.
#[test]
+8 -8
View File
@@ -406,7 +406,7 @@
Grip Option خيار المقبض
Grip Rotate تدوير بالمقبض
Grip Scale تحجيم بالمقبض
Grip Stretch تمطيط بالمقبض
Grip Stretch تمديد بالمقبض
Grip size حجم المقبض
Group تجميع
Group Edit تحرير المجموعة
@@ -703,7 +703,7 @@
Plotter Manager مدير الطابعات
Plotter Manager... مدير الطابعات...
Plus/minus زائد/ناقص
Point نقطة
Point تأشير
Point Filters مرشحات النقطة
Point Style... نمط النقطة...
Polar (distance < angle) قطبي (المسافة < الزاوية)
@@ -872,15 +872,15 @@
Select object حدد كائناً
Select object to dimension حدد كائناً لتأشيره
Select object to divide حدد كائناً لتقسيمه
Select object to extend or shift-select to trim حدد كائناً لتمديده أو حدد مع Shift للتشذيب
Select object to extend or shift-select to trim حدد كائناً لتمديده أو حدد مع Shift للقص
Select object to measure حدد كائناً لقياسه
Select object to offset حدد كائناً لإزاحته
Select object to trim or shift-select to extend حدد كائناً لتشذيبه أو حدد مع Shift للتمديد
Select object to trim or shift-select to extend حدد كائناً لقصه أو حدد مع Shift للتمديد
Select objects حدد كائنات
Select objects (crossing window first corner) حدد كائنات (الزاوية الأولى لنافذة التقاطع)
Select objects first, then choose a command حدد الكائنات أولاً ثم اختر أمراً
Select objects to array. حدد كائنات لتكوين مصفوفة.
Select objects to stretch by crossing-window or crossing-polygon... حدد كائنات لتمطيطها بنافذة التقاطع أو مضلع التقاطع...
Select objects to stretch by crossing-window or crossing-polygon... حدد كائنات لتمديدها بنافذة التقاطع أو مضلع التقاطع...
Select objects: حدد كائنات:
Select one polyline (Multiple is available through the JSON form). حدد متعدد خطوط واحداً (يتوفر الوضع المتعدد عبر نموذج JSON).
Select path curve حدد منحنى المسار
@@ -1084,8 +1084,8 @@
Start, End, Radius بداية، نهاية، نصف قطر
Status الحالة
Status Bar شريط الحالة
Stretch تمطيط
Stretch Vertex تمطيط رأس
Stretch تمديد
Stretch Vertex تمديد رأس
Style: Standard النمط: Standard
Subtract طرح
Sweep كنس
@@ -1134,7 +1134,7 @@
Track orthogonally only تعقب متعامد فقط
Track using all polar angle settings تعقب باستخدام كل إعدادات الزوايا القطبية
Transparency شفافية
Trim تشذيب
Trim حدود التشذيب
True Color لون حقيقي
Turn All Layers On تشغيل كل الطبقات
Turn Off Layer إيقاف طبقة
1 # CADCraft Arabic interface catalog — original translations.
406
407
408
409
410
411
412
703
704
705
706
707
708
709
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
1084
1085
1086
1087
1088
1089
1090
1091
1134
1135
1136
1137
1138
1139
1140
+101 -101
View File
@@ -1,4 +1,4 @@
# CADCraft French interface catalog — original translations by @pechnikov2026-star; terminology review by @YannFR81.
# CADCraft French interface catalog — original translations by @pechnikov2026-star.
# License: MIT OR Apache-2.0 (the repository LICENSE-MIT and LICENSE-APACHE).
# Written from CADCraft's English strings; no proprietary translations were copied.
# UTF-8: context<TAB>English source<TAB>French translation.
@@ -160,7 +160,7 @@
Delete Supprimer
Delete Column Supprimer la colonne
Delete Constraints Supprimer les contraintes
Delete Dimension Style Supprimer le style de cote
Delete Dimension Style Supprimer le style de cotation
Delete Duplicate Objects Supprimer les objets en double
Delete Layer Supprimer le calque
Delete Layer State Supprimer l'état des calques
@@ -172,17 +172,17 @@
Description Description
Deselect All Désélectionner tout
Diameter Diamètre
Dim style Style de cote
Dim style Style de cotation
Dimension Cotation
Dimension Space Espacer les cotes
Dimension Style Override Remplacement de style de cote
Dimension Style... Style de cote...
Dimension Text Edit Modifier le texte de cote
Dimension style Style de cote
Dimension Space Espace entre cotations
Dimension Style Override Substitution de style de cotation
Dimension Style... Style de cotation...
Dimension Text Edit Modifier le texte de cotation
Dimension style Style de cotation
Dimensional Constraint Contrainte dimensionnelle
Dimensional Constraint Parameters Paramètres de contraintes dimensionnelles
Dimensional Constraints Contraintes dimensionnelles
Disassociate Dimensions Dissocier les cotes
Disassociate Dimensions Dissocier les cotations
Display name Nom d'affichage
Distance Distance
Divide Diviser
@@ -200,7 +200,7 @@
Drawing Limits Limites du dessin
Drawing Utilities Utilitaires de dessin
Drawings (DWG, DXF) Dessins (DWG, DXF)
Dynamic Dimensions Cotes dynamiques
Dynamic Dimensions Cotations dynamiques
Dynamic Input Saisie dynamique
Dynamic Input (F12) Saisie dynamique (F12)
E Est
@@ -233,9 +233,9 @@
Enter degree of spline Entrez le degré de la spline
Enter delta angle Entrez l'écart d'angle
Enter delta length Entrez l'écart de longueur
Enter dimension text Entrez le texte de cote
Enter dimension text (<> = measurement) Entrez le texte de cote (<> = mesure)
Enter dimension value or [name=expression] Entrez la valeur de cote ou [name=expression]
Enter dimension text Entrez le texte de cotation
Enter dimension text (<> = measurement) Entrez le texte de cotation (<> = mesure)
Enter dimension value or [name=expression] Entrez la valeur de cotation ou [name=expression]
Enter dimension variable name to override Entrez le nom de la variable de cotation à substituer
Enter justification type Entrez le type de justification
Enter leader text Entrez le texte du repère
@@ -254,10 +254,10 @@
Enter rectangle length Entrez la longueur du rectangle
Enter rectangle width Entrez la largeur du rectangle
Enter scale factor Entrez le facteur d'échelle
Enter text Entrez le texte
Enter text (use \P for new paragraphs) Entrez le texte (utilisez \P pour les nouveaux paragraphes)
Enter the number of segments Entrez le nombre de segments
Enter twist direction of helix Entrez le sens de vrillage de l'hélice
Enter text Entrer le texte
Enter text (use \P for new paragraphs) Entrer le texte (utilisez \P pour les nouveaux paragraphes)
Enter the number of segments Entrer le nombre de segments
Enter twist direction of helix Entrer le sens de vrillage de l'hélice
Entire drawing Tout le dessin
Equal Égalité
Erase Effacer
@@ -482,8 +482,8 @@
Object Snap Accrochage aux objets
Object Snap (F3) Accrochage aux objets (F3)
Object Snap On (F3) Activer l'accrochage aux objets (F3)
Object Snap Tracking Repérage d'accrochage aux objets
Object Snap Tracking (F11) Repérage d'accrochage aux objets (F11)
Object Snap Tracking Suivi de l'accrochage aux objets
Object Snap Tracking (F11) Suivi de l'accrochage aux objets (F11)
Object type: Type d'objet :
Off Désactivé
Offset Décalage
@@ -539,7 +539,7 @@
New STB Nouvelle STB
New style Nouveau style
Reset Panel Layout Réinitialiser la disposition des panneaux
Use for this layout Utiliser pour cette présentation
Use for this layout Utiliser pour cet espace
Display plot styles Afficher les styles de tracé
No plot style tables. Aucune table de styles de tracé.
A built-in table: editing it keeps an edited copy in the drawing. Table intégrée : sa modification conserve une copie modifiée dans le dessin.
@@ -560,9 +560,9 @@
Point Filters Filtres de points
Point Style... Style de point...
Polar Array Réseau polaire
Polar Tracking Repérage polaire
Polar Tracking (F10) Repérage polaire (F10)
Polar Tracking On (F10) Activer le repérage polaire (F10)
Polar Tracking Recherche polaire
Polar Tracking (F10) Recherche polaire (F10)
Polar Tracking On (F10) Activer la recherche polaire (F10)
Polar: {distance} < {angle}° Polaire : {distance} < {angle}°
Polygon Polygone
Polygonal Polygonal
@@ -645,77 +645,77 @@
Search for parameter Rechercher un paramètre
Second and next points: Deuxième point et points suivants :
Select Sélectionner
Select 2D polyline Sélectionnez une polyligne 2D
Select 2D polyline Sélectionner une polyligne 2D
Select All Sélectionner tout
Select Objects Sélectionner les objets
Select a 2D polyline. Sélectionnez une polyligne 2D.
Select a block reference. Sélectionnez une référence de bloc.
Select a circle or arc. Sélectionnez un cercle ou un arc.
Select a closed polyline Sélectionnez une polyligne fermée
Select a closed polyline, circle, ellipse or closed spline. Sélectionnez une polyligne fermée, un cercle, une ellipse ou une spline fermée.
Select a closed polyline. Sélectionnez une polyligne fermée.
Select a curve as the path. Sélectionnez une courbe comme trajectoire.
Select a dimension constraint type Sélectionnez un type de contrainte dimensionnelle
Select a line object Sélectionnez une ligne
Select a line object. Sélectionnez une ligne.
Select a line or an arc. Sélectionnez une ligne ou un arc.
Select a line or polyline segment Sélectionnez une ligne ou un segment de polyligne
Select a line, arc or open polyline. Sélectionnez une ligne, un arc ou une polyligne ouverte.
Select a line, arc, circle, polyline, ellipse or spline as the path. Sélectionnez une ligne, un arc, un cercle, une polyligne, une ellipse ou une spline comme trajectoire.
Select a line, circle, arc or polyline segment. Sélectionnez une ligne, un cercle, un arc ou un segment de polyligne.
Select a line. Sélectionnez une ligne.
Select a 2D polyline. Sélectionner une polyligne 2D.
Select a block reference. Sélectionner une référence de bloc.
Select a circle or arc. Sélectionner un cercle ou un arc.
Select a closed polyline Sélectionner une polyligne fermée
Select a closed polyline, circle, ellipse or closed spline. Sélectionner une polyligne fermée, un cercle, une ellipse ou une spline fermée.
Select a closed polyline. Sélectionner une polyligne fermée.
Select a curve as the path. Sélectionner une courbe comme trajectoire.
Select a dimension constraint type Sélectionner un type de contrainte dimensionnelle
Select a line object Sélectionner une ligne
Select a line object. Sélectionner une ligne.
Select a line or an arc. Sélectionner une ligne ou un arc.
Select a line or polyline segment Sélectionner une ligne ou un segment de polyligne
Select a line, arc or open polyline. Sélectionner une ligne, un arc ou une polyligne ouverte.
Select a line, arc, circle, polyline, ellipse or spline as the path. Sélectionner une ligne, un arc, un cercle, une polyligne, une ellipse ou une spline comme trajectoire.
Select a line, circle, arc or polyline segment. Sélectionner une ligne, un cercle, un arc ou un segment de polyligne.
Select a line. Sélectionner une ligne.
Add to Working Set Ajouter au jeu de travail
Edit Reference In-Place Modifier la référence sur place
Save Reference Edits Enregistrer les modifications de la référence
Working Set Jeu de travail
Xref and Block In-place Editing Édition sur place des xrefs et des blocs
Select a polyline. Sélectionnez une polyligne.
Select a text, mtext, attribute definition or dimension. Sélectionnez un texte, un texte multiligne, une définition d'attribut ou une cote.
Select an annotation object Sélectionnez un objet d'annotation
Select an arc or circle Sélectionnez un arc ou un cercle
Select an arc. Sélectionnez un arc.
Select an object Sélectionnez un objet
Select an object to change Sélectionnez un objet à modifier
Select an object to measure Sélectionnez un objet à mesurer
Select an object. Sélectionnez un objet.
Select an open curve. Sélectionnez une courbe ouverte.
Select an open line, arc, polyline, ellipse arc or spline. Sélectionnez une ligne, un arc, une polyligne, un arc elliptique ou une spline ouverts.
Select arc or circle Sélectionnez un arc ou un cercle
Select arc or polyline arc segment Sélectionnez un arc ou un segment d'arc de polyligne
Select arc style Sélectionnez un style d'arc
Select arc, circle, line Sélectionnez un arc, un cercle, une ligne
Select at least two objects to join. Sélectionnez au moins deux objets à joindre.
Select circle or arc to add center mark Sélectionnez un cercle ou un arc pour ajouter une marque de centre
Select closed objects (regions, closed polylines, circles). Sélectionnez des objets fermés (régions, polylignes fermées, cercles).
Select first line Sélectionnez la première ligne
Select first line or arc Sélectionnez la première ligne ou le premier arc
Select first object Sélectionnez le premier objet
Select first point Sélectionnez le premier point
Select nested objects to copy Sélectionnez des objets imbriqués à copier
Select object Sélectionnez un objet
Select object to dimension Sélectionnez un objet à coter
Select object to divide Sélectionnez un objet à diviser
Select object to extend or shift-select to trim Sélectionnez un objet à prolonger ou sélectionnez avec Maj pour rogner
Select object to measure Sélectionnez un objet à mesurer
Select object to offset Sélectionnez un objet à décaler
Select object to trim or shift-select to extend Sélectionnez un objet à rogner ou sélectionnez avec Maj pour prolonger
Select objects Sélectionnez les objets
Select objects (crossing window first corner) Sélectionnez les objets (premier coin de la fenêtre de capture)
Select objects to array. Sélectionnez les objets à répartir en réseau.
Select objects to stretch by crossing-window or crossing-polygon... Sélectionnez les objets à étirer par fenêtre de capture ou polygone de capture...
Select objects: Sélectionnez les objets :
Select one polyline (Multiple is available through the JSON form). Sélectionnez une polyligne (l'option Multiple est disponible via le formulaire JSON).
Select path curve Sélectionnez la courbe de trajectoire
Select point or object Sélectionnez un point ou un objet
Select polyline Sélectionnez une polyligne
Select second line Sélectionnez la deuxième ligne
Select second line or shift-select to apply corner Sélectionnez la deuxième ligne ou sélectionnez avec Maj pour former le coin
Select second object Sélectionnez le deuxième objet
Select second object or shift-select to apply corner Sélectionnez le deuxième objet ou sélectionnez avec Maj pour former le coin
Select second point Sélectionnez le deuxième point
Select spline Sélectionnez une spline
Select symmetry line Sélectionnez l'axe de symétrie
Select two points Sélectionnez deux points
Select a polyline. Sélectionner une polyligne.
Select a text, mtext, attribute definition or dimension. Sélectionner un texte, un texte multiligne, une définition d'attribut ou une cote.
Select an annotation object Sélectionner un objet d'annotation
Select an arc or circle Sélectionner un arc ou un cercle
Select an arc. Sélectionner un arc.
Select an object Sélectionner un objet
Select an object to change Sélectionner un objet à modifier
Select an object to measure Sélectionner un objet à mesurer
Select an object. Sélectionner un objet.
Select an open curve. Sélectionner une courbe ouverte.
Select an open line, arc, polyline, ellipse arc or spline. Sélectionner une ligne, un arc, une polyligne, un arc elliptique ou une spline ouverts.
Select arc or circle Sélectionner un arc ou un cercle
Select arc or polyline arc segment Sélectionner un arc ou un segment d'arc de polyligne
Select arc style Sélectionner un style d'arc
Select arc, circle, line Sélectionner un arc, un cercle, une ligne
Select at least two objects to join. Sélectionner au moins deux objets à joindre.
Select circle or arc to add center mark Sélectionner un cercle ou un arc pour ajouter une marque de centre
Select closed objects (regions, closed polylines, circles). Sélectionner des objets fermés (régions, polylignes fermées, cercles).
Select first line Sélectionner la première ligne
Select first line or arc Sélectionner la première ligne ou le premier arc
Select first object Sélectionner le premier objet
Select first point Sélectionner le premier point
Select nested objects to copy Sélectionner des objets imbriqués à copier
Select object Sélectionner un objet
Select object to dimension Sélectionner un objet à coter
Select object to divide Sélectionner un objet à diviser
Select object to extend or shift-select to trim Sélectionner un objet à prolonger ou sélectionner avec Maj pour rogner
Select object to measure Sélectionner un objet à mesurer
Select object to offset Sélectionner un objet à décaler
Select object to trim or shift-select to extend Sélectionner un objet à rogner ou sélectionner avec Maj pour prolonger
Select objects Sélectionner les objets
Select objects (crossing window first corner) Sélectionner les objets (premier coin de la fenêtre de capture)
Select objects to array. Sélectionner les objets à répartir en réseau.
Select objects to stretch by crossing-window or crossing-polygon... Sélectionner les objets à étirer par fenêtre de capture ou polygone de capture...
Select objects: Sélectionner les objets :
Select one polyline (Multiple is available through the JSON form). Sélectionner une polyligne (l'option Multiple est disponible via le formulaire JSON).
Select path curve Sélectionner la courbe de trajectoire
Select point or object Sélectionner un point ou un objet
Select polyline Sélectionner une polyligne
Select second line Sélectionner la deuxième ligne
Select second line or shift-select to apply corner Sélectionner la deuxième ligne ou sélectionner avec Maj pour former le coin
Select second object Sélectionner le deuxième objet
Select second object or shift-select to apply corner Sélectionner le deuxième objet ou sélectionner avec Maj pour former le coin
Select second point Sélectionner le deuxième point
Select spline Sélectionner une spline
Select symmetry line Sélectionner l'axe de symétrie
Select two points Sélectionner deux points
Selection Cycling Cycle de sélection
Send to Back Envoyer à l'arrière-plan
Set Current Définir comme courant
@@ -747,18 +747,18 @@
Snap and Grid Accrochage et grille
Solid Solide
Sort Trier
Specify a point Spécifiez un point
Specify a scale for the hatch pattern Spécifiez une échelle pour le motif de hachures
Specify a second extension line origin Spécifiez l'origine de la deuxième ligne d'attache
Specify an angle for the hatch pattern Spécifiez un angle pour le motif de hachures
Specify angle end point Spécifiez le point final de l'angle
Specify angle of dimension line Spécifiez l'angle de la ligne de cote
Specify angle of dimension text Spécifiez l'angle du texte de cote
Specify angle start point Spécifiez le point de départ de l'angle
Specify angle vertex Spécifiez le sommet de l'angle
Specify angle vertex point Spécifiez le point du sommet de l'angle
Specify arc length dimension location Spécifiez l'emplacement de la cote de longueur d'arc
Specify axis endpoint of ellipse Spécifiez l'extrémité de l'axe de l'ellipse
Specify a point Spécifier un point
Specify a scale for the hatch pattern Spécifier une échelle pour le motif de hachures
Specify a second extension line origin Spécifier l'origine de la deuxième ligne d'attache
Specify an angle for the hatch pattern Spécifier un angle pour le motif de hachures
Specify angle end point Spécifier le point final de l'angle
Specify angle of dimension line Spécifier l'angle de la ligne de cote
Specify angle of dimension text Spécifier l'angle du texte de cote
Specify angle start point Spécifier le point de départ de l'angle
Specify angle vertex Spécifier le sommet de l'angle
Specify angle vertex point Spécifier le point du sommet de l'angle
Specify arc length dimension location Spécifier l'emplacement de la cote de longueur d'arc
Specify axis endpoint of ellipse Spécifier l'extrémité de l'axe de l'ellipse
Specify base diameter Spécifiez le diamètre de la base
Specify base point Spécifiez le point de base
Specify base point or displacement (drag with the middle mouse button for realtime pan) Spécifiez le point de base ou le déplacement (faites glisser avec le bouton central de la souris pour un panoramique en temps réel)
@@ -768,7 +768,7 @@
Specify center of polygon Spécifiez le centre du polygone
Specify center point for circle Spécifiez le point central du cercle
Specify center point of arc Spécifiez le point central de l'arc
Specify center point of array Spécifiez le point central du réseau
Specify center point of array Spécifiez le point central de la matrice
Specify center point of base Spécifiez le point central de la base
Specify corner of viewport Spécifiez le coin de la fenêtre
Specify corner of window, enter a scale factor (nX or nXP) Spécifiez le coin de la fenêtre, entrez un facteur d'échelle (nX ou nXP)
@@ -894,7 +894,7 @@
Sweep Balayage
Switch Drawing Changer de dessin
Switch Layout Changer de présentation
Switch between model space in a viewport and paper space Basculer entre l'espace objet dans une fenêtre et l'espace papier
Switch between model space in a viewport and paper space Basculer entre l'espace modèle dans une fenêtre et l'espace papier
Symmetric Symétrie
Synchronize Attributes Synchroniser les attributs
Toggle PICKADD (off: each pick replaces the selection) Basculer PICKADD (désactivé : chaque sélection remplace la sélection existante)
1 # CADCraft French interface catalog — original translations by @pechnikov2026-star; terminology review by @YannFR81. # CADCraft French interface catalog — original translations by @pechnikov2026-star.
2 # License: MIT OR Apache-2.0 (the repository LICENSE-MIT and LICENSE-APACHE).
3 # Written from CADCraft's English strings; no proprietary translations were copied.
4 # UTF-8: context<TAB>English source<TAB>French translation.
160
161
162
163
164
165
166
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
200
201
202
203
204
205
206
233
234
235
236
237
238
239
240
241
254
255
256
257
258
259
260
261
262
263
482
483
484
485
486
487
488
489
539
540
541
542
543
544
545
560
561
562
563
564
565
566
567
568
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
768
769
770
771
772
773
774
894
895
896
897
898
899
900
+4 -59
View File
@@ -340,7 +340,7 @@
Exclude from new selection set ახალი მონიშნულიდან გამორიცხვა
Explode დაშლა
Explode Attributes to Text ატრიბუტების ტექსტად დაშლა
Export ექსპორტირება
Export ექსპორტი
Export Table ცხრილის ექსპორტი
Export to PDF... PDF-ად ექსპორტი...
Express Tools Express Tools
@@ -707,8 +707,8 @@
Previous Change წინა ცვლილება
Previous Layer წინა შრე
Primitives პრიმიტივები
Print ბეჭდვა
Print... ბეჭდვა...
Print დაბეჭდვა
Print... დაბეჭდვა...
Properties თვისებები
Properties Inspector თვისებების ინსპექტორი
Properties: თვისებები:
@@ -1242,7 +1242,7 @@
Animation effects ანიმაციის ეფექტები
Interface scale ინტერფეისის მასშტაბი
Import... იმპორტი...
Export... ექსპორტირება...
Export... ექსპორტი...
Batch Publish... პაკეტური გამოქვეყნება...
Scale List... მასშტაბების სია...
Annotative Object Scale ანოტაციური ობიექტის მასშტაბი
@@ -1472,26 +1472,6 @@ menu View ხედი
Text to find მოსაძებნი ტექსტი
Whole words მთლიანი სიტყვები
Nothing found ვერაფერი მოიძებნა
Multiple Insert მრავალჯერადი ჩასმა
Ctrl+Enter to apply გამოსაყენებლად: Ctrl+Enter
Edit Text ტექსტის რედაქტირება
The drawing changed. Close the window and open it again. ნახაზი შეიცვალა. დახურეთ ფანჯარა და ხელახლა გახსენით.
DView დინამიკური ხედი
Raster Image Reference... რასტრული გამოსახულების მიმართვა...
Raster Images რასტრული გამოსახულებები
Clip Xref გარე მიმართვის მოჭრა
Xref გარე მიმართვა
Xref Clip Frame გარე მიმართვის მოჭრის ჩარჩო
Backup copies are off, so the current file will be replaced. სარეზერვო ასლები გამორთულია, ამიტომ მიმდინარე ფაილი ჩანაცვლდება.
DXF 2010 and earlier keep them. Use Save As to keep them in the drawing. DXF 2010 და უფრო ძველი ვერსიები მათ ინახავს. ნახაზში მათ შესანარჩუნებლად გამოიყენეთ „შენახვა როგორც“.
DXF keeps them. Use Save As to keep them in the drawing. DXF მათ ინახავს. ნახაზში მათ შესანარჩუნებლად გამოიყენეთ „შენახვა როგორც“.
Save Anyway მაინც შენახვა
Save cancelled: {path} was not changed. შენახვა გაუქმდა: {path} არ შეცვლილა.
Saving {name} will remove content ფაილში {name} შენახვისას შიგთავსის ნაწილი წაიშლება
The current file doesn't look whole, so {name} stays as it is and the current file will be replaced. მიმდინარე ფაილი არასრული ჩანს, ამიტომ {name} უცვლელი რჩება, მიმდინარე ფაილი კი ჩანაცვლდება.
The current file is kept as {name} until the next save. მიმდინარე ფაილი შემდეგ შენახვამდე შენარჩუნდება სახელით {name}.
This format can't keep these objects yet: {objects}. ეს ფორმატი ამ ობიექტებს ჯერ ვერ ინახავს: {objects}.
{count} more types კიდევ {count} ტიპი
Add a drawing file as a block library ნახაზის ფაილის დამატება ბლოკების ბიბლიოთეკად
Add a folder of drawings or a drawing file to use its blocks. დაამატეთ ნახაზების საქაღალდე ან ნახაზის ფაილი მისი ბლოკების გამოსაყენებლად.
Block Libraries ბლოკების ბიბლიოთეკები
@@ -1522,38 +1502,3 @@ menu View ხედი
# ArtCraft feature naming
Additional Tools დამატებითი ხელსაწყოები
# Keyboard Shortcuts, Right-Click Customization, alias import
Keyboard Shortcuts... კლავიატურის მალსახმობები...
Keyboard Shortcuts კლავიატურის მალსახმობები
Replaces the shortcut of {commands} ჩაანაცვლებს ამ ბრძანებების მალსახმობს: {commands}
Needs Ctrl, Alt or a function key საჭიროა Ctrl, Alt ან ფუნქციური კლავიში
Press the keys დააჭირეთ კლავიშებს
Back to CADCraft's shortcut CADCraft-ის მალსახმობზე დაბრუნება
A shortcut you give wins over CADCraft's own. Changes apply at once and are kept for next time. თქვენ მიერ მინიჭებულ მალსახმობს უპირატესობა აქვს CADCraft-ის საკუთარზე. ცვლილებები მაშინვე მოქმედებს და შემდეგი ჯერისთვისაც ინახება.
Turned off, a right-click while a command runs does what Right-Click Customization sets for Command mode. გამორთვისას ბრძანების შესრულების დროს მარჯვენა დაწკაპება იმას აკეთებს, რაც „მარჯვენა დაწკაპების მორგებაში“ ბრძანების რეჟიმისთვის არის არჩეული.
Right-Click Customization... მარჯვენა დაწკაპების მორგება...
Right-Click Customization მარჯვენა დაწკაპების მორგება
Turn on time-sensitive right-click დროზე დამოკიდებული მარჯვენა დაწკაპების ჩართვა
Longer click duration: გრძელი დაწკაპების ხანგრძლივობა:
milliseconds მილიწამი
While a command runs, a quick click is Enter and a longer click opens the shortcut menu. ბრძანების შესრულების დროს მოკლე დაწკაპება Enter-ია, გრძელი დაწკაპება კი კონტექსტურ მენიუს ხსნის.
Default Mode ნაგულისხმევი რეჟიმი
No objects selected and no command running: არაფერია მონიშნული და არცერთი ბრძანება არ სრულდება:
Edit Mode რედაქტირების რეჟიმი
Objects selected and no command running: ობიექტები მონიშნულია და არცერთი ბრძანება არ სრულდება:
Repeat last command ბოლო ბრძანების გამეორება
Shortcut Menu კონტექსტური მენიუ
Command Mode ბრძანების რეჟიმი
While a command runs: ბრძანების შესრულების დროს:
ENTER ENTER
Shortcut Menu: always enabled კონტექსტური მენიუ: ყოველთვის ჩართული
Shortcut Menu: enabled when command options are present კონტექსტური მენიუ: ჩართული, როცა ბრძანებას ვარიანტები აქვს
Import: there is no file dialog here; run ALIASEDIT with the file's contents using its text parameter. იმპორტი: აქ ფაილის არჩევის დიალოგი არ არის; გაუშვით ALIASEDIT და ფაილის შიგთავსი გადაეცით მის text პარამეტრს.
Aliases are saved in your CADCraft profile and survive restarts. ფსევდონიმები თქვენს CADCraft-ის პროფილში ინახება და გადატვირთვის შემდეგაც რჩება.
Import… იმპორტი…
Run ALIASEDIT with the file's contents using its text parameter. გაუშვით ALIASEDIT და ფაილის შიგთავსი გადაეცით მის text პარამეტრს.
Importing a file replaces your {n} aliases, and any changes not applied yet. ფაილის იმპორტი ჩაანაცვლებს თქვენს ფსევდონიმებს ({n}) და ჯერ გამოუყენებელ ცვლილებებს.
Import and replace იმპორტი და ჩანაცვლება
Keep my aliases ჩემი ფსევდონიმების შენარჩუნება
{n} more warnings; see the command line. კიდევ {n} გაფრთხილება; იხილეთ ბრძანების სტრიქონი.
Can't render this file because it contains an unexpected character in line 10 and column 14.
-705
View File
@@ -1511,711 +1511,6 @@ menu Modify Ändra
Ctrl+Enter to apply Ctrl+Enter to apply
Edit Text Edit Text
The drawing changed. Close the window and open it again. Ritningen har ändrats. Stäng fönstret och öppna det igen.
DView DView
Keyboard Shortcuts... Kortkommandon...
Multiple Insert Infoga flera
Raster Image Reference... Rasterbildsreferens...
Raster Images Rasterbilder
Clip Xref Beskär xref
Xref Xref
Xref Clip Frame Beskärningsram för xref
A shortcut you give wins over CADCraft's own. Changes apply at once and are kept for next time. Ett kortkommando du anger går före CADCrafts eget. Ändringar gäller direkt och sparas till nästa gång.
Alias files (PGP) Aliasfiler (PGP)
Aliases are saved in your CADCraft profile and survive restarts. Alias sparas i din CADCraft-profil och finns kvar efter omstart.
Back to CADCraft's shortcut Tillbaka till CADCrafts kortkommando
Command Mode Kommandoläge
Default Mode Standardläge
Edit Mode Redigeringsläge
ENTER ENTER
Import and replace Importera och ersätt
Import: there is no file dialog here; run ALIASEDIT with the file's contents using its text parameter. Importera: det finns ingen fildialogruta här; kör ALIASEDIT med filens innehåll i dess textparameter.
Importing a file replaces your {n} aliases, and any changes not applied yet. Om du importerar en fil ersätts dina {n} alias och alla ändringar du inte har använt än.
Import… Importera…
Keep my aliases Behåll mina alias
Keyboard Shortcuts Kortkommandon
Longer click duration: Längd för längre klick:
milliseconds millisekunder
Needs Ctrl, Alt or a function key Kräver Ctrl, Alt eller en funktionstangent
No objects selected and no command running: Inga objekt markerade och inget kommando körs:
Objects selected and no command running: Objekt markerade och inget kommando körs:
Press the keys Tryck på tangenterna
Repeat last command Upprepa senaste kommandot
Replaces the shortcut of {commands} Ersätter kortkommandot för {commands}
Right-Click Customization Anpassning av högerklick
Right-Click Customization... Anpassning av högerklick...
Run ALIASEDIT with the file's contents using its text parameter. Kör ALIASEDIT med filens innehåll i dess textparameter.
Shortcut Menu Snabbmeny
Shortcut Menu: always enabled Snabbmeny: alltid aktiverad
Shortcut Menu: enabled when command options are present Snabbmeny: aktiverad när det finns kommandoalternativ
Turn on time-sensitive right-click Slå på tidskänsligt högerklick
Turned off, a right-click while a command runs does what Right-Click Customization sets for Command mode. När det är avstängt gör ett högerklick under ett pågående kommando det som Anpassning av högerklick anger för kommandoläget.
While a command runs, a quick click is Enter and a longer click opens the shortcut menu. Medan ett kommando körs är ett snabbt klick Enter och ett längre klick öppnar snabbmenyn.
While a command runs: Medan ett kommando körs:
{n} more warnings; see the command line. {n} varningar till; se kommandoraden.
# ArtCraft feature naming
Additional Tools Ytterligare verktyg
Grid Rutnät
Ortho Orto
Workspace Arbetslayout
Settings Inställningar
Preferences Inställningar
Current: Aktuell:
Continuous Kontinuerlig
Displayed layers Visade lager
Black Svart
Gray Grå
Grey Grå
Orange Orange
Purple Lila
Brown Brun
Pink Rosa
Rename Byt namn
Select Color Välj färg
Layer filters Lagerfilter
Dashed Streckad
Dotted Prickad
Dashdot Streckprickad
Hidden Dold
Phantom Fantom
Clear selection Rensa markering
Model Space Modellrymd
Plot Settings Plottinställningar
Perimeter Omkrets
Polar Polär
Lineweight Display Visning av linjetjocklek
Annotation Anteckning
Annotative Annotativ
Insertion point Insättningspunkt
Base point Baspunkt
Scale factor Skalfaktor
Rotation angle Rotationsvinkel
X coordinate X-koordinat
Y coordinate Y-koordinat
Z coordinate Z-koordinat
Cancel operation Avbryt åtgärden
Reset Återställ
Update Fields Uppdatera fält
Edit Xref in Place Redigera xref på plats
New UCS Nytt UCS
World Världen
Face Yta
Origin Origo
LwPolyline LwPolyline
New Sheet Set... Ny ritningsuppsättning...
Open Sheet Set... Öppna ritningsuppsättning...
Clear Menu Rensa meny
Attach... Koppla...
Export Layout to Model... Exportera layout till modell...
Package Drawing... Paketera ritning...
DWG Compare... DWG-jämförelse...
Markup Import... Importera kommentarer...
Share... Dela...
Undo Group of commands Ångra kommandogrupp
Constrained Orbit Begränsad kretsning
Free Orbit Fri kretsning
Camera Kamera
Adjust Distance Justera avstånd
Swivel Svängning
3D Views 3D-vyer
Viewpoint Vypunkt
Plan View Planvy
Current UCS Aktuellt UCS
World UCS Världs-UCS
Named UCS Namngivna UCS
Bottom Nederkant
Front Framifrån
Back Tillbaka
SW Isometric SV-isometrisk
SE Isometric Isometrisk SO
NE Isometric Isometrisk NO
NW Isometric Isometrisk NV
Hide Dölj
Visual Styles Visuella stilar
2D Wireframe 2D-trådram
Wireframe Trådram
Realistic Realistisk
Conceptual Konceptuell
Shaded Skuggad
Shaded with Edges Skuggad med kanter
Shades of Gray Gråtoner
Sketchy Skissartad
X-Ray Genomskinlig
Render Rendera
New Point Light Nytt punktljus
New Spotlight Ny strålkastare
New Distant Light Nytt avlägset ljus
Light Glyphs Ljusglyfer
Materials Browser Materialbläddrare
Enter Full Screen Visa i helskärm
PDF Underlay... PDF-underlägg...
Field... Fält...
Layout from Template... Layout från mall...
ACIS File... ACIS-fil...
Drawing Exchange Binary... Drawing Exchange Binary...
Spelling Stavning
Linetype Manager Linjetypshanterare
Color Selector Färgväljare
Object Properties Objektegenskaper
Width Bredd
Position Position
Object Snap Settings Inställningar för objektfäste
Polar Tracking Settings Inställningar för polär spårning
Explode Block Lös upp block
Block Name Blocknamn
Coordinate Koordinat
Coordinates Koordinater
Properties Palette Egenskapspalett
Save Changes Spara ändringar
Discard Changes Ignorera ändringar
Are you sure? Är du säker?
Create Skapa
Fit Anpassa
Specify center point Ange centrumpunkt
Align block with object? Justera blocket mot objektet?
Guide crosshairs along cloud path Led hårkorset längs molnets bana
Erase polyline? Radera polylinje?
Calculate rectangle dimensions based on Beräkna rektangelns mått utifrån
Erase source objects? Radera källobjekt?
Object selected is not a polyline. Do you want to turn it into one? Det markerade objektet är inte en polylinje. Vill du göra om det till en?
Scale objects based on alignment points? Skala objekt utifrån justeringspunkter?
Specify radius Ange radie
Specify diameter Ange diameter
Specify opposite corner point Ange motsatt hörnpunkt
Pick internal point Välj inre punkt
{n} commit {n} commit
{n} contributor {n} bidragsgivare
(1, 2, 4, 8, 16, 32, 64, 128, or 256) (1, 2, 4, 8, 16, 32, 64, 128 eller 256)
<Offset> <Förskjutning>
>> Expression >> Uttryck
Associate the hatch with the new boundary? Associera skrafferingen med den nya gränsen?
Associative dimension priority Prioritet för associativa mått
Breakline extension distance Förlängningsavstånd för brytlinje
Breakline symbol size Symbolstorlek för brytlinje
Choose mode for selected object conversion Välj läge för konvertering av markerade objekt
Combine collinear objects that meet end to end Kombinera kolinjära objekt som möts ände mot ände
Combine collinear objects that partially overlap Kombinera kolinjära objekt som delvis överlappar
Combine identical rows? Kombinera identiska rader?
Combine layer property changes into one undo step? Kombinera ändringar av lageregenskaper till ett ångringssteg?
Combine text into a single MTEXT? Kombinera text till en enda MTEXT?
Combine zooms and pans into one undo step? Kombinera zoomningar och panoreringar till ett ångringssteg?
Constant? Konstant?
Convert Lines and Arcs to polylines Konvertera linjer och bågar till polylinjer
Create associative array Skapa associativ array
Delete old boundary(s)? Ta bort gamla gräns(er)?
Drafting mode? Ritläge?
Edit attributes one at a time? Redigera attributen ett i taget?
Edit only attributes visible on screen? Redigera endast attribut som syns på skärmen?
Edit path for which xref(s) Redigera sökväg för vilka xref:ar
Enter Trim mode option Ange alternativ för trimningsläge
Enter UNDO Auto mode Ange UNDO Auto-läge
Enter X scale factor, specify opposite corner Ange X-skalfaktor, ange motsatt hörn
Enter a boundary loop number to remove (starting at 1) Ange numret på gränsloopen som ska tas bort (börjar på 1)
Enter a configuration option Ange ett konfigurationsalternativ
Enter a default viewport visibility option Ange ett alternativ för standardsynlighet i vyfönster
Enter a group description Ange en gruppbeskrivning
Enter a group name Ange ett gruppnamn
Enter a group option Ange ett gruppalternativ
Enter a hatch option Ange ett skrafferingsalternativ
Enter a loaded linetype name Ange namnet på en inläst linjetyp
Enter a name for the new plotter Ange ett namn på den nya plottern
Enter a new name for the group Ange ett nytt namn på gruppen
Enter a plotter option Ange ett plotteralternativ
Enter a plotting preference Ange en plottningsinställning
Enter a projection option Ange ett projektionsalternativ
Enter a property to turn on or off Ange en egenskap att slå på eller av
Enter a scale factor (nX or nXP) Ange en skalfaktor (nX eller nXP)
Enter a text edit mode option Ange ett alternativ för textredigeringsläge
Enter an UNDO control option Ange ett alternativ för UNDO-kontroll
Enter an annotation option Ange ett anteckningsalternativ
Enter an implied edge extension mode Ange ett läge för underförstådd kantförlängning
Enter an option [Add/Remove] <Add> Ange ett alternativ [Add/Remove] <Add>
Enter an option to change Ange ett alternativ att ändra
Enter array type Ange arraytyp
Enter attribute tag Ange attributtagg
Enter attribute tag specification Ange specifikation för attributtagg
Enter attribute value specification Ange specifikation för attributvärde
Enter attribute visibility setting Ange inställning för attributsynlighet
Enter block name or select a block reference Ange blocknamn eller markera en blockreferens
Enter block name or select a block reference [?] Ange blocknamn eller markera en blockreferens [?]
Enter block name specification Ange specifikation för blocknamn
Enter block(s) to list Ange block att lista
Enter choice, 1 to 5 Ange val, 1 till 5
Enter clipping option Ange klippningsalternativ
Enter color name or number (1-255) Ange färgnamn eller -nummer (1-255)
Enter column type Ange kolumntyp
Enter decimal places of accuracy (0 to 16) Ange noggrannhet i antal decimaler (0 till 16)
Enter distance between rows or specify unit cell (---) Ange avstånd mellan rader eller ange enhetscell (---)
Enter file name Ange filnamn
Enter first angle constraint Ange första vinkelvillkor
Enter first line of annotation text or Ange första raden av kommentarstexten eller
Enter first tolerance value Ange första toleransvärde
Enter fit tolerance Ange anpassningstolerans
Enter fuzz distance Ange fuzz-avstånd
Enter group description Ange gruppbeskrivning
Enter group name Ange gruppnamn
Enter group name(s) to list Ange gruppnamn att lista
Enter inspection rate Ange granskningshastighet
Enter inspection shape Ange granskningsform
Enter justification Ange justering
Enter knot parameterization Ange knutparametrisering
Enter label (press ENTER for none) Ange etikett (tryck på ENTER för ingen)
Enter layer description Ange lagerbeskrivning
Enter layer name Ange lagernamn
Enter layer name to make current Ange namnet på lagret som ska bli aktuellt
Enter layer name(s) to change default viewport visibility Ange lagernamn för att ändra standardsynlighet i vyfönster
Enter layer name(s) to list Ange lagernamn att lista
Enter layer option for offset objects Ange lageralternativ för förskjutna objekt
Enter layout name for copy Ange layoutnamn för kopian
Enter layout name(s) to list Ange layoutnamn att lista
Enter layout option Ange layoutalternativ
Enter layout to make current Ange layout som ska bli aktuell
Enter layout to rename Ange layout att byta namn på
Enter layout to save to template Ange layout att spara som mall
Enter leader format option Ange formatalternativ för hänvisningslinje
Enter line spacing factor or distance Ange radavståndsfaktor eller avstånd
Enter line spacing type Ange typ av radavstånd
Enter linetype(s) to load Ange linjetyp(er) att läsa in
Enter lineweight (0.0mm - 2.11mm) Ange linjetjocklek (0,0 mm - 2,11 mm)
Enter magnification or height Ange förstoring eller höjd
Enter maximum part height Ange maximal delhöjd
Enter mline editing option Ange redigeringsalternativ för multilinje
Enter mline style name or [?] Ange namn på multilinjestil eller [?]
Enter name for new layer (becomes the current layer) Ange namn på nytt lager (blir aktuellt lager)
Enter name for new scale Ange namn på ny skala
Enter name for new viewport configuration Ange namn på ny vyfönsterkonfiguration
Enter name list for new layer(s) Ange namnlista för nya lager
Enter name of block to manage Ange namn på block att hantera
Enter name of block to sync Ange namn på block att synkronisera
Enter name of breakline symbol block (. for the built-in symbol) Ange namn på block för brytlinjesymbol (. för den inbyggda symbolen)
Enter name of drawing file to recover Ange namn på ritningsfil att återställa
Enter name of existing block Ange namn på befintligt block
Enter name of layout to copy Ange namn på layout att kopiera
Enter name of layout to delete Ange namn på layout att ta bort
Enter name of linetype file Ange namn på linjetypsfil
Enter name of new layout Ange namn på ny layout
Enter name of output file Ange namn på utdatafil
Enter name of scale to delete Ange namn på skala att ta bort
Enter name of script file Ange namn på skriptfil
Enter name of viewport configuration to restore Ange namn på vyfönsterkonfiguration att återställa
Enter name(s) of new layers frozen in all viewports Ange namn på nya lager som är frusna i alla vyfönster
Enter name(s) of viewport configurations to delete Ange namn på vyfönsterkonfigurationer att ta bort
Enter name(s) of viewport configurations to list Ange namn på vyfönsterkonfigurationer att lista
Enter name(s) to purge Ange namn att rensa
Enter named scale to add Ange namngiven skala att lägga till
Enter named scale to delete Ange namngiven skala att ta bort
Enter new color Ange ny färg
Enter new default value Ange nytt standardvärde
Enter new group name Ange nytt gruppnamn
Enter new layer name Ange nytt lagernamn
Enter new layout name Ange nytt layoutnamn
Enter new linetype name Ange nytt linjetypsnamn
Enter new linetype scale factor Ange ny linjetypsskalfaktor
Enter new lineweight Ange ny linjetjocklek
Enter new order Ange ny ordning
Enter new prompt Ange ny ledtext
Enter new string Ange ny sträng
Enter new tag Ange ny tagg
Enter new text style Ange ny textstil
Enter new value for CONSTRAINTINFER Ange nytt värde för CONSTRAINTINFER
Enter new value for PICKSTYLE Ange nytt värde för PICKSTYLE
Enter new value for THICKNESS Ange nytt värde för THICKNESS
Enter new value for XCLIPFRAME Ange nytt värde för XCLIPFRAME
Enter next line of annotation text Ange nästa rad med kommentarstext
Enter next line of text (empty line to finish) Ange nästa textrad (tom rad för att slutföra)
Enter number of actions Ange antal åtgärder
Enter number of columns (|||) Ange antal kolumner (|||)
Enter number of digits to right of decimal point (0 to 8) Ange antal siffror till höger om decimaltecknet (0 till 8)
Enter number of fractional places for display of angles (0 to 8) Ange antal decimaler för visning av vinklar (0 till 8)
Enter number of items in array Ange antal objekt i arrayen
Enter number of rows (---) Ange antal rader (---)
Enter object ordering option Ange alternativ för objektordning
Enter object type to rename Ange objekttyp att byta namn på
Enter obliquing angle (press ENTER for none) Ange lutningsvinkel (tryck på ENTER för ingen)
Enter old group name Ange gammalt gruppnamn
Enter old layer name Ange gammalt lagernamn
Enter option Ange alternativ
Enter option [Save/Discard reference changes] <Save> Ange alternativ [Spara/Släng referensändringar] <Spara>
Enter properties to match (SELECTSIMILARMODE bit code) Ange egenskaper att matcha (bitkod för SELECTSIMILARMODE)
Enter property to change Ange egenskap att ändra
Enter scale ratio (paper units:drawing units) Ange skalkvot (pappersenheter:ritningsenheter)
Enter second angle constraint Ange andra vinkelvillkoret
Enter second tolerance value Ange andra toleransvärdet
Enter spline creation method Ange metod för att skapa spline
Enter string to change Ange sträng att ändra
Enter style name Ange stilnamn
Enter symbol type to bind Ange symboltyp att bädda in
Enter target layer name Ange namn på mållager
Enter template file name Ange namn på mallfil
Enter the distance between rows or specify unit cell (---) Ange avståndet mellan rader eller ange enhetscell (---)
Enter the drawing to compare with (an open drawing's name or a file path) Ange ritningen att jämföra med (namnet på en öppen ritning eller en sökväg)
Enter the maximum points for leader line Ange största antal punkter för hänvisningslinjen
Enter the name of the block to replace Ange namnet på blocket som ska ersättas
Enter the number of columns (|||) Ange antal kolumner (|||)
Enter the number of items in the array Ange antal objekt i arrayen
Enter the number of levels Ange antal nivåer
Enter the number of operations to undo Ange antal åtgärder att ångra
Enter the number of rows Ange antal rader
Enter the number of rows (---) Ange antal rader (---)
Enter the output Ange utdata
Enter the paper name Ange pappersnamnet
Enter the paper width,height in mm Ange pappersbredd,höjd i mm
Enter the plotter to add a paper size to Ange plottern som en pappersstorlek ska läggas till för
Enter the plotter to delete Ange plottern att ta bort
Enter the type of array Ange typ av array
Enter tolerance location Ange toleransens placering
Enter transparency value Ange genomskinlighetsvärde
Enter transparency value (0-90) Ange genomskinlighetsvärde (0-90)
Enter trim method Ange trimningsmetod
Enter type of dimension editing Ange typ av måttredigering
Enter type of unused objects to purge Ange typ av oanvända objekt att rensa
Enter type of value modification Ange typ av värdeändring
Enter value Ange värde
Enter variable name Ange variabelnamn
Enter view name to restore Ange namn på vy att återställa
Enter view name to save Ange namn på vy att spara
Enter view name(s) to delete Ange namn på vyer att ta bort
Enter view name(s) to list Ange namn på vyer att lista
Enter viewport arrangement Ange vyfönsterarrangemang
Enter viewport configuration name Ange namn på vyfönsterkonfiguration
Enter what to pick Ange vad som ska väljas
Enter xref(s) to list Ange xref att lista
Erase source object after offsetting? Radera källobjektet efter förskjutning?
First point of mid Första punkt för mittpunkt
First tracking point Första spårningspunkt
Fix any errors detected? Åtgärda upptäckta fel?
Get from the drawing or [Point/Distance/Angle/Intersection] Hämta från ritningen eller [Punkt/Avstånd/Vinkel/Skärningspunkt]
Indicate dimension point to add Ange måttpunkt att lägga till
Indicate dimension point to remove Ange måttpunkt att ta bort
Internal error; press Enter to end the command Internt fel; tryck på Enter för att avsluta kommandot
Invisible? Osynlig?
Island detection style Stil för identifiering av öar
Keep associative objects Behåll associativa objekt
Lock the view of viewports? Lås vyn i vyfönster?
Measure angles clockwise? Mäta vinklar medurs?
New color Ny färg
Next point (Press ENTER to end tracking) Nästa punkt (tryck på ENTER för att avsluta spårning)
No mark: undo everything? Inget märke: ångra allt?
Number of objects to move Antal objekt att flytta
Optimize segments within polylines Optimera segment i polylinjer
Pick a table cell Välj en tabellcell
Pick an internal point for the new boundary Välj en inre punkt för den nya gränsen
Red, Green, Blue Röd, grön, blå
Red,Green,Blue Röd,grön,blå
Reset the scale list to the defaults? Återställ skallistan till standardvärdena?
Rotate arrayed items? Rotera objekten i arrayen?
Rotate arrayed objects? Rotera arrayobjekten?
Save changes to array? Spara ändringar i arrayen?
Save layer settings with views? Spara lagerinställningar med vyer?
Second point of mid Andra punkt för mittpunkt
Select a block Markera ett block
Select a content type Välj en innehållstyp
Select a leader type Välj en typ av hänvisningslinje
Select a multileader Markera en multihänvisningslinje
Select a table Markera en tabell
Select a viewport Markera ett vyfönster
Select an item in array to replace Markera ett objekt i arrayen som ska ersättas
Select an object to copy Markera ett objekt att kopiera
Select array Markera array
Select attributes Markera attribut
Select base dimension Markera basmått
Select base point of replacement objects Markera baspunkt för ersättningsobjekten
Select boundary objects (Enter finds them) Markera gränsobjekt (Enter hittar dem)
Select clipping object Markera beskärningsobjekt
Select closed boundary objects to add Markera slutna gränsobjekt att lägga till
Select destination object(s) Markera målobjekt
Select dimension Markera mått
Select dimension to add jog Markera mått att lägga till knäck på
Select dimension to add/remove break Markera mått för att lägga till/ta bort brytning
Select dimensions to space Markera mått att fördela
Select grip to edit array Markera grepp för att redigera arrayen
Select group Markera grupp
Select hatch object Markera skrafferingsobjekt
Select item in array Markera objekt i arrayen
Select jog to remove Markera knäck att ta bort
Select mline Markera multilinje
Select multileader to align to or [Options] Markera multihänvisningslinje att justera mot eller [Alternativ]
Select new datum point Markera ny referenspunkt
Select object on target layer Markera objekt på mållagret
Select object to break dimension Markera objekt som ska bryta måttet
Select object to clip viewport Markera objekt att beskära vyfönstret med
Select object to count or [List/Spaces] Markera objekt att räkna eller [Lista/Blanksteg]
Select objects to add to the group Markera objekt att lägga till i gruppen
Select objects to erase or Markera objekt att radera eller
Select objects to remove from the group Markera objekt att ta bort från gruppen
Select reference objects Markera referensobjekt
Select replacement objects Markera ersättningsobjekt
Select source object Markera källobjekt
Select viewport to clip Markera vyfönster att beskära
Select viewports Markera vyfönster
Sort text top-down? Sortera text uppifrån och ned?
Specify Z scale factor or Ange skalfaktor för Z eller
Specify a fit tolerance Ange en anpassningstolerans
Specify a point on the spline <exit> Ange en punkt på splinen <avsluta>
Specify a precision Ange en precision
Specify base point of objects Ange objektens baspunkt
Specify block attachment Ange blockets anslutning
Specify center location override Ange åsidosatt placering för centrum
Specify center of isocircle Ange isocirkelns centrum
Specify center of view box Ange vyrutans centrum
Specify chamfer angle from the first line Ange fasvinkel från första linjen
Specify chamfer length on the first line Ange faslängd på första linjen
Specify change point Ange ändringspunkt
Specify clipping boundary or select invert option Ange beskärningsgräns eller välj alternativet Invertera
Specify collected multileader location or [Vertical/Horizontal/Wrap] Ange placering för samlad multihänvisningslinje eller [Lodrät/Vågrät/Radbryt]
Specify column height Ange kolumnhöjd
Specify control point <exit> Ange styrpunkt <avsluta>
Specify direction Ange riktning
Specify direction (first point) Ange riktning (första punkten)
Specify direction (second point) Ange riktning (andra punkten)
Specify direction of chord for arc Ange kordans riktning för bågen
Specify direction of vertex tangent Ange riktning för hörnpunktens tangent
Specify displacement Ange förskjutning
Specify displacement base point Ange baspunkt för förskjutning
Specify distance between columns (|||) Ange avstånd mellan kolumner (|||)
Specify end tangent Ange sluttangent
Specify existing fit point <exit> Ange befintlig anpassningspunkt <avsluta>
Specify first break point Ange första brytpunkten
Specify first corner of the unit cell Ange enhetscellens första hörn
Specify first fence point Ange första staketpunkten
Specify first point for arc length dimension Ange första punkten för båglängdsmått
Specify first point for breakline Ange första punkten för brytlinje
Specify first point or [Options] Ange första punkten eller [Alternativ]
Specify fourth point or Ange fjärde punkten eller
Specify gutter width Ange bredd på spaltmellanrum
Specify included angle for arc Ange medelpunktsvinkel för bågen
Specify insertion point of the table Ange tabellens insättningspunkt
Specify jog location Ange placering för knäcken
Specify jog location (or press ENTER) Ange placering för knäcken (eller tryck på ENTER)
Specify leader arrowhead location or [Remove leaders] Ange placering för hänvisningslinjens pilspets eller [Ta bort hänvisningslinjer]
Specify leader start point Ange hänvisningslinjens startpunkt
Specify leaders to remove Ange hänvisningslinjer att ta bort
Specify leaders to remove or [Add leaders] Ange hänvisningslinjer att ta bort eller [Lägg till hänvisningslinjer]
Specify length of line Ange linjens längd
Specify linetype name Ange linjetypens namn
Specify location for break symbol Ange placering för brytsymbol
Specify location of the text Ange textens placering
Specify new angle Ange ny vinkel
Specify new block insertion point Ange blockets nya insättningspunkt
Specify new block rotation angle Ange blockets nya rotationsvinkel
Specify new circle radius Ange cirkelns nya radie
Specify new elevation Ange nytt höjdläge
Specify new fit point <exit> Ange ny anpassningspunkt <avsluta>
Specify new height Ange ny höjd
Specify new length Ange ny längd
Specify new linetype scale Ange ny linjetypsskala
Specify new location Ange ny placering
Specify new location for dimension text Ange ny placering för måttal
Specify new point on spline <exit> Ange ny punkt på splinen <avsluta>
Specify new text insertion point Ange textens nya insättningspunkt
Specify new thickness Ange ny tjocklek
Specify next fence point Ange nästa staketpunkt
Specify number of columns Ange antal kolumner
Specify other corner Ange andra hörnet
Specify quadrant Ange kvadrant
Specify reference angle Ange referensvinkel
Specify reference length Ange referenslängd
Specify rotation around major axis Ange rotation kring storaxeln
Specify scale factor for XYZ axes Ange skalfaktor för XYZ-axlarna
Specify second point for arc length dimension Ange andra punkten för båglängdsmått
Specify second point for breakline Ange andra punkten för brytlinje
Specify size of view box Ange vyrutans storlek
Specify spacing Ange avstånd
Specify temporary OTRACK point Ange tillfällig OTRACK-punkt
Specify text height Ange texthöjd
Specify the angle between items Ange vinkeln mellan objekten
Specify the angle to fill (+=ccw, -=cw) Ange vinkel att fylla (+=moturs, -=medurs)
Specify the distance between columns (|||) Ange avståndet mellan kolumner (|||)
Specify the incrementing elevation between rows Ange höjdökningen mellan rader
Specify the new angle Ange den nya vinkeln
Specify the pattern origin Ange mönstrets origo
Specify the reference angle Ange referensvinkeln
Specify third point Ange tredje punkten
Specify tolerance Ange tolerans
Specify view twist angle Ange vyns vridningsvinkel
Specify width Ange bredd
Specify zoom scale factor Ange skalfaktor för zoom
Type of boundary object Typ av gränsobjekt
Type something to find Skriv något att söka efter
Use landing Använd anslutningslinje
Verify each name to be purged? Bekräfta varje namn som ska rensas?
Where should the data go? Var ska data hamna?
Word-wrap text? Radbryt text?
Remove objects Ta bort objekt
Select geometry to dimension Markera geometri att måttsätta
Select annotative objects Markera annotativa objekt
Specify total width Ange total bredd
Specify column width Ange kolumnbredd
Specify control point Ange styrpunkt
<style overrides> <lokala stiländringar>
A dimension style with this name already exists. Det finns redan en måttstil med det här namnet.
Above Ovanför
Above text Ovanför text
All properties of {style} Alla egenskaper för {style}
All styles Alla stilar
Alt enabled Alt. enheter aktiverade
Alt format Alt. format
Alt precision Alt. precision
Alt prefix Alt. prefix
Alt prefix and suffix Alt. prefix och suffix
Alt round Alt. avrundning
Alt scale factor Alt. skalfaktor
Alt suffix Alt. suffix
Alt zero suppression Alt. nollundertryckning
Alternate Units Alternativa enheter
Angle format Vinkelformat
Angle precision Vinkelprecision
Angular zero suppression Nollundertryckning för vinkelmått
Arc length symbol Båglängdssymbol
Architectural stacked Arkitektonisk, staplad
Architectural tick Arkitektoniskt snedstreck
Arrow 1 Pil 1
Arrow 2 Pil 2
Arrowheads Pilspetsar
Arrows Pilar
At Ext Line 1 Vid måttgränslinje 1
At Ext Line 2 Vid måttgränslinje 2
At least Minst
Baseline spacing Baslinjeavstånd
Before text Före text
Below Nedanför
Best fit Bästa anpassning
Bottom center Nere i mitten
Box blank Låda, tom
Box filled Låda, fylld
Center mark size Centrummarkeringens storlek
Closed blank Sluten, tom
Closed filled Sluten, fylld
Columns Kolumner
Comma Komma
Compare Jämför
Compare Dimension Styles Jämför måttstilar
Compare... Jämför...
Create New Dimension Style Skapa ny måttstil
Current dimension style: {style} Aktuell måttstil: {style}
Datum triangle Referenstriangel
Datum triangle filled Referenstriangel, fylld
Decimal separator Decimalavgränsare
Degrees Minutes Seconds Grader minuter sekunder
Diagonal stacking Diagonal stapling
Dim line color Måttlinjens färg
Dim line ext Måttlinjens förlängning
Dim line forced Tvingad måttlinje
Dim line linetype Måttlinjens linjetyp
Dim line lineweight Måttlinjens linjetjocklek
Dim prefix Måttprefix
Dim roundoff Måttavrundning
Dim scale linear Linjär måttskala
Dim suffix Måttsuffix
Dim units Måttenheter
Dimension Style Måttstil
Dimension Style Manager Hantera måttstilar
Dimension Style Overrides Lokala ändringar av måttstil
Dot Punkt
Dot blank Punkt, tom
Dot small Punkt, liten
Exactly Exakt
Ext line 1 linetype Linjetyp för måttgränslinje 1
Ext line 2 linetype Linjetyp för måttgränslinje 2
Ext line color Måttgränslinjens färg
Ext line ext Måttgränslinjens förlängning
Ext line fixed Fast längd på måttgränslinje
Ext line length Måttgränslinjens längd
Ext line lineweight Måttgränslinjens linjetjocklek
Ext line offset Måttgränslinjens förskjutning
Fraction format Bråkformat
Fractional stacked Bråk, staplat
Gradians Gon
Hide dim line 1 Dölj måttlinje 1
Hide dim line 2 Dölj måttlinje 2
Hide ext line 1 Dölj måttgränslinje 1
Hide ext line 2 Dölj måttgränslinje 2
Horizontal stacking Vågrät stapling
Integral Integral
JIS JIS
Jog angle Brytvinkel
Justification Justering
Keep dim line with text Håll ihop måttlinje och text
Leader arrow Hänvisningspil
Leading Inledande
Line space distance Radavståndsvärde
Line space factor Radavståndsfaktor
Line space style Radavståndsstil
Lines Linjer
Lines & Arrows Linjer och pilar
Lower tolerance Nedre tolerans
Measurement Mätning
Middle I mitten
Middle center I mitten, centrerat
Middle left I mitten till vänster
Middle right I mitten till höger
Misc Övrigt
Modify Dimension Style: {style} Ändra måttstil: {style}
Modify... Ändra...
Move text, add leader Flytta text, lägg till hänvisningslinje
Move text, no leader Flytta text, ingen hänvisningslinje
New Dimension Style: {style} Ny måttstil: {style}
New style name Namn på ny stil
New... Ny...
Not stacked Inte staplat
Obliquing Snedställning
Open 30 Öppen 30
Open arrow Öppen pil
Origin indicator Origoindikator
Origin indicator 2 Origoindikator 2
Outside Utanför
Over Ext Line 1 Över måttgränslinje 1
Over Ext Line 2 Över måttgränslinje 2
Override Current Style: {style} Åsidosätt aktuell stil: {style}
Override... Åsidosätt...
Overrides the dimension style. Right-click to use the style's value. Åsidosätter måttstilen. Högerklicka för att använda stilens värde.
Period Punkt
Prefix and suffix Prefix och suffix
Preview of: {style} Förhandsvisning av: {style}
Preview of: {style} (overrides) Förhandsvisning av: {style} (lokala ändringar)
Primary Units Primära enheter
Remove Style Overrides Ta bort lokala ändringar av stilen
Right angle Rät vinkel
Save as New Style... Spara som ny stil...
Save to current style Spara i aktuell stil
Set by text style "{style}", which has a fixed height. Give the style a height of 0 to use the dimension text height. Styrs av textstilen "{style}", som har fast höjd. Ge stilen höjden 0 för att använda måttalets höjd.
Small Liten
Some of these dimensions take their text height from a fixed-height text style. Några av dessa mått får sin texthöjd från en textstil med fast höjd.
Space Space
Start with Börja med
Style Stil
Styles Stilar
Styles in use Stilar som används
Suppress arrows Utelämna pilar
Symbols and Arrows Symboler och pilar
Text alignment X Textjustering X
Text alignment Y Textjustering Y
Text and arrows Text och pilar
Text inside Text inuti
Text inside align Justering av text inuti
Text movement Textförflyttning
Text offset Textförskjutning
Text outside align Justering av text utanför
Text pos hor Textpos. vågr.
Text pos vert Textpos. lodr.
Text position X Textposition X
Text position Y Textposition Y
Text rotation Textrotation
Text vertical position Lodrät textposition
Tick size Storlek på snedstreck
Tolerance height Toleranshöjd
Tolerance pos vert Tolerans pos. lodr.
Tolerance precision Toleransprecision
Tolerance zero suppression Nollundertryckning för tolerans
Tolerances Toleranser
Top Ovan
Top center Uppe i mitten
Trailing Avslutande
Upper tolerance Övre tolerans
Use the style's value Använd stilens värde
Variable Variabel
Windows desktop Windows-skrivbord
With Med
Zero suppression Nollundertryckning
{count} differences {count} skillnader
{property}: that value can't be used here. {property}: det värdet kan inte användas här.
Can't render this file because it contains an unexpected character in line 1500 and column 24.
-21
View File
@@ -732,24 +732,3 @@ fn polish_plural_forms() {
assert_eq!(plural_pl(n), expected, "n={n}");
}
}
/// Arabic gives Stretch, Trim and Point words of their own: Stretch read «تمديد» like Extend,
/// Trim's prompts said «قص» like Cut, and Point read «تأشير», the catalog's word for dimensioning.
#[test]
fn arabic_tells_stretch_trim_and_point_from_their_neighbours() {
// The words themselves: a pair that merely differs also differs when a row is missing and both
// fall back to English, and Point and Dimension already differed before.
for (key, word) in [("Stretch", "تمطيط"), ("Trim", "تشذيب"), ("Point", "نقطة")] {
assert_eq!(tr("ar", key), word, "{key}");
}
for (a, b) in [("Stretch", "Extend"), ("Trim", "Cut"), ("Point", "Dimension")] {
assert_ne!(tr("ar", a), tr("ar", b), "{a} and {b} share a word");
}
for (prompt, verb) in [
("Select object to trim or shift-select to extend", "تشذيب"),
("Select object to extend or shift-select to trim", "تشذيب"),
("Select objects to stretch by crossing-window or crossing-polygon...", "تمطيط"),
] {
assert!(tr("ar", prompt).contains(verb), "{prompt}");
}
}
+1 -25
View File
@@ -775,8 +775,7 @@ impl CadApp {
/// Open the drawing at `path`. Natively the file is read on a worker thread while an
/// "Opening ..." card shows ([`opening`]); [`Self::finish_opening`] adds it when ready. On the
/// web it opens at once. An already open drawing is selected without re-reading it, retaining
/// its unsaved edits and view; window drops and Open Recent use this same entry point.
/// web it opens at once.
pub fn open_path(&mut self, path: &Path) {
// A LISP file (dropped on the window): loaded as APPLOAD loads it.
if is_lisp_file(path) {
@@ -786,9 +785,6 @@ impl CadApp {
}
return;
}
if self.select_open_drawing(path) {
return;
}
#[cfg(not(target_arch = "wasm32"))]
{
self.opening.start(path);
@@ -819,10 +815,6 @@ impl CadApp {
/// OPEN is reported. Called every frame.
pub fn finish_opening(&mut self) {
for (path, outcome) in self.opening.poll() {
// A drawing may have been opened or saved at this path while the read was pending.
if self.select_open_drawing(&path) {
continue;
}
// A recent file that is gone can never be opened again: drop it from the list. A path
// whose existence can't be checked (a folder that denies access) stays.
if outcome.is_err() && matches!(path.try_exists(), Ok(false)) {
@@ -840,22 +832,6 @@ impl CadApp {
}
}
/// Reuse the existing document through the normal tab-switch command, including symlink paths.
fn select_open_drawing(&mut self, path: &Path) -> bool {
let existing = self.session.docs.iter().position(|d| d.path.as_deref().is_some_and(|p| opening::same_path(Path::new(p), path)));
let Some(index) = existing else { return false };
match self.run("document.switch", json!({"index": index})) {
Ok(_) => {
self.ui.start_tab = false;
if let Some(path) = self.session.docs.get(index).and_then(|d| d.path.clone()) {
self.remember_recent(path);
}
}
Err(error) => self.open_failed(error),
}
true
}
/// Load a LISP file: its routine runs and may wait for the user (APPLOAD typed or from the
/// menu runs this way too).
fn load_lisp(&mut self, name: &str, text: &str) {
-20
View File
@@ -13,22 +13,6 @@ use crate::theme::Tokens;
type Outcome = Result<ReadFile, String>;
/// Compare file paths without requiring the file to still exist. Native aliases are resolved so
/// a symlink and its target share a drawing; web paths can only be compared directly.
pub(crate) fn same_path(a: &Path, b: &Path) -> bool {
if a == b {
return true;
}
#[cfg(not(target_arch = "wasm32"))]
{
a.canonicalize().ok().zip(b.canonicalize().ok()).is_some_and(|(a, b)| a == b)
}
#[cfg(target_arch = "wasm32")]
{
false
}
}
struct Job {
path: PathBuf,
started: Instant,
@@ -44,10 +28,6 @@ pub struct Opening {
impl Opening {
/// Start reading `path` on a worker thread.
pub fn start(&mut self, path: &Path) {
// Repeated events can arrive before the first background read completes.
if self.jobs.iter().any(|j| same_path(&j.path, path)) {
return;
}
let (tx, rx) = channel();
let p = path.to_path_buf();
let spawned = std::thread::Builder::new().name("cadcraft-open".into()).spawn(move || {
+2 -2
View File
@@ -70,11 +70,11 @@ fn opened_drawings_are_listed_newest_first_and_survive_a_restart() {
let labels: Vec<_> = items.iter().map(|(l, _)| l.as_str()).collect();
assert_eq!(labels, ["plan.dxf", "section.dwg", "Clear Recent Files"]);
// Choosing an already open item selects its tab and moves it to the top.
// Choosing an item opens that file and moves it to the top.
let before = app.session.docs.len();
menus::activate(&mut app, &items[1].1);
settle(&mut app);
assert_eq!(app.session.docs.len(), before);
assert_eq!(app.session.docs.len(), before + 1);
assert_eq!(app.session.state().ok().and_then(|s| s.path.clone()), Some(section.clone()));
assert_eq!(app.ui.recent_files, [section.clone(), plan.clone()]);
-153
View File
@@ -1,153 +0,0 @@
//! Reopening a path selects the existing drawing, preserving edits, even across Finder events.
#![cfg(not(target_arch = "wasm32"))]
use cadcraft_engine::Session;
use cadcraft_engine::cmd::file::{IoHooks, set_io};
use cadcraft_engine::doc::Drawing;
use cadcraft_ui_egui::{CadApp, Services};
use serde_json::json;
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicU64, Ordering};
use std::time::{Duration, Instant};
struct Files(PathBuf);
impl Files {
fn new() -> Self {
static NEXT: AtomicU64 = AtomicU64::new(0);
let root = std::env::temp_dir().join(format!("cadcraft-reopen-{}-{}", std::process::id(), NEXT.fetch_add(1, Ordering::Relaxed)));
std::fs::create_dir(&root).unwrap();
set_io(IoHooks { read: |_, _| Ok(Drawing::new_metric()), write: |_, _| Ok(Vec::new()), plot: None });
Self(root)
}
fn drawing(&self, name: &str) -> PathBuf {
let path = self.0.join(name);
// Synthetic input: the test reader returns an empty drawing for any bytes.
std::fs::write(&path, b"0\nEOF\n").unwrap();
path
}
}
impl Drop for Files {
fn drop(&mut self) {
let _ = std::fs::remove_dir_all(&self.0);
}
}
fn app() -> CadApp {
CadApp::new(Session::empty(), Services::default())
}
fn open(app: &mut CadApp, path: &Path) {
app.open_path(path);
}
fn settle(app: &mut CadApp) {
let deadline = Instant::now() + Duration::from_secs(10);
while app.opening.busy() {
app.finish_opening();
assert!(Instant::now() < deadline, "background OPEN did not finish");
std::thread::sleep(Duration::from_millis(1));
}
}
#[test]
fn reopening_dwg_and_dxf_preserves_edits_view_and_recent_files() {
let files = Files::new();
for name in ["检查井 成果.dwg", "管网 检测.dxf"] {
let path = files.drawing(name);
let mut app = app();
open(&mut app, &path);
settle(&mut app);
app.run("circle", json!({"center": [1, 2], "radius": 3})).unwrap();
let before = app.session.state().unwrap().clone();
app.run("new", json!({})).unwrap();
let count = app.session.docs.len();
app.ui.start_tab = true;
open(&mut app, &path);
assert!(!app.opening.busy(), "an existing drawing must not be re-read");
let after = app.session.state().unwrap();
assert_eq!(after.uid, before.uid);
assert_eq!(after.doc, before.doc);
assert_eq!(after.view(), before.view());
assert_eq!(after.undo.len(), before.undo.len());
assert!(after.is_dirty());
assert_eq!(app.session.docs.len(), count);
assert!(!app.ui.start_tab);
assert_eq!(app.ui.recent_files.first().map(String::as_str), path.to_str());
}
}
#[test]
fn reopening_a_deleted_file_keeps_the_unsaved_drawing() {
let files = Files::new();
let path = files.drawing("deleted.dxf");
let mut app = app();
open(&mut app, &path);
settle(&mut app);
app.run("circle", json!({"center": [1, 2], "radius": 3})).unwrap();
let uid = app.session.state().unwrap().uid;
std::fs::remove_file(&path).unwrap();
app.run("new", json!({})).unwrap();
open(&mut app, &path);
assert!(!app.opening.busy());
assert_eq!(app.session.state().unwrap().uid, uid);
assert!(app.session.state().unwrap().is_dirty());
}
#[test]
fn repeated_requests_while_loading_add_one_tab_per_file() {
let files = Files::new();
let first = files.drawing("first.dxf");
let second = files.drawing("second.dwg");
let mut app = app();
open(&mut app, &first);
open(&mut app, &first);
open(&mut app, &second);
open(&mut app, &first);
settle(&mut app);
assert_eq!(app.session.docs.len(), 2);
assert!(app.session.docs.iter().any(|d| d.path.as_deref() == first.to_str()));
assert!(app.session.docs.iter().any(|d| d.path.as_deref() == second.to_str()));
}
#[cfg(unix)]
#[test]
fn symlinks_share_both_pending_reads_and_existing_dirty_tabs() {
let files = Files::new();
let path = files.drawing("drawing.dxf");
let alias = files.0.join("alias.dxf");
std::os::unix::fs::symlink(&path, &alias).unwrap();
let mut app = app();
open(&mut app, &path);
open(&mut app, &alias);
settle(&mut app);
assert_eq!(app.session.docs.len(), 1);
app.run("circle", json!({"center": [1, 2], "radius": 3})).unwrap();
let uid = app.session.state().unwrap().uid;
app.run("new", json!({})).unwrap();
open(&mut app, &alias);
assert!(!app.opening.busy());
assert_eq!(app.session.docs.len(), 2);
assert_eq!(app.session.state().unwrap().uid, uid);
assert!(app.session.state().unwrap().is_dirty());
}
#[test]
fn a_read_finishing_after_the_path_is_opened_keeps_existing_edits() {
let files = Files::new();
let path = files.drawing("pending.dxf");
let mut app = app();
open(&mut app, &path);
// Simulate another OPEN/Save As assigning this path before the UI polls the background read.
app.run("new", json!({})).unwrap();
app.session.state_mut().unwrap().path = path.to_str().map(str::to_string);
app.run("circle", json!({"center": [1, 2], "radius": 3})).unwrap();
let uid = app.session.state().unwrap().uid;
settle(&mut app);
assert_eq!(app.session.docs.len(), 1);
assert_eq!(app.session.state().unwrap().uid, uid);
assert!(app.session.state().unwrap().is_dirty());
assert_eq!(app.session.doc().unwrap().entity_count(), 1);
}
+1 -1
View File
@@ -15,7 +15,7 @@ use cadcraft_ui_egui::{CadApp, Services, menus};
const ORIGINAL: &[u8] = b"original";
fn unknown(kind: &str) -> EntityKind {
EntityKind::Unknown(Unknown { dxf_type: kind.into(), tags: vec![RawTag { code: 8, value: "0".into() }] })
EntityKind::Unknown(Unknown { dxf_type: kind.into(), tags: vec![RawTag { code: 8, value: "0".into() }], graphics: Vec::new() })
}
/// A drawing with objects of `types`, which DWG can't keep, opened from a DWG file on disk.