From 924a37abac44808a17c8ce7e69e3d6581c00a807 Mon Sep 17 00:00:00 2001 From: Mex <44814932+MMexicann@users.noreply.github.com> Date: Sat, 21 Nov 2026 20:25:56 +0100 Subject: [PATCH 1/2] Report undrawn entities when running an image export --- apps/cadcraft-cli/src/run.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/cadcraft-cli/src/run.rs b/apps/cadcraft-cli/src/run.rs index 56b4626e2..642cab033 100644 --- a/apps/cadcraft-cli/src/run.rs +++ b/apps/cadcraft-cli/src/run.rs @@ -1,7 +1,7 @@ use super::args::{CmdStep, Drawing, RunArgs, Step}; use super::error::Result; use super::open; -use super::output::{Streams, export, export_framed, export_window, model_views}; +use super::output::{Streams, export, export_framed, export_window, model_views, undrawn_message}; use cadcraft_engine::Session; use cadcraft_engine::doc::Handle; use serde_json::Value; @@ -216,7 +216,15 @@ pub(crate) fn run_cmds(a: &RunArgs, io: &mut Streams) -> Result { export(&s, p, io)?; } if let Some(p) = export_to { - let window = if cadcraft_io::is_image(p) { export_window(&s, framing, Some(&before))? } else { None }; + let window = if cadcraft_io::is_image(p) { + let window = export_window(&s, framing, Some(&before))?; + if let Some(message) = undrawn_message(s.doc()?, &p.to_string_lossy()) { + io.errln(format_args!("{message}")); + } + window + } else { + None + }; export_framed(&s, p, window, io)?; } Ok(()) From 3d9b5f61756970c35e4d2cb10825950affc69dec Mon Sep 17 00:00:00 2001 From: Mex <44814932+MMexicann@users.noreply.github.com> Date: Sat, 21 Nov 2026 20:26:18 +0100 Subject: [PATCH 2/2] Check image warnings on stderr without changing native exports --- .../cadcraft-cli/tests/it/undrawn_entities.rs | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/apps/cadcraft-cli/tests/it/undrawn_entities.rs b/apps/cadcraft-cli/tests/it/undrawn_entities.rs index 59762d283..bbe4bc2fd 100644 --- a/apps/cadcraft-cli/tests/it/undrawn_entities.rs +++ b/apps/cadcraft-cli/tests/it/undrawn_entities.rs @@ -1,5 +1,5 @@ -//! `convert` to an image says how many model-space entities it can't draw, by type, instead of -//! leaving them out silently (#1208). The exit code stays 0. +//! Image exports report how many model-space entities they can't draw, by type. The exit code +//! stays 0 (#1208). use std::process::{Command, Output}; @@ -70,6 +70,28 @@ fn convert_to_an_image_warns_about_entities_it_cannot_draw() { assert!(!String::from_utf8_lossy(&out.stderr).contains("not drawn"), "{}", String::from_utf8_lossy(&out.stderr)); } +#[test] +fn run_image_export_warns_about_undrawn_entities() { + let scratch = Scratch::new("run-undrawn"); + let input = scratch.0.join("proxies.dxf"); + std::fs::write(&input, PROXIES).unwrap(); + let image = scratch.0.join("out.svg"); + let out = cli(&["run", input.to_str().unwrap(), "--export", image.to_str().unwrap()]); + let err = String::from_utf8_lossy(&out.stderr); + assert!(out.status.success(), "{:?}: {err}", out.status); + assert!(image.is_file()); + assert!(out.stdout.is_empty(), "the warning belongs on stderr"); + let warnings: Vec<&str> = err.lines().filter(|l| l.contains("not drawn")).collect(); + assert_eq!(warnings, [format!("{}: 3 entities not drawn (PDFUNDERLAY: 1, REGION: 2)", image.display())], "{err}"); + + let copy = scratch.0.join("copy.dxf"); + let out = cli(&["run", input.to_str().unwrap(), "--export", copy.to_str().unwrap()]); + let err = String::from_utf8_lossy(&out.stderr); + assert!(out.status.success(), "{:?}: {err}", out.status); + assert!(copy.is_file()); + assert!(!err.contains("not drawn"), "{err}"); +} + /// An OLE2FRAME's frame outline is drawn, so an image export doesn't call it an undrawn entity (#2422); it /// says once that the OLE content inside the frame is not drawn (review on #2587). #[test]