Save Flat File to specified directory

Save Flat File to specified directory

Lance127
Advocate Advocate
454 Views
1 Reply
Message 1 of 2

Save Flat File to specified directory

Lance127
Advocate
Advocate

I am trying to use this code to take the flat pattern and save it to a specified directory ("X:\Burn Files\" ) but I can't get the path to work. I can save the file just fine but not where I would like it to go.

 

I'm a novice at VBA so any help would be appreciated.

 

 

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


Lance W.
Inventor Pro 2013 (PDS Ultimate)
Vault Pro 2013
Windows 7 64
Xeon 2.4 Ghz 12GB
0 Likes
455 Views
1 Reply
Reply (1)
Message 2 of 2

skyngu
Collaborator
Collaborator

try this:

 

sFname = oDoc.displayname & ".dxf"

sFname = "X:\Burn Files\" &  sFname

 

 

 

Autodesk Inventor Professional 2019
0 Likes