<?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 for forming an Excel spreadsheet in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-for-forming-an-excel-spreadsheet/m-p/12258501#M158104</link>
    <description>&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;Help a beginner to complete the rule. You need to add a column in Excel the amount of sheet material. I haven't slept for the second day.Nothing works out. I hope for your help&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;'____Create and write to a text file_________________&lt;BR /&gt;Try&lt;BR /&gt;extension = ".csv"&lt;BR /&gt;If (System.IO.File.Exists(ThisDoc.PathAndFileName(False) + extension) = True) Then&lt;BR /&gt;System.IO.File.Delete(ThisDoc.PathAndFileName(False) + extension)&lt;BR /&gt;End If&lt;/P&gt;&lt;P&gt;sBom = ThisDoc.Document.ComponentDefinition.BOM&lt;BR /&gt;sBom.PartsOnlyViewEnabled = True&lt;BR /&gt;sBOMView = sBom.BOMViews.Item("Только детали")&lt;BR /&gt;Catch&lt;BR /&gt;MessageBox.Show("Ошибка 1", "Ошибка")&lt;BR /&gt;End Try&lt;BR /&gt;Try&lt;BR /&gt;For Each sRow In sBOMView.BOMRows&lt;BR /&gt;Try&lt;BR /&gt;sCompDef = sRow.ComponentDefinitions.Item(1)&lt;BR /&gt;&lt;BR /&gt;If sCompDef.Type = ObjectTypeEnum.kSheetMetalComponentDefinitionObject Then&lt;BR /&gt;Try&lt;BR /&gt;If sCompDef.HasFlatPattern = True Then&lt;BR /&gt;oFlat = sCompDef.FlatPattern&lt;BR /&gt;oStr = sCompDef.Document.DisplayName&lt;BR /&gt;oStr = oStr + ";" + (oFlat.Length * 10).ToString&lt;BR /&gt;oStr = oStr + ";" + (oFlat.Width * 10).ToString&lt;BR /&gt;oStr = oStr + ";" + (sCompDef.Thickness.Value * 10).ToString&lt;BR /&gt;oStr = oStr + ";" + (sCompDef.Material.Name).ToString&lt;BR /&gt;System.IO.File.AppendAllText(ThisDoc.PathAndFileName(False) + extension, oStr + vbNewLine, System.Text.Encoding.Default)&lt;BR /&gt;End If&lt;BR /&gt;Catch&lt;BR /&gt;MessageBox.Show("Ошибка 2", "Ошибка")&lt;BR /&gt;End Try&lt;BR /&gt;End If&lt;BR /&gt;Catch&lt;BR /&gt;MessageBox.Show("Ошибка 3", "Ошибка")&lt;BR /&gt;End Try&lt;BR /&gt;Next&lt;BR /&gt;Catch&lt;BR /&gt;MessageBox.Show("Ошибка 4", "Ошибка")&lt;BR /&gt;End Try&lt;BR /&gt;Try&lt;BR /&gt;ThisDoc.Launch(ThisDoc.PathAndFileName(False) + extension)&lt;BR /&gt;Catch&lt;BR /&gt;MessageBox.Show("Ошибка открытия файла", "Ошибка")&lt;BR /&gt;End Try&lt;/P&gt;</description>
    <pubDate>Fri, 22 Sep 2023 08:37:39 GMT</pubDate>
    <dc:creator>negutorthik</dc:creator>
    <dc:date>2023-09-22T08:37:39Z</dc:date>
    <item>
      <title>iLogic for forming an Excel spreadsheet</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-for-forming-an-excel-spreadsheet/m-p/12258501#M158104</link>
      <description>&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;Help a beginner to complete the rule. You need to add a column in Excel the amount of sheet material. I haven't slept for the second day.Nothing works out. I hope for your help&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;'____Create and write to a text file_________________&lt;BR /&gt;Try&lt;BR /&gt;extension = ".csv"&lt;BR /&gt;If (System.IO.File.Exists(ThisDoc.PathAndFileName(False) + extension) = True) Then&lt;BR /&gt;System.IO.File.Delete(ThisDoc.PathAndFileName(False) + extension)&lt;BR /&gt;End If&lt;/P&gt;&lt;P&gt;sBom = ThisDoc.Document.ComponentDefinition.BOM&lt;BR /&gt;sBom.PartsOnlyViewEnabled = True&lt;BR /&gt;sBOMView = sBom.BOMViews.Item("Только детали")&lt;BR /&gt;Catch&lt;BR /&gt;MessageBox.Show("Ошибка 1", "Ошибка")&lt;BR /&gt;End Try&lt;BR /&gt;Try&lt;BR /&gt;For Each sRow In sBOMView.BOMRows&lt;BR /&gt;Try&lt;BR /&gt;sCompDef = sRow.ComponentDefinitions.Item(1)&lt;BR /&gt;&lt;BR /&gt;If sCompDef.Type = ObjectTypeEnum.kSheetMetalComponentDefinitionObject Then&lt;BR /&gt;Try&lt;BR /&gt;If sCompDef.HasFlatPattern = True Then&lt;BR /&gt;oFlat = sCompDef.FlatPattern&lt;BR /&gt;oStr = sCompDef.Document.DisplayName&lt;BR /&gt;oStr = oStr + ";" + (oFlat.Length * 10).ToString&lt;BR /&gt;oStr = oStr + ";" + (oFlat.Width * 10).ToString&lt;BR /&gt;oStr = oStr + ";" + (sCompDef.Thickness.Value * 10).ToString&lt;BR /&gt;oStr = oStr + ";" + (sCompDef.Material.Name).ToString&lt;BR /&gt;System.IO.File.AppendAllText(ThisDoc.PathAndFileName(False) + extension, oStr + vbNewLine, System.Text.Encoding.Default)&lt;BR /&gt;End If&lt;BR /&gt;Catch&lt;BR /&gt;MessageBox.Show("Ошибка 2", "Ошибка")&lt;BR /&gt;End Try&lt;BR /&gt;End If&lt;BR /&gt;Catch&lt;BR /&gt;MessageBox.Show("Ошибка 3", "Ошибка")&lt;BR /&gt;End Try&lt;BR /&gt;Next&lt;BR /&gt;Catch&lt;BR /&gt;MessageBox.Show("Ошибка 4", "Ошибка")&lt;BR /&gt;End Try&lt;BR /&gt;Try&lt;BR /&gt;ThisDoc.Launch(ThisDoc.PathAndFileName(False) + extension)&lt;BR /&gt;Catch&lt;BR /&gt;MessageBox.Show("Ошибка открытия файла", "Ошибка")&lt;BR /&gt;End Try&lt;/P&gt;</description>
      <pubDate>Fri, 22 Sep 2023 08:37:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-for-forming-an-excel-spreadsheet/m-p/12258501#M158104</guid>
      <dc:creator>negutorthik</dc:creator>
      <dc:date>2023-09-22T08:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic for forming an Excel spreadsheet</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-for-forming-an-excel-spreadsheet/m-p/12262937#M158184</link>
      <description>&lt;P&gt;try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="visual-basic"&gt;Dim extension = ".csv"

Try

    If (System.IO.File.Exists(ThisDoc.PathAndFileName(False) + extension)) Then
        System.IO.File.Delete(ThisDoc.PathAndFileName(False) + extension)
    End If

    Dim sBom = ThisDoc.Document.ComponentDefinition.BOM
    sBom.PartsOnlyViewEnabled = True
    Dim sBOMView = sBom.BOMViews.Item("Только детали")

    For Each sRow As BOMRow In sBOMView.BOMRows
        Try
            Dim sCompDef = sRow.ComponentDefinitions.Item(1)

            If sCompDef.Type = ObjectTypeEnum.kSheetMetalComponentDefinitionObject Then
                Try
                    If sCompDef.HasFlatPattern Then
                        Dim oFlat = sCompDef.FlatPattern
                        Dim oStr = sCompDef.Document.DisplayName
                        oStr = oStr + ";" + (oFlat.Length * 10).ToString
                        oStr = oStr + ";" + (oFlat.Width * 10).ToString
                        oStr = oStr + ";" + (sCompDef.Thickness.Value * 10).ToString
                        oStr = oStr + ";" + (sCompDef.Material.Name).ToString
                        oStr = oStr + ";" + (sRow.ItemQuantity).ToString
                        System.IO.File.AppendAllText(ThisDoc.PathAndFileName(False) + extension, oStr + vbNewLine, System.Text.Encoding.Default)
                    End If
                Catch
                    MessageBox.Show("Ошибка 2", "Ошибка")
                End Try
            End If
        Catch
            MessageBox.Show("Ошибка 3", "Ошибка")
        End Try
    Next
Catch
    MessageBox.Show("Ошибка 4", "Ошибка")
End Try
Try
    ThisDoc.Launch(ThisDoc.PathAndFileName(False) + extension)
Catch
    MessageBox.Show("Ошибка открытия файла", "Ошибка")
End Try&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Sep 2023 19:53:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-for-forming-an-excel-spreadsheet/m-p/12262937#M158184</guid>
      <dc:creator>JelteDeJong</dc:creator>
      <dc:date>2023-09-24T19:53:28Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic for forming an Excel spreadsheet</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-for-forming-an-excel-spreadsheet/m-p/12262961#M158185</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12739490"&gt;@negutorthik&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It looks like you have posted multiple messages with the same topic. Please try not to do that as you end up with the same answer multiple times or no responses at all . If you need further assistance just respond to the same post which will bump it to the top. If possible include further information and the attempted code with error messages and a description of what the problem is and you will get better help to the questions asked.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Duplicate post1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/need-help-exporting-sheet-material-to-excel/m-p/12261505#M158172" target="_blank"&gt;https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/need-help-exporting-sheet-material-to-excel/m-p/12261505#M158172&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Duplicate post 2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/ilogic-for-forming-an-excel-spreadsheet/m-p/12259330#M158137" target="_blank"&gt;https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/ilogic-for-forming-an-excel-spreadsheet/m-p/12259330#M158137&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Sep 2023 20:15:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-for-forming-an-excel-spreadsheet/m-p/12262961#M158185</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2023-09-24T20:15:37Z</dc:date>
    </item>
  </channel>
</rss>

