<?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 Export parts list not working in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/export-parts-list-not-working/m-p/9776554#M57690</link>
    <description>&lt;P&gt;I have the link below explaining how to export a parts list to excel.&lt;BR /&gt;&lt;A href="https://clintbrown.co.uk/2020/07/18/export-formatted-parts-list-with-ilogic/" target="_blank"&gt;https://clintbrown.co.uk/2020/07/18/export-formatted-parts-list-with-ilogic/&lt;/A&gt;&lt;BR /&gt;I have placed all files in the correct folder C: \ TEMP.&lt;BR /&gt;I have placed the code in my assy and have not changed anything.&lt;BR /&gt;When I run the code from the assy I don't get an error.&lt;BR /&gt;The folder Parts Lists is created.&lt;BR /&gt;The Template-Export Parts List.dwg does not open.&lt;BR /&gt;No parts list is placed temporarily either.&lt;BR /&gt;Nothing else happens and the assy is closed.&lt;BR /&gt;I hope someone has an idea what I am doing wrong or am I missing something.&lt;BR /&gt;I may have to change something in the code.&lt;BR /&gt;What I do wonder is how the code knows which parts list to use.&lt;BR /&gt;According to the explanation, the parts list called 'Unofficial' should be used.&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 13:31:24 GMT</pubDate>
    <dc:creator>jostroopers</dc:creator>
    <dc:date>2020-09-30T13:31:24Z</dc:date>
    <item>
      <title>Export parts list not working</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/export-parts-list-not-working/m-p/9776554#M57690</link>
      <description>&lt;P&gt;I have the link below explaining how to export a parts list to excel.&lt;BR /&gt;&lt;A href="https://clintbrown.co.uk/2020/07/18/export-formatted-parts-list-with-ilogic/" target="_blank"&gt;https://clintbrown.co.uk/2020/07/18/export-formatted-parts-list-with-ilogic/&lt;/A&gt;&lt;BR /&gt;I have placed all files in the correct folder C: \ TEMP.&lt;BR /&gt;I have placed the code in my assy and have not changed anything.&lt;BR /&gt;When I run the code from the assy I don't get an error.&lt;BR /&gt;The folder Parts Lists is created.&lt;BR /&gt;The Template-Export Parts List.dwg does not open.&lt;BR /&gt;No parts list is placed temporarily either.&lt;BR /&gt;Nothing else happens and the assy is closed.&lt;BR /&gt;I hope someone has an idea what I am doing wrong or am I missing something.&lt;BR /&gt;I may have to change something in the code.&lt;BR /&gt;What I do wonder is how the code knows which parts list to use.&lt;BR /&gt;According to the explanation, the parts list called 'Unofficial' should be used.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 13:31:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/export-parts-list-not-working/m-p/9776554#M57690</guid>
      <dc:creator>jostroopers</dc:creator>
      <dc:date>2020-09-30T13:31:24Z</dc:date>
    </item>
    <item>
      <title>Re: Export parts list not working</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/export-parts-list-not-working/m-p/9778071#M57691</link>
      <description>&lt;P&gt;Hi &lt;SPAN class="UserName lia-user-name lia-user-rank-Collaborator lia-component-message-view-widget-author-username"&gt;&lt;A href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/386826" target="_self"&gt;&lt;SPAN class=""&gt;jostroopers&lt;/SPAN&gt;&lt;/A&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What version of Inventor are you running? The code only works with Inventor 2021, as the template drawing is set up in 2021 format.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you are using 2021, make sure that you "unblock" the files before running the code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Oct 2020 06:17:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/export-parts-list-not-working/m-p/9778071#M57691</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-10-01T06:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: Export parts list not working</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/export-parts-list-not-working/m-p/9778269#M57692</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for youre reaction.&lt;/P&gt;&lt;P&gt;I work with Inventor 2021.&lt;/P&gt;&lt;P&gt;And no, i didn't unlock the zip file.&lt;/P&gt;&lt;P&gt;But after i first unlock the zip file and placed them in the TEMP folder its still not working.&lt;/P&gt;&lt;P&gt;Its only makes the folder Parts List and nothing is placed in there.&lt;/P&gt;&lt;P&gt;In Inventor i get the &lt;SPAN&gt;MsgBox&lt;/SPAN&gt;(&lt;SPAN&gt;"We've encountered a mystery"&lt;/SPAN&gt;) and the assy close.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Oct 2020 08:31:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/export-parts-list-not-working/m-p/9778269#M57692</guid>
      <dc:creator>jostroopers</dc:creator>
      <dc:date>2020-10-01T08:31:32Z</dc:date>
    </item>
    <item>
      <title>Re: Export parts list not working</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/export-parts-list-not-working/m-p/9778351#M57693</link>
      <description>&lt;P&gt;I've just tested this on my system. It works on most assemblies, have you tried this on any other assemblies?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do have one assembly that seems to behave as you explain.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems that if there are any issues in the file, that the Parts list code will not run as expected. In my example, if I go to "Manage", then "Rebuild All", there are issues with mates.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="@ClintBrown3D Autodesk Inventor 184.png" style="width: 544px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/825938i461CE2B0E2B3D69C/image-size/large?v=v2&amp;amp;px=999" role="button" title="@ClintBrown3D Autodesk Inventor 184.png" alt="@ClintBrown3D Autodesk Inventor 184.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once these are tidied up, everything works as expected.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Oct 2020 09:32:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/export-parts-list-not-working/m-p/9778351#M57693</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-10-01T09:32:10Z</dc:date>
    </item>
    <item>
      <title>Re: Export parts list not working</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/export-parts-list-not-working/m-p/9778489#M57694</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My first assy had no issues.&lt;/P&gt;&lt;P&gt;But i took another simple assy with no issues.&lt;BR /&gt;I manually placed a parts list in the template, Template-Export Parts List.dwg.&lt;BR /&gt;I found out that I couldn't post the parts list because the BOM view was disabled. After I had adjusted that in the assy I was able to place the parts list. Then I ran the code again but it didn't work yet.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Oct 2020 10:44:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/export-parts-list-not-working/m-p/9778489#M57694</guid>
      <dc:creator>jostroopers</dc:creator>
      <dc:date>2020-10-01T10:44:16Z</dc:date>
    </item>
    <item>
      <title>Re: Export parts list not working</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/export-parts-list-not-working/m-p/10143052#M57695</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/386826"&gt;@jostroopers&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've experienced exactly the same behavior today, but after a quick look into the code I noticed that the part responsible for creation of drawing, inserting view and starting Export rule is missing.&lt;/P&gt;&lt;P&gt;If you look into Clint's blog post you will see that both parts of the provided code are the same (obvious editiorial issue). So, I've carefully watched the “Explainer” video attached to the blog post and there it is &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In order to export BOM, use the code shown below in an Assembly and follow all the instructions from the blog:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;'Assembly File code from Clint Brown's blog video https://www.youtube.com/watch?v=OIX0jM0KmZY&amp;amp;t=2s

'Check if this is an Assembly File
UnofficialInventor = ThisApplication.ActiveDocument
If UnofficialInventor.DocumentType &amp;lt;&amp;gt; kAssemblyDocumentObject Then
MessageBox.Show ("This rule can only be run in an Assembly File =&amp;gt; Exiting Rule", "Unofficial Inventor")
Return
End If

'This bit of code is adapted from sample by Mike Deck 
'Originally posted here: https://forums.autodesk.com/t5/inventor-customization/ilogic-coding-to-create-automated-drawing/td-p/3331455
oPathForDWGTemplate = "C:\TEMP\Template - Export Parts List.dwg"

Dim oDrawingDoc As DrawingDocument
oDrawingDoc = ThisApplication.Documents.Add(kDrawingDocumentObject, oPathForDWGTemplate, True)
Dim oSheet As Sheet
Dim oTG As TransientGeometry
Dim oView1 As DrawingView

'In parts and assemblies - Write file name and path to temp text file
oWrite = System.IO.File.CreateText("C:\TEMP\part1.txt")
oWrite.WriteLine(ThisDoc.FileName(False))
oWrite.Close()

oAssyDoc = ThisDoc.Document
oSheet = oDrawingDoc.Sheets.Item(1)
oPoint1 = ThisApplication.TransientGeometry.CreatePoint2d(10, 10)
oBaseView = oSheet.DrawingViews.AddBaseView(oAssyDoc, oPoint1, 1/100, kFrontViewOrientation, kHiddenLineDrawingViewStyle)
Call ThisApplication.CommandManager.ControlDefinitions.Item("iLogic.RegenAllRules").Execute 'This re-generates the "Export" Rule. &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the "Export" rule for template I had to add one extra line to pull out the "Unofficial" Part List style.&lt;BR /&gt;I did it because even if I purged all the styles except "Unofficial" it was not working properly in my case.&lt;BR /&gt;You can also see a small addition to the original code used for debugging (Trace.WriteLine trick found here: &lt;A href="https://adndevblog.typepad.com/manufacturing/2014/08/debug-ilogic.html)" target="_blank"&gt;https://adndevblog.typepad.com/manufacturing/2014/08/debug-ilogic.html)&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Imports System.Diagnostics ' Needed for trace messages
oOptions = ThisApplication.TransientObjects.CreateNameValueMap 'Create a new NameValueMap object

'iLogic Utility by @ClintBrown3D originally posted here --&amp;gt; https://clintbrown.co.uk/export-formatted-parts-list-with-ilogic
'Parts list placement from Autodesk Inventor API samples
'Parts list export based on Curtis Waguespack's blog post --&amp;gt; https://inventortrenches.blogspot.com/2011/06/ilogic-export-parts-list-with-options.html


'XLS SETUP--------------------------------------------------------------XLS SETUP---------------------------------------------------------------------------XLS SETUP
oOptions.Value("Template") = "C:\Temp\PartListExport.xlsx" 'Specify an existing template file  'use it for formatting colors, fonts, etc
oExcelSaveLocation = "C:\Temp\Parts Lists\" 'Make sure path has "\" at end -&amp;gt; eg C:\Temp\Parts Lists\

'Create XLS Parts List folder
If (Not System.IO.Directory.Exists(oExcelSaveLocation)) Then 
	System.IO.Directory.CreateDirectory(oExcelSaveLocation) 
End If 
 
'specify the columns to export         
oOptions.Value("ExportedColumns") = "ITEM;QTY;PART NUMBER;DESCRIPTION;MATERIAL;MASS" 'These Must match what is shown on the drawing!!!
 
'specify the start cell
oOptions.Value("StartingCell") = "A2"

'choose to include the parts list title row
oOptions.Value("IncludeTitle") = True          

'choose to autofit the column width in the xls file
oOptions.Value("AutoFitColumnWidth") = True 

'XLS SETUP--------------------------------------------------------------XLS SETUP---------------------------------------------------------------------------XLS SETUP

Dim oDrawDoc As DrawingDocument 'Set a reference to the drawing document.' This assumes a drawing document is active
oDrawDoc = ThisApplication.ActiveDocument

Dim oSheet As Sheet 'Set a reference to the active sheet.
oSheet = oDrawDoc.ActiveSheet

Dim oDrawingView As DrawingView 'Set a reference to the first drawing view on' the sheet. This assumes the first drawing' view on the sheet is not a draft view.
oDrawingView = oSheet.DrawingViews(1)

Dim oBorder As Border 'Set a reference to th sheet's border
oBorder = oSheet.Border

Dim oPlacementPoint As Point2d

If Not oBorder Is Nothing Then 'A border exists. The placement point' is the top-right corner of the border
oPlacementPoint = oBorder.RangeBox.MaxPoint
Else' There is no border. The placement point is the top-right corner of the sheet.
oPlacementPoint = ThisApplication.TransientGeometry.CreatePoint2d(oSheet.Width, oSheet.Height)
End If

Dim oPartsList As PartsList 'Create the parts list.
oPartsList = oSheet.PartsLists.Add(oDrawingView, oPlacementPoint)

			'Set parts list to a specific style
			oPartsList.Style = oDrawDoc.StylesManager.PartsListStyles.Item("Unofficial")
			Trace.WriteLine("Part List formatted successfully")
ThisDoc.Document.SaveAs("C:\Temp\DeleteMe2.dwg", False)
			Trace.WriteLine("DWG saved")		
oRead = System.IO.File.OpenText("C:\TEMP\part1.txt") 'Get Original Assembly file name
EntireFile1 = oRead.ReadLine()
oRead.Close()
oDrawingName = EntireFile1
			Trace.WriteLine("Assembly name received")
oDoc = ThisDoc.Document 'Define oDoc
path_and_name = oExcelSaveLocation + oDrawingName
			
'Specify the drawing sheet
oSheet = oDoc.Sheets("Sheet:1") 'Select sheet by name
oPartsList = oSheet.PartsLists(1) 'Say there is a Partslist on the sheet.

			If Dir(path_and_name &amp;amp; ".xlsx") &amp;lt;&amp;gt; "" Then 
			Kill(path_and_name &amp;amp; ".xlsx") 
			Else
			End If 'Check for existing XLS file and delete it if found
'On Error GoTo ClintsErrorTrap
			Trace.WriteLine("Prepared to export to Excel")
oPartsList.Export(path_and_name &amp;amp; ".xlsx", PartsListFileFormatEnum.kMicrosoftExcel, oOptions ) 'Export the Partslist to Excel with options
			Trace.WriteLine("Exported to Excel")
ThisDoc.Launch(path_and_name &amp;amp; ".xlsx")	'Open Parts List
ThisDoc.Document.Close(True)
		
'Return
	
	'ClintsErrorTrap :
	'MsgBox("We've encountered a mystery")
	'ThisDoc.Document.Close(True)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;@Anonymous&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for the effort you put into creation of Unofficial Inventor Blog!&lt;BR /&gt;It is pity you will no longer publish there.&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;</description>
      <pubDate>Tue, 09 Mar 2021 19:27:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/export-parts-list-not-working/m-p/10143052#M57695</guid>
      <dc:creator>M.Hawryluk</dc:creator>
      <dc:date>2021-03-09T19:27:42Z</dc:date>
    </item>
    <item>
      <title>Re: Export parts list not working</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/export-parts-list-not-working/m-p/10143619#M57696</link>
      <description>&lt;P&gt;Maybe you have a permission issue on c: or the temp folder should not be TEMP but Temp&lt;/P&gt;</description>
      <pubDate>Tue, 09 Mar 2021 22:40:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/export-parts-list-not-working/m-p/10143619#M57696</guid>
      <dc:creator>bradeneuropeArthur</dc:creator>
      <dc:date>2021-03-09T22:40:34Z</dc:date>
    </item>
  </channel>
</rss>

