i could not find a solution with the inventor API. But dxf files are txt files and there not difficult to change. you can try this iLogic rule.
Dim filename = "D:\forum\flat.dxf"
Dim LayerName = "MYLAYER"
Dim color = 100
' colors found on: http://data.tessel.pl/manuals/HyperDoc/content/bk08ch01s06.html
'create dxf file
Dim oDoc As PartDocument = ThisApplication.ActiveDocument
Dim oDataIO As DataIO = oDoc.ComponentDefinition.DataIO
Dim sOut As String = "FLAT PATTERN DXF?AcadVersion=R12"
oDataIO.WriteDataToFile(sOut, filename)
'change dxf
Dim lines() As String = IO.File.ReadAllLines(filename)
For i = 1 To lines.Count - 10
If (lines(i) = "LAYER" And
lines(i + 1) = " 2" And
lines(i + 2) = LayerName
) Then
lines(i + 6) = " " & color
End If
Next
IO.File.WriteAllLines(filename, lines)
You need to change the 3 variable in the top of the code.
The "LayerName" needs to be exact the name that you used in the attribute.
The "color" needs to be an integer between 1 and 255. on this side i found a nice color map and here a conversion table
Last but not least. Normally i would not advice to edit files directly like this, there for this disclamer: I did not test this extensively. You will need to that before using it in production.
Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

Blog: hjalte.nl - github.com