Any help would be appreciated here. I am trying to export the flat pattern from Inventor out to a dwg file for our laser cutter. I can get the file created like we want but I can not get it saved to the correct directory. Whenever I try adding the path I get an error.
Any Ideas?
Lance W.
Code:
Public Sub WriteSheetMetalDWG()
' Get the active document. This assumes it is a part document.
Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oCompDef As SheetMetalComponentDefinition
Set oCompDef = oDoc.ComponentDefinition
If oCompDef.HasFlatPattern = False Then
oCompDef.Unfold
End If
' Build the string that defines the format of the DWG file.
Dim sOut As String
sOut = "FLAT PATTERN DWG?AcadVersion=2004&OuterProfileLayer=Burn&InteriorProfilesLayer=Burn&InvisibleLayers=IV_TANGENT;IV_BEND;IV_BEND_DOWN&SplineTolerance Double 0.01"
' Create the DXF file.
' oDataIO.WriteDataToFile sOut, "X:\Burn Files\"
' Get the filename minus the extension.
Dim sFname As String
sFname = oDoc.FullFileName
sFname = Left(sFname, Len(sFname) - 4)
' The file format will depend on the extension
sFname = sFname & "-B.dwg"
'sFname = "X:\Burn Files\" & sFname
' Create the DXF file.
oCompDef.DataIO.WriteDataToFile sOut, sFname
End Sub