I have a Macro that creates a DXF file from a sheetmetal part, and it works just fine. The only problem is that for some reason, the DXF is coming out 90 degrees rotated. Does any body knows how to fix this? or a way around it ?
Heres the code
Sub main()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim bShowConfig As Boolean
Dim bRet As Boolean
Dim FilePath As String
Dim PathSize As Long
Dim PathNoExtension As String
Dim NewFilePath As String
Set swApp = CreateObject("SldWorks.Application")
Set swModel = swApp.ActiveDoc
If Not swModel Is Nothing Then
FileTyp = swModel.GetType
If FileTyp = swDocPART Then
FilePath = swModel.GetTitle
NewFilePath = "P:\common\Solidworks Files\DXF\" & FilePath & ".DXF"
'Export Flat Pattern
bRet = swModel.ExportFlatPatternView(NewFilePath, 1)
MsgBox "File has been saved on " & NewFilePath
Else
MsgBox "Current document is not a Part" & Chr(13) & Chr(13) _
& "Please load/activate a SolidWorks " & Chr(13) _
& "Part and try again.", vbExclamation
End If
Else
MsgBox "No active Part found in SolidWorks." & Chr(13) & Chr(13) _
& "Please load/activate a SolidWorks " & Chr(13) _
& "Part and try again.", vbExclamation
End If
End Sub
SolidworksApi macros