DXF: $ANGBASE is in degrees (#1234)

AutoCAD writes $ANGBASE in degrees (a drawing whose angles run clockwise from
north has 90.0); CADCraft read and wrote it as radians, so such a drawing's
angle base came in as 90 radians (about 116.6 degrees), turning typed angles,
polar tracking and angles shown in Properties. The reader now converts to
radians (the variable's unit), the writer back, and the DWG reader's hand-off
of the value in DXF form gives degrees.

Co-authored-by: Cody Vogt <18035288+codyvogt@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Coast
2026-10-19 02:31:12 -04:00
committed by GitHub
co-authored by Cody Vogt Claude Opus 5.5
parent aba903dbb3
commit 3fa7275e4f
6 changed files with 26 additions and 5 deletions
+1 -1
View File
@@ -130,7 +130,7 @@ pub fn get(s: &Session, name: &str) -> Option<Value> {
"MAXARRAY" => json!(st.maxarray),
"ZOOMFACTOR" => json!(st.zoomfactor),
"LASTPOINT" => json!([s.last_point.x, s.last_point.y, 0.0]),
// Held in radians (as `$ANGBASE` in DXF); reported in degrees, like POLARANG.
// Held in radians (`$ANGBASE` in DXF is in degrees); reported in degrees, like POLARANG.
"ANGBASE" => json!(s.doc().ok()?.header.f64("ANGBASE", 0.0).to_degrees()),
"CONSTRAINTINFER" => json!(i32::from(s.doc().ok()?.parametric.settings.infer)),
// Process-wide font substitution (profile settings, not saved in the drawing).
+1 -1
View File
@@ -157,7 +157,7 @@ fn parse_mixed(s: &str) -> Option<f64> {
pub struct AngleSettings {
/// AUNITS: 0 decimal degrees, 1 degrees/minutes/seconds, 2 grads, 3 radians, 4 surveyor's.
pub aunits: i64,
/// ANGBASE: the direction of angle 0, in radians counterclockwise from +X (as `$ANGBASE` in DXF).
/// ANGBASE: the direction of angle 0, in radians counterclockwise from +X (`$ANGBASE` in DXF is in degrees).
pub angbase: f64,
/// ANGDIR 1: positive angles turn clockwise.
pub clockwise: bool,