ExportToDWG2 Performance

We have a bespoke addin that, among other things, exports dxf files of our sheet metal parts for laser cutting using ExportFlatPatternView.

Occasionally ExportFlatPatternView does not export correctly from the flat pattern and I noticed that this call is marked obsolete in the documentation for SW2017 so I changed it to use ExportToDWG2. Using ExportToDWG2 has resulted in a fairly major performance hit. A test assembly with 10 parts that takes 19s to create the dxf files with ExportFlatPatternView takes 53s with ExportToDWG2. Our assemblies will typically contain a few hundred sheet metal parts so this would cause a considerable increase in time.

I think this is in part because ExportToDWG2 will only work if I activate the part file using AcitivateDoc3. This is not necessary with ExportFlatPatternView.

This is how I am calling ExportToDWG2. swPartDoc is referencing the part file that the flat pattern dxf is to be created from.

Dim align() As Double = {0.0#, 0.0#, 0.0#, 1.0#, 0.0#, 0.0#, 0.0#, 1.0#, 0.0#, 0.0#, 0.0#, 1.0#}

Dim objAlign As Object = align

Dim pathName As String = swModel.GetPathName

swApp.ActivateDoc3(pathName , True, Nothing, Nothing)

retVal = swPartDoc.ExportToDWG2(filePath, pathName , swExportToDWG_e.swExportToDWG_ExportSheetMetal,

                                                          True, objAlign, False, False, 17, Nothing)

swApp.CloseDoc(pathName)

Anyone else noticed this or know if there is any way to bring the performance of ExportToDWG2 closer to that of ExportFlatPatternView?

SolidworksApi macros