@@ -807,6 +807,16 @@ export class AppShell extends BaseCustomWebComponentConstructorAppend {
807807 this . exportData ( 'emf' ) ;
808808 }
809809 } ,
810+ {
811+ title : 'export as DWG (acad-ts)' , action : async ( ) => {
812+ this . exportData ( 'dwg' ) ;
813+ }
814+ } ,
815+ {
816+ title : 'export as DXF (acad-ts)' , action : async ( ) => {
817+ this . exportData ( 'dxf-acad-ts' ) ;
818+ }
819+ } ,
810820 { title : '-' } ,
811821 {
812822 title : 'export overlay' , checked : this . _exportOverlays , checkable : true , action : ( ) => {
@@ -823,8 +833,8 @@ export class AppShell extends BaseCustomWebComponentConstructorAppend {
823833 ] , e ) ;
824834 }
825835
826- async exportData ( format : 'dxf' | 'pdf' | 'png' | 'svg' | 'html' | 'emf' ) {
827- const { extractIR, renderIR, DXFWriter, PDFWriter, PNGWriter, SVGWriter, HTMLWriter, EMFWriter } = await import ( "@node-projects/layout2vector" ) ;
836+ async exportData ( format : 'dxf' | 'pdf' | 'png' | 'svg' | 'html' | 'emf' | 'dwg' | 'dxf-acad-ts' ) {
837+ const { extractIR, renderIR, DXFWriter, PDFWriter, PNGWriter, SVGWriter, HTMLWriter, EMFWriter, DWGWriter , AcadDXFWriter } = await import ( "@node-projects/layout2vector" ) ;
828838
829839 const doc = < DocumentContainer > this . _dockManager . activeDocument . resolvedElementContent ;
830840
@@ -870,6 +880,14 @@ export class AppShell extends BaseCustomWebComponentConstructorAppend {
870880 const emfWriter = new EMFWriter ( 1000 , 2000 ) ;
871881 const emfContent = await renderIR ( ir , emfWriter ) ;
872882 await saveData ( emfContent , 'emfFile' , 'emf' ) ;
883+ } else if ( format === 'dwg' ) {
884+ const dwgWriter = new DWGWriter ( { } ) ;
885+ const dwgContent = await renderIR ( ir , dwgWriter ) ;
886+ await saveData ( dwgContent , 'dwgFile' , 'dwg' ) ;
887+ } else if ( format === 'dxf-acad-ts' ) {
888+ const dxfWriter = new AcadDXFWriter ( { } ) ;
889+ const dxfContent = await renderIR ( ir , dxfWriter ) ;
890+ await saveData ( dxfContent , 'dxfFile' , 'dxf' ) ;
873891 }
874892 }
875893
0 commit comments