<?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 Get parts image in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/get-parts-image/m-p/11726748#M27377</link>
    <description>&lt;P&gt;Hey there!&lt;BR /&gt;I want to get image (screenshot) of each parts in assembly, and save all of these with definity name. I wrote the code to&amp;nbsp;&lt;SPAN&gt;enumeration&amp;nbsp;of all components in the assembly (with several levels). Can iLogic&amp;nbsp;refer to the component (for example with name "PartA:1") , set parameter ActiveView.Camera and get image? Or may be refer to part with name "PartA.ipt"...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The code with enumeration of all components is shown below.&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Sub Main()
	
Dim oAsmDoc As AssemblyDocument
oAsmDoc = ThisApplication.ActiveDocument


Call TraverseAsm(oAsmDoc.ComponentDefinition.Occurrences, 1)
End Sub


Sub TraverseAsm(oOccurrences As ComponentOccurrences, Level As Integer)
	

	Dim oOcc As ComponentOccurrence
	For Each oOcc In oOccurrences
		Name= oOcc.Name
		

		If oOcc.DefinitionDocumentType = kAssemblyDocumentObject Then
			Call TraverseAsm(oOcc.SubOccurrences, Level + 1)
		End If
	Next
	GoExcel.Save
End Sub


	&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 03 Feb 2023 08:43:49 GMT</pubDate>
    <dc:creator>orhan.alihanov</dc:creator>
    <dc:date>2023-02-03T08:43:49Z</dc:date>
    <item>
      <title>Get parts image</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/get-parts-image/m-p/11726748#M27377</link>
      <description>&lt;P&gt;Hey there!&lt;BR /&gt;I want to get image (screenshot) of each parts in assembly, and save all of these with definity name. I wrote the code to&amp;nbsp;&lt;SPAN&gt;enumeration&amp;nbsp;of all components in the assembly (with several levels). Can iLogic&amp;nbsp;refer to the component (for example with name "PartA:1") , set parameter ActiveView.Camera and get image? Or may be refer to part with name "PartA.ipt"...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The code with enumeration of all components is shown below.&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Sub Main()
	
Dim oAsmDoc As AssemblyDocument
oAsmDoc = ThisApplication.ActiveDocument


Call TraverseAsm(oAsmDoc.ComponentDefinition.Occurrences, 1)
End Sub


Sub TraverseAsm(oOccurrences As ComponentOccurrences, Level As Integer)
	

	Dim oOcc As ComponentOccurrence
	For Each oOcc In oOccurrences
		Name= oOcc.Name
		

		If oOcc.DefinitionDocumentType = kAssemblyDocumentObject Then
			Call TraverseAsm(oOcc.SubOccurrences, Level + 1)
		End If
	Next
	GoExcel.Save
End Sub


	&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 08:43:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/get-parts-image/m-p/11726748#M27377</guid>
      <dc:creator>orhan.alihanov</dc:creator>
      <dc:date>2023-02-03T08:43:49Z</dc:date>
    </item>
    <item>
      <title>Re: Get parts image</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/get-parts-image/m-p/11727736#M27378</link>
      <description>&lt;P&gt;&lt;A href="https://modthemachine.typepad.com/my_weblog/2010/06/accessing-thumbnail-images.html" target="_blank" rel="noopener"&gt;Here is an article&lt;/A&gt; that explains how to do this for one document. The thumbnail is kept as an iproperty.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 15:38:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/get-parts-image/m-p/11727736#M27378</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2023-02-03T15:38:26Z</dc:date>
    </item>
    <item>
      <title>Re: Get parts image</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/get-parts-image/m-p/11728095#M27379</link>
      <description>Thanks for reply! But how is this supposed to help me? I can't call iProperty with thumbnail</description>
      <pubDate>Fri, 03 Feb 2023 17:32:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/get-parts-image/m-p/11728095#M27379</guid>
      <dc:creator>orhan.alihanov</dc:creator>
      <dc:date>2023-02-03T17:32:52Z</dc:date>
    </item>
    <item>
      <title>Re: Get parts image</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/get-parts-image/m-p/11728450#M27380</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5812729"&gt;@orhan.alihanov&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've seen a few people asking about this recently.&amp;nbsp; I've looked into the Thumbnail extraction a little, but have not gotten the conversion of IPictureDisp to an actual image working in VB.net iLogic.&amp;nbsp; The camera method is likely not the best for large assemblies because each file needs to be open and visible in the graphics window for the camera to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With that in mind, this is a rule that uses the camera method:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub Main
	'Setup
	Dim SaveName As String
	Dim NewPath As String 
	Dim ThisFile As String
	Dim PictureFileType As String = ".jpg"

	Dim pDoc As PartDocument = TryCast(InventorVb.Application.ActiveDocument, PartDocument)
	If Not IsNothing(pDoc) 
		'Set Path
		NewPath = System.IO.Path.GetDirectoryName(pDoc.FullFileName) &amp;amp; "\"
		ThisFile = System.IO.Path.GetFileNameWithoutExtension(pDoc.FullDocumentName)
		SaveName = NewPath &amp;amp; ThisFile &amp;amp; PictureFileType
		'Call Capture Sub
		CaptureImage(SaveName)

	Else 'it is not a part document
		Dim aDoc As AssemblyDocument = TryCast(InventorVb.Application.ActiveDocument, AssemblyDocument)
		If IsNothing(aDoc) Then Exit Sub
		'Set Path
		NewPath = System.IO.Path.GetDirectoryName(aDoc.FullFileName) &amp;amp; "\"
		ThisFile = System.IO.Path.GetFileNameWithoutExtension(aDoc.FullDocumentName)
		SaveName = NewPath &amp;amp; ThisFile &amp;amp; PictureFileType 
		'Call Capture Sub for assembly
		CaptureImage(SaveName)
		
		'Cycle Through all referenced documents
		For Each refDoc As Document In aDoc.ReferencedDocuments
			'make sure referenced document exists as a component in the assembly
			If aDoc.ComponentDefinition.Occurrences.AllReferencedOccurrences(refDoc).Count &amp;lt; 1 Then Continue For
			'Activate Referenced Document
			Dim alreadyopen As Boolean = IsVisibleOpen(refDoc, InventorVb.Application.Documents.VisibleDocuments)
			If Not alreadyopen 
				InventorVb.Application.Documents.Open(refDoc.FullDocumentName, True)
			Else
				refDoc.Activate()
			End If
			'Set FileName
			ThisFile = System.IO.Path.GetFileNameWithoutExtension(refDoc.FullDocumentName)
			SaveName = NewPath &amp;amp; ThisFile &amp;amp; PictureFileType 
			'Call Capture Sub
			CaptureImage(SaveName)
			'Return to assembly document [Also, close opened document if This rule opened it]
			If Not alreadyopen 
				refDoc.Close(True)'Skip Save
			Else
				aDoc.Activate()
			End If
		Next
	End If

End Sub

Sub CaptureImage(SaveName As String)
	'Save pic
    oCamera = InventorVb.Application.ActiveView.Camera
    oCamera.Fit
    oCamera.Apply
    oCamera.SaveAsBitmap(SaveName, 300, 300)
End Sub

Function IsVisibleOpen(oDoc As Document, DocumentCollection As Object) As Boolean
	
	For Each Item In DocumentCollection
		If Item Is oDoc Then Return True
	Next
	
	Return False
	
End Function&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 19:54:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/get-parts-image/m-p/11728450#M27380</guid>
      <dc:creator>J-Camper</dc:creator>
      <dc:date>2023-02-03T19:54:10Z</dc:date>
    </item>
    <item>
      <title>Re: Get parts image</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/get-parts-image/m-p/11728581#M27381</link>
      <description>Thank you very much! You helped me a lot!</description>
      <pubDate>Fri, 03 Feb 2023 20:52:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/get-parts-image/m-p/11728581#M27381</guid>
      <dc:creator>orhan.alihanov</dc:creator>
      <dc:date>2023-02-03T20:52:30Z</dc:date>
    </item>
    <item>
      <title>Re: Get parts image</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/get-parts-image/m-p/13150195#M27382</link>
      <description>&lt;P&gt;Hi Can we get 2D images of assembly part without changing the scale of the assembly and part. I want this to show the exploded view assembly image with balloon and part no.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 12:07:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/get-parts-image/m-p/13150195#M27382</guid>
      <dc:creator>2020mme013</dc:creator>
      <dc:date>2024-11-14T12:07:45Z</dc:date>
    </item>
    <item>
      <title>Re: Get parts image</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/get-parts-image/m-p/13150202#M27383</link>
      <description>&lt;P&gt;Just like attached screenshot.&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="2020mme013_0-1731586242053.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1433777iFBC2E5BA96570B5B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="2020mme013_0-1731586242053.png" alt="2020mme013_0-1731586242053.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 12:11:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/get-parts-image/m-p/13150202#M27383</guid>
      <dc:creator>2020mme013</dc:creator>
      <dc:date>2024-11-14T12:11:42Z</dc:date>
    </item>
  </channel>
</rss>

