<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic iLogic. Inventor 2020 Professional in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-inventor-2020-professional/m-p/14008644#M179298</link>
    <description>&lt;P&gt;Hi everyone!&lt;/P&gt;&lt;P&gt;I’m using &lt;STRONG&gt;Inventor 2020 Pro&lt;/STRONG&gt;. Right now I’m trying to write a script to automate part of my workflow.&lt;/P&gt;&lt;P&gt;In a folder I have several files that contain flat parts and follow a similar naming pattern.&lt;/P&gt;&lt;P&gt;In a loop I:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;take each file,&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;open it,&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;get all faces of the flat part,&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;find the face with the largest area,&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;and try to export that selected face as a DXF.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I’m able to find the face with the maximum area in code, but after that I can’t get the export function to work with that face.&lt;/P&gt;&lt;P&gt;Here’s my code.&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;...
Dim partFiles As String() = Directory.GetFiles(sourceFolder, "*.ipt", SearchOption.TopDirectoryOnly)
...

Try
    Dim compDef As Inventor.PartComponentDefinition = partDoc.ComponentDefinition
    Dim maxFace As Inventor.Face = Nothing
    Dim maxArea As Double = -1.0

    For Each body As Inventor.SurfaceBody In compDef.SurfaceBodies
        For Each face As Inventor.Face In body.Faces
            If face.SurfaceType = Inventor.SurfaceTypeEnum.kPlaneSurface Then
                Dim evaluator As Inventor.SurfaceEvaluator = face.Evaluator
                Dim area As Double = evaluator.Area
                If area &amp;gt; maxArea Then
                    maxArea = area
                    maxFace = face
                End If
            End If
        Next
    Next

    If maxFace Is Nothing Then
        Return "[Skip] " &amp;amp; System.IO.Path.GetFileName(partPath) &amp;amp; " — no flat faces found"
    End If

    Dim selectSet As Inventor.SelectSet = partDoc.SelectSet
    selectSet.Clear()
    selectSet.Select(maxFace)

    Dim dxfPath As String = System.IO.Path.Combine(dxfFolder, System.IO.Path.GetFileNameWithoutExtension(partPath) &amp;amp; ".dxf")
    Dim exportStatus As String = ExportSelectedFaceViaUI(dxfPath)
    Return "[OK] " &amp;amp; System.IO.Path.GetFileName(partPath) &amp;amp; " → " &amp;amp; exportStatus
Finally
    If Not isAlreadyOpen AndAlso partDoc IsNot Nothing Then
        partDoc.Close(False)
    ElseIf partDoc IsNot Nothing Then
        partDoc.Activate()
    End If
End Try&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Maybe someone more experienced can take a look and point out what I’m doing wrong. I realize it might look like total nonsense, but I really need some guidance.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I can’t get the face export to DXF working — the files just never show up in the target folder. I double-checked that the script returns the correct area for the largest face, so it &lt;EM&gt;is&lt;/EM&gt; finding that face and selecting it. (From what I’ve read, programmatically selecting a face doesn’t necessarily produce any visible selection highlight in the UI.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My guess is that in the &lt;STRONG&gt;Inventor 2020 Pro API&lt;/STRONG&gt; there may not be a way to export a &lt;EM&gt;selected face&lt;/EM&gt; directly.&lt;/P&gt;&lt;P&gt;Thanks for taking the time to read my question.&lt;/P&gt;</description>
    <pubDate>Sat, 07 Feb 2026 15:44:57 GMT</pubDate>
    <dc:creator>john_combo</dc:creator>
    <dc:date>2026-02-07T15:44:57Z</dc:date>
    <item>
      <title>iLogic. Inventor 2020 Professional</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-inventor-2020-professional/m-p/14008644#M179298</link>
      <description>&lt;P&gt;Hi everyone!&lt;/P&gt;&lt;P&gt;I’m using &lt;STRONG&gt;Inventor 2020 Pro&lt;/STRONG&gt;. Right now I’m trying to write a script to automate part of my workflow.&lt;/P&gt;&lt;P&gt;In a folder I have several files that contain flat parts and follow a similar naming pattern.&lt;/P&gt;&lt;P&gt;In a loop I:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;take each file,&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;open it,&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;get all faces of the flat part,&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;find the face with the largest area,&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;and try to export that selected face as a DXF.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I’m able to find the face with the maximum area in code, but after that I can’t get the export function to work with that face.&lt;/P&gt;&lt;P&gt;Here’s my code.&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;...
Dim partFiles As String() = Directory.GetFiles(sourceFolder, "*.ipt", SearchOption.TopDirectoryOnly)
...

Try
    Dim compDef As Inventor.PartComponentDefinition = partDoc.ComponentDefinition
    Dim maxFace As Inventor.Face = Nothing
    Dim maxArea As Double = -1.0

    For Each body As Inventor.SurfaceBody In compDef.SurfaceBodies
        For Each face As Inventor.Face In body.Faces
            If face.SurfaceType = Inventor.SurfaceTypeEnum.kPlaneSurface Then
                Dim evaluator As Inventor.SurfaceEvaluator = face.Evaluator
                Dim area As Double = evaluator.Area
                If area &amp;gt; maxArea Then
                    maxArea = area
                    maxFace = face
                End If
            End If
        Next
    Next

    If maxFace Is Nothing Then
        Return "[Skip] " &amp;amp; System.IO.Path.GetFileName(partPath) &amp;amp; " — no flat faces found"
    End If

    Dim selectSet As Inventor.SelectSet = partDoc.SelectSet
    selectSet.Clear()
    selectSet.Select(maxFace)

    Dim dxfPath As String = System.IO.Path.Combine(dxfFolder, System.IO.Path.GetFileNameWithoutExtension(partPath) &amp;amp; ".dxf")
    Dim exportStatus As String = ExportSelectedFaceViaUI(dxfPath)
    Return "[OK] " &amp;amp; System.IO.Path.GetFileName(partPath) &amp;amp; " → " &amp;amp; exportStatus
Finally
    If Not isAlreadyOpen AndAlso partDoc IsNot Nothing Then
        partDoc.Close(False)
    ElseIf partDoc IsNot Nothing Then
        partDoc.Activate()
    End If
End Try&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Maybe someone more experienced can take a look and point out what I’m doing wrong. I realize it might look like total nonsense, but I really need some guidance.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I can’t get the face export to DXF working — the files just never show up in the target folder. I double-checked that the script returns the correct area for the largest face, so it &lt;EM&gt;is&lt;/EM&gt; finding that face and selecting it. (From what I’ve read, programmatically selecting a face doesn’t necessarily produce any visible selection highlight in the UI.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My guess is that in the &lt;STRONG&gt;Inventor 2020 Pro API&lt;/STRONG&gt; there may not be a way to export a &lt;EM&gt;selected face&lt;/EM&gt; directly.&lt;/P&gt;&lt;P&gt;Thanks for taking the time to read my question.&lt;/P&gt;</description>
      <pubDate>Sat, 07 Feb 2026 15:44:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-inventor-2020-professional/m-p/14008644#M179298</guid>
      <dc:creator>john_combo</dc:creator>
      <dc:date>2026-02-07T15:44:57Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic. Inventor 2020 Professional</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-inventor-2020-professional/m-p/14008651#M179299</link>
      <description>&lt;P&gt;I can do this manually without any issues. But I seriously doubt I can keep doing it when I’ve got 200 files.&lt;/P&gt;</description>
      <pubDate>Sat, 07 Feb 2026 15:55:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-inventor-2020-professional/m-p/14008651#M179299</guid>
      <dc:creator>john_combo</dc:creator>
      <dc:date>2026-02-07T15:55:43Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic. Inventor 2020 Professional</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-inventor-2020-professional/m-p/14008663#M179300</link>
      <description>&lt;P&gt;Right now I’m trying a different approach: I select the face with the largest area, create a sketch on it by projecting the geometry, and then I try to export that sketch as a DXF. I’ll share the results a bit later.&lt;/P&gt;</description>
      <pubDate>Sat, 07 Feb 2026 16:14:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-inventor-2020-professional/m-p/14008663#M179300</guid>
      <dc:creator>john_combo</dc:creator>
      <dc:date>2026-02-07T16:14:03Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic. Inventor 2020 Professional</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-inventor-2020-professional/m-p/14008677#M179301</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;Are these files sheet metal parts?&lt;/P&gt;</description>
      <pubDate>Sat, 07 Feb 2026 16:21:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-inventor-2020-professional/m-p/14008677#M179301</guid>
      <dc:creator>kacper.suchomski</dc:creator>
      <dc:date>2026-02-07T16:21:04Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic. Inventor 2020 Professional</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-inventor-2020-professional/m-p/14008714#M179302</link>
      <description>&lt;P&gt;No — it’s just a regular flat part. It’s not sheet metal.&lt;/P&gt;</description>
      <pubDate>Sat, 07 Feb 2026 17:12:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-inventor-2020-professional/m-p/14008714#M179302</guid>
      <dc:creator>john_combo</dc:creator>
      <dc:date>2026-02-07T17:12:25Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic. Inventor 2020 Professional</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-inventor-2020-professional/m-p/14008721#M179303</link>
      <description>&lt;P&gt;check this relevant post:&lt;A href="https://forums.autodesk.com/t5/inventor-programming-forum/export-face-as-dxf/m-p/12269275" target="_blank"&gt;&amp;nbsp;Solved: Export Face As DXF - Autodesk Community&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Feb 2026 17:25:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-inventor-2020-professional/m-p/14008721#M179303</guid>
      <dc:creator>jnowel</dc:creator>
      <dc:date>2026-02-07T17:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic. Inventor 2020 Professional</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-inventor-2020-professional/m-p/14009148#M179304</link>
      <description>&lt;P&gt;Thanks for your reply — I’ll take a short break to verify the info and then I’ll come back here with an update.&lt;/P&gt;</description>
      <pubDate>Sun, 08 Feb 2026 09:20:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-inventor-2020-professional/m-p/14009148#M179304</guid>
      <dc:creator>john_combo</dc:creator>
      <dc:date>2026-02-08T09:20:57Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic. Inventor 2020 Professional</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-inventor-2020-professional/m-p/14009457#M179305</link>
      <description>&lt;P&gt;Thanks — your answer really helped me! I was able to figure it out and fix the mistakes in my code. Now I’m getting the result I expected — awesome!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;' Selecting the largest face
Dim selectSet As Inventor.SelectSet = partDoc.SelectSet
selectSet.Clear()
selectSet.Select(maxFace)

' Export via the GeomToDXFCommand
Dim dxfPath As String = System.IO.Path.Combine(dxfFolder, System.IO.Path.GetFileNameWithoutExtension(partPath) &amp;amp; ".dxf")
Dim exportStatus As String = ExportFaceViaGeomToDXF(dxfPath, dxfFolder)

' New export function
Private Function ExportFaceViaGeomToDXF(dxfPath As String, dxfFolder As String) As String
    Dim cmdMgr As Inventor.CommandManager = ThisApplication.CommandManager
    Dim exportDef As Inventor.ControlDefinition = Nothing

    Try
        exportDef = cmdMgr.ControlDefinitions.Item("GeomToDXFCommand")
    Catch ex As System.Exception
        Dim listPath As String = System.IO.Path.Combine(dxfFolder, "_command_names.txt")
        WriteControlDefinitionsList(listPath)
        Return "GeomToDXFCommand not found, commands: " &amp;amp; listPath
    End Try

    Try
        cmdMgr.PostPrivateEvent(Inventor.PrivateEventTypeEnum.kFileNameEvent, dxfPath)
        exportDef.Execute()
    Catch ex As System.Exception
        Return "Error of GeomToDXFCommand: " &amp;amp; ex.Message
    End Try

    Return "GeomToDXFCommand started (file: " &amp;amp; dxfPath &amp;amp; ")"
End Function&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 08 Feb 2026 20:14:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-inventor-2020-professional/m-p/14009457#M179305</guid>
      <dc:creator>john_combo</dc:creator>
      <dc:date>2026-02-08T20:14:49Z</dc:date>
    </item>
  </channel>
</rss>

