Exporting Flat Pattern as DWG/DXF

By Philippe Leefsma

Q:

How to create a DWG/DXF file flat pattern from an Inventor sheet metal part?

A:

The WriteDataToFile method of the DataIO object supports the option to write the flat pattern out as a DWG file. You can also supply arguments in a method similar to http URL variables (starting with ‘?’, ‘key=value’, multiple keys and values separated by ‘&’).

The valid arguments are:
TangentLayer = [name]
BendLayer = [name]
OuterProfileLayer = [name]
AcadVersion = {"2005","2004","2002", "2000", "R14", "R13", "R12",} // R12 is only supported for the dxf format type.

For example:

 
"FLAT PATTERN DWG?AcadVersion=2000"
"FLAT PATTERN DWG?AcadVersion=R14"
"FLAT PATTERN DWG?AcadVersion=R13&TangentLayer=myTangLayer"
"FLAT PATTERN DXF?AcadVersion=R14&BendLayer=myBendLayer"

Here is a VB.Net sample:

    Public Sub DwgFlat(ByVal app As Inventor.Application)

 

        Dim oDoc As PartDocument = app.ActiveDocument

        Dim oDataIO As DataIO = oDoc.ComponentDefinition.DataIO

 

        oDataIO.WriteDataToFile(

            "FLAT PATTERN DWG?AcadVersion=2000&BendLayer=myBendLayer",

            "c:\flat.dwg")

 

    End Sub

<

p style=”line-height: normal;margin: 0in 0in 0pt” class=”MsoNormal”> 


Comments

3 responses to “Exporting Flat Pattern as DWG/DXF”

  1. noontz Avatar
    noontz

    According to the SDK help file there are a lot more valid arguments? Also a manual flatpattern dxf export supports an .ini file. How do you “feed” that ini file to the DataIO object? I have an unanswered question on the same matter here : http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/dxf-flatpattern-export-with-ini-file/td-p/3796796 The information on this matter is amazingly thin an dispersed.

  2. Hi Noontz,
    Yes there are a lot more arguments, this devnote was written a while ago and was migrated as-is on that blog. You can find an exhaustive list of the arguments by looking at the “DataIO Interface” in the SDK Help files. That section gathers pretty much everything you would need to know about the export.
    Unfortunately I don’t see a way to feed the ini file to the DataIO object, it only accepts a string containing the options. If you have an ini file as input, you would probably need to parse that file with your own code and generate that string on your own. The only way to provide an ini file seems to be using the DWG/DXF Translator add-in, but you cannot directly export a flatpattern object with that. Sorry for that bad news.

  3. Hallo,
    Habe zwei Exportfunktionen geschrieben. Einmal im Inventor-VBA und einmal unterm VB-Studio.
    Beides Funktionen machen das gleiche.
    Wenn ich nun die Abwicklung im Inventor via VBA exportiere ist alles wie es sein soll.
    Wenn ich aber die Abwicklung via vb.net Programm exportiere, werden im Dateinamen alle Grossbuchstaben in Kleinbuchstaben konvertiert. Ist das ein Fehler in der Schnittstelle seitens Autodesk oder woran kann das liegen.

Leave a Reply to BöschCancel reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading