<?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 Description Iproperty behind export file name in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/description-iproperty-behind-export-file-name/m-p/10895943#M41179</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using the code below to batch export my drawings, which works very good.&amp;nbsp;&lt;BR /&gt;Now I want to add the description of a part behind the file name.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm convinced I should add 0description behind this part of the code but it doesn't work.&amp;nbsp;&lt;BR /&gt;Can someone help me in this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;oPDFDataMedium.FileName = oFolder + "\" + oFileName + "pdf"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub Main
	'get the main assembly document
	Dim oADoc As AssemblyDocument = ThisApplication.ActiveDocument
	'run the Sub below on the main assembly
	ExportDrawingToPDF(oADoc)

	'Peruse each document in generated Documents list.
	For Each oRefDoc As Document In oADoc.AllReferencedDocuments
		'run the Sub below on each referenced document
		ExportDrawingToPDF(oRefDoc)
	Next
End Sub

Sub ExportDrawingToPDF(oDoc As Document)
	'Set Folder options as you see fit here
	oFolder = ThisDoc.Path + "\" ']

	'PDF Options
	oAddIns = ThisApplication.ApplicationAddIns
	Dim PDFAddIn As TranslatorAddIn = oAddIns.ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
	oTO = ThisApplication.TransientObjects
	oPDFContext = oTO.CreateTranslationContext
	oPDFContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
	oPDFOptions = oTO.CreateNameValueMap
	oPDFDataMedium = oTO.CreateDataMedium
	oPDFOptions.Value("All_Color_AS_Black") = 0
	oPDFOptions.Value("Remove_Line_Weights") = 1
	oPDFOptions.Value("Vector_Resolution") = 4800
	oPDFOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets

	'Generate text string of .idw file to look for in the same folder as component file.
	idwPathName = Left(oDoc.FullDocumentName, Len(oDoc.FullDocumentName) - 3) &amp;amp; "idw"

	'Check if generated drawing file name exists.
	If System.IO.File.Exists(idwPathName) Then
		'Open drawing file.
		Dim oDrawDoc As DrawingDocument = ThisApplication.Documents.Open(idwPathName, True)
		'get the value of the description iProperty, within the drawing
		Dim oDescription As String = oDrawDoc.PropertySets.Item("Design Tracking Properties").Item("Description").Value
		'Remove idw extension for PDF save.
		oFileName = Left(oDoc.DisplayName, Len(oDoc.DisplayName) - 3)
		'Generate text string of idw name and folder location.
		oPDFDataMedium.FileName = oFolder + "\" + oFileName + "pdf"
		'Save PDF Copy.
		PDFAddIn.SaveCopyAs(oDrawDoc, oPDFContext, oPDFOptions, oPDFDataMedium)
		'Close drawing file.
		oDrawDoc.Close(True)
	End If
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 21 Jan 2022 11:11:52 GMT</pubDate>
    <dc:creator>jesserop</dc:creator>
    <dc:date>2022-01-21T11:11:52Z</dc:date>
    <item>
      <title>Description Iproperty behind export file name</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/description-iproperty-behind-export-file-name/m-p/10895943#M41179</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using the code below to batch export my drawings, which works very good.&amp;nbsp;&lt;BR /&gt;Now I want to add the description of a part behind the file name.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm convinced I should add 0description behind this part of the code but it doesn't work.&amp;nbsp;&lt;BR /&gt;Can someone help me in this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;oPDFDataMedium.FileName = oFolder + "\" + oFileName + "pdf"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub Main
	'get the main assembly document
	Dim oADoc As AssemblyDocument = ThisApplication.ActiveDocument
	'run the Sub below on the main assembly
	ExportDrawingToPDF(oADoc)

	'Peruse each document in generated Documents list.
	For Each oRefDoc As Document In oADoc.AllReferencedDocuments
		'run the Sub below on each referenced document
		ExportDrawingToPDF(oRefDoc)
	Next
End Sub

Sub ExportDrawingToPDF(oDoc As Document)
	'Set Folder options as you see fit here
	oFolder = ThisDoc.Path + "\" ']

	'PDF Options
	oAddIns = ThisApplication.ApplicationAddIns
	Dim PDFAddIn As TranslatorAddIn = oAddIns.ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
	oTO = ThisApplication.TransientObjects
	oPDFContext = oTO.CreateTranslationContext
	oPDFContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
	oPDFOptions = oTO.CreateNameValueMap
	oPDFDataMedium = oTO.CreateDataMedium
	oPDFOptions.Value("All_Color_AS_Black") = 0
	oPDFOptions.Value("Remove_Line_Weights") = 1
	oPDFOptions.Value("Vector_Resolution") = 4800
	oPDFOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets

	'Generate text string of .idw file to look for in the same folder as component file.
	idwPathName = Left(oDoc.FullDocumentName, Len(oDoc.FullDocumentName) - 3) &amp;amp; "idw"

	'Check if generated drawing file name exists.
	If System.IO.File.Exists(idwPathName) Then
		'Open drawing file.
		Dim oDrawDoc As DrawingDocument = ThisApplication.Documents.Open(idwPathName, True)
		'get the value of the description iProperty, within the drawing
		Dim oDescription As String = oDrawDoc.PropertySets.Item("Design Tracking Properties").Item("Description").Value
		'Remove idw extension for PDF save.
		oFileName = Left(oDoc.DisplayName, Len(oDoc.DisplayName) - 3)
		'Generate text string of idw name and folder location.
		oPDFDataMedium.FileName = oFolder + "\" + oFileName + "pdf"
		'Save PDF Copy.
		PDFAddIn.SaveCopyAs(oDrawDoc, oPDFContext, oPDFOptions, oPDFDataMedium)
		'Close drawing file.
		oDrawDoc.Close(True)
	End If
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jan 2022 11:11:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/description-iproperty-behind-export-file-name/m-p/10895943#M41179</guid>
      <dc:creator>jesserop</dc:creator>
      <dc:date>2022-01-21T11:11:52Z</dc:date>
    </item>
    <item>
      <title>Re: Description Iproperty behind export file name</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/description-iproperty-behind-export-file-name/m-p/10896170#M41180</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Try to replace the two corresponding lines by these:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;		&lt;SPAN&gt;oFileName&lt;/SPAN&gt; = &lt;SPAN&gt;Left&lt;/SPAN&gt;(&lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;DisplayName&lt;/SPAN&gt;, &lt;SPAN&gt;Len&lt;/SPAN&gt;(&lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;DisplayName&lt;/SPAN&gt;) - &lt;STRONG&gt;4&lt;/STRONG&gt;)
		
		&lt;SPAN&gt;oPDFDataMedium&lt;/SPAN&gt;.&lt;SPAN&gt;FileName&lt;/SPAN&gt; = &lt;SPAN&gt;oFolder&lt;/SPAN&gt; + &lt;SPAN&gt;"\"&lt;/SPAN&gt; + &lt;SPAN&gt;oFileName&lt;/SPAN&gt; &lt;STRONG&gt;+ oDescription&lt;/STRONG&gt; + &lt;SPAN&gt;".pdf"&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;Hope this can help you.&lt;/P&gt;&lt;P&gt;Vincent.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jan 2022 13:23:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/description-iproperty-behind-export-file-name/m-p/10896170#M41180</guid>
      <dc:creator>vpeuvion</dc:creator>
      <dc:date>2022-01-21T13:23:47Z</dc:date>
    </item>
    <item>
      <title>Re: Description Iproperty behind export file name</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/description-iproperty-behind-export-file-name/m-p/10896267#M41181</link>
      <description>&lt;P&gt;The part where you are adding in the 'Description' is OK, but subtracting 4 from the end of the DisplayName, instead of 3, then adding ".pdf" instead of "pdf" is just a trade off.&lt;/P&gt;
&lt;P&gt;However, since the variable oFolder was defined this way:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;oFolder = ThisDoc.Path + "\"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It already contains the 'directory separator' character, so I would leave that "\" out of your oPDFDataMedium.FileName line, which ever way you do it.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jan 2022 13:57:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/description-iproperty-behind-export-file-name/m-p/10896267#M41181</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2022-01-21T13:57:43Z</dc:date>
    </item>
    <item>
      <title>Re: Description Iproperty behind export file name</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/description-iproperty-behind-export-file-name/m-p/10896355#M41182</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried this before, the problem is that it picks the iproperties of te drawing instead of the part.&amp;nbsp;&lt;BR /&gt;Therefore i need to reach the part that is linked to the drawing.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;i'm aware that i can do this manually but since we are using vendor drawings a lot i want to reach the source iproperties if possible.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jan 2022 14:30:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/description-iproperty-behind-export-file-name/m-p/10896355#M41182</guid>
      <dc:creator>jesserop</dc:creator>
      <dc:date>2022-01-21T14:30:57Z</dc:date>
    </item>
    <item>
      <title>Re: Description Iproperty behind export file name</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/description-iproperty-behind-export-file-name/m-p/10896385#M41183</link>
      <description>&lt;P&gt;If you need to get the 'Description' iProperty value from the 'model' instead of from the drawing, then use the oDoc variable at the start of the line of code you are using to retrieve its value, instead of the oDrawDoc variable.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Dim oDescription As String = oDoc.PropertySets.Item("Design Tracking Properties").Item("Description").Value&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 21 Jan 2022 14:41:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/description-iproperty-behind-export-file-name/m-p/10896385#M41183</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2022-01-21T14:41:35Z</dc:date>
    </item>
  </channel>
</rss>

