AnsweredAssumed Answered

ExportFlatPatternView exporting dxf scale issue

Question asked by John Christensen on Jan 27, 2016
Latest reply on Jan 28, 2019 by Niels Raahauge

In the past I've been using the following macro to export a dxf for sheetmetal flat pattern configurations.  Using SW2016 it now exports the dxf as usual, but the output is scaled to something different than the original. Has anyone else had this happen and what would I need to change to correct it.


Option Explicit

Sub main()

    Dim swApp                   As SldWorks.SldWorks
    Dim swModel                 As SldWorks.ModelDoc2
    Dim vConfNameArr            As Variant
    Dim sConfigName             As String
    Dim nStart                  As Single
    Dim i                       As LongPtr
    Dim bShowConfig             As Boolean
    Dim bRebuild                As Boolean
    Dim bRet                    As Boolean

    Set swApp = CreateObject("SldWorks.Application")
    Set swModel = swApp.ActiveDoc

    vConfNameArr = swModel.GetConfigurationNames

    For i = 0 To UBound(vConfNameArr)

         sConfigName = vConfNameArr(i)
         'sConfigName = "DefaultSM-FLAT-PATTERN"
         bShowConfig = swModel.ShowConfiguration2(sConfigName)
         bRebuild = swModel.ForceRebuild3(False)

        Dim FilePath As String
        Dim PathSize As Long
        Dim PathNoExtension As String
        Dim NewFilePath As String

        FilePath = swModel.GetPathName
        PathSize = Strings.Len(FilePath)
        PathNoExtension = Strings.Left(FilePath, PathSize - 6)
        NewFilePath = PathNoExtension & "DXF"

        'Export Flat Pattern
        bRet = swModel.ExportFlatPatternView(NewFilePath, swExportFlatPatternOption_None)

    Next i

bShowConfig = swModel.ShowConfiguration2(vConfNameArr(0))
End Sub