Skip to content

Add DwgExportManager: batch DWG/DXF export to PDF/PNG - #3

Open
vienha wants to merge 1 commit into
ADN-DevTech:masterfrom
vienha:master
Open

Add DwgExportManager: batch DWG/DXF export to PDF/PNG#3
vienha wants to merge 1 commit into
ADN-DevTech:masterfrom
vienha:master

Conversation

@vienha

@vienha vienha commented Sep 5, 2026

Copy link
Copy Markdown

Summary

  • Add DwgExportManager: a new WPF app to batch-export DWG/DXF drawings to PDF/PNG (pick Model/Layout and, for PNG, a per-drawing paper size, preview in AutoCAD, batch run via AutoCAD COM)
  • Add DwgExportManagerSetup: self-contained WiX installer for the new app (bundles .NET 8 runtime)
  • Make DrawingListUC.AcadComUtils public so the new project can reuse the existing AutoCAD COM helpers
  • Register both new projects in ScriptProPlus.sln and document them in README.md
  • Add MoTaNghiepVu.md describing ScriptProPlus's existing business flow
  • Add two test AutoLISP scripts (TestFiles/PlotAllLayoutsToPDF_A1.scr, PlotAllLayoutsToPNG.scr) that plot every layout of a drawing to PDF/PNG
  • Ignore the publish/ build output folder and VS-generated UpgradeLog*.htm files in .gitignore

Test plan

  • dotnet build ScriptProPlus.sln succeeds
  • Run DwgExportManager, browse a folder of DWG/DXF files, confirm Model/Layout dropdown and PNG paper size column both work per row
  • Export a sample drawing to PDF and to PNG and confirm output lands in danxuat/ next to the source file
  • Build DwgExportManagerSetup MSI and verify it installs/runs without a pre-installed .NET 8 runtime

🤖 Generated with Claude Code

https://claude.ai/code/session_011fpqFb1EZqvV2c7PURqcuq

Adds a new WPF tool (plus self-contained WiX installer) that browses a
folder of drawings, lets the user pick Model/Layout and a per-file PNG
paper size, and batch-exports to PDF and/or PNG through AutoCAD COM.
Exposes AcadComUtils publicly so the new project can reuse ScriptPro's
existing AutoCAD COM helpers, and ignores the publish/ build output dir.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011fpqFb1EZqvV2c7PURqcuq
@MadhukarMoogala

MadhukarMoogala commented Sep 9, 2026

Copy link
Copy Markdown

Thanks for contribution, can you please revise your comments in source code to English, and we need only one MSI, if your addition is creating another MSI, we would like to avoid that.
And the markdown document also in not in English, please translate to English so I can understand quickly. // MoTaNghiepVu.md

Edit: on the MSI point — please fold this into ScriptPro as an addin feature, not a separate app. ScriptUI is our existing AutoCAD addin (netloaded, packaged by ScriptProSetup) — DwgExportManager's export logic (ExportEngine, AcadSession, LayoutReader, MainWindow) should become a feature/command inside ScriptUI, sharing its AutoCAD COM session, rather than a standalone WPF process with its own COM connection. Please:

  • Remove the DwgExportManagerSetup project entirely — we only want one MSI (ScriptProSetup).
  • Merge the export UI as a window/panel launched from ScriptUI, reusing DrawingListUC.AcadComUtils (good that you already reused it) instead of standing up a separate AcadApplication COM connection.
  • Reuse ScriptUI's existing MessageFilter instead of the duplicate copy in DwgExportManager/MessageFilter.cs.

Also a few correctness issues worth fixing while restructuring:

  • ExportEngine.cs: BACKGROUNDPLOT/LOGFILEMODE/FILEDIA sysvars set before export aren't reliably restored on stop/error/early-return paths — can leak into the user's live AutoCAD session permanently if attached to an already-running instance.
  • Bare catch blocks in AcadSession.cs swallow all exceptions and return a default, including on genuine COM-busy timeouts — can make WaitForIdle falsely report idle mid-plot. Please log instead of swallowing.
  • MainWindow.xaml.cs: on Stop, error is never assigned, so the row status shows a bare "Lỏi: " with no message.
  • ViewButton_Click calls OpenDocument synchronously on the UI thread; the COM retry loop can block it ~15s with no cancel.
  • PDF and PNG export blocks in ExportFile are near-duplicate — worth extracting a shared path once merged into ScriptUI.

No rush — happy to wait for your update whenever you get to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants