ds-blue-logo
Preview  |  SOLIDWORKS USER FORUM
Use your SOLIDWORKS ID or 3DEXPERIENCE ID to log in.
JCJohn Christensen27/01/2016

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