Results 1 to 4 of 4

Thread: Save Inventor flat file to specific directory

  1. #1
    Member
    Join Date
    2011-06
    Location
    Florida
    Posts
    9
    Login to Give a bone
    0

    Default Save Inventor flat file to specific directory

    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
    Last edited by Ed Jobe; 2011-09-26 at 04:51 PM.

  2. #2
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,396
    Login to Give a bone
    0

    Default Re: Save Inventor flat file to specific directory

    What's the error?
    C:> ED WORKING....

  3. #3
    Member
    Join Date
    2011-06
    Location
    Florida
    Posts
    9
    Login to Give a bone
    0

    Default Re: Save Inventor flat file to specific directory

    When I add in "sFname = "X:\Burn Files\" & sFname" I get runtime error -2147467259 Method 'WrtieDataToFile' of object 'DataIO' failed.

    All I can figure is that I am not getting the filename only.

  4. #4
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,396
    Login to Give a bone
    0

    Default Re: Save Inventor flat file to specific directory

    You show that the WriteDataToFile method has 2 args. Is the syntax of the other arg correct? Also, are there any spaces in the string stored in sFname? I see one in "Burn Files". Its probably best to enclose the whole path in double quotes in case there ever is a space. Remember, you're passing this string to the file system to create a file. You have to follow the file system rules.

    sFname = """X:\Burn Files\" & sFname & """"
    C:> ED WORKING....

Similar Threads

  1. Open all drawings in a directory, save, close.
    By JSimons in forum AutoLISP
    Replies: 18
    Last Post: 2020-05-08, 10:08 PM
  2. How to force WBLOCK to save as specific version
    By straits58 in forum AutoLISP
    Replies: 1
    Last Post: 2014-10-31, 01:10 PM
  3. save inventor file back to 2009
    By jheisler in forum Inventor - General
    Replies: 1
    Last Post: 2009-07-08, 12:55 PM
  4. Startapp Windows Explorer to a specific directory
    By jsr13 in forum AutoCAD Customization
    Replies: 10
    Last Post: 2008-08-07, 02:31 PM
  5. Save directory location in AutoLISP routine.
    By bartstienaers in forum AutoLISP
    Replies: 3
    Last Post: 2005-09-09, 07:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •