<?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 adding components to an existing finish definition in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/adding-components-to-an-existing-finish-definition/m-p/13951545#M178669</link>
    <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an assembly with some parts (only first level). I created a finish, but because there is also a pattern I want to add all components / ocurrences / bodies /proxies... to this finish. but it does not work. can someone help me? thx.&lt;/P&gt;&lt;P&gt;my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Private Sub addComponentsToFinish(samenstelling As Inventor.AssemblyDocument)&lt;/P&gt;&lt;P&gt;Dim compAssyDef As Inventor.AssemblyComponentDefinition&lt;BR /&gt;compAssyDef = samenstelling.ComponentDefinition&lt;/P&gt;&lt;P&gt;Dim finishFeatures As FinishFeatures = compAssyDef.Features.FinishFeatures&lt;BR /&gt;Dim objCol As ObjectCollection = _inventorApplication.TransientObjects.CreateObjectCollection()&lt;/P&gt;&lt;P&gt;For Each finish As Inventor.FinishFeature In finishFeatures&lt;/P&gt;&lt;P&gt;finish.Definition.IncludedEntities.Clear()&lt;BR /&gt;'Controleer of het een FinishFeature is&lt;BR /&gt;If finish.Type = Inventor.ObjectTypeEnum.kFinishFeatureObject Then&lt;/P&gt;&lt;P&gt;For Each oCompOcc As Inventor.ComponentOccurrence In compAssyDef.Occurrences&lt;BR /&gt;Dim compDef As ComponentDefinition = CType(oCompOcc.Definition, ComponentDefinition)&lt;BR /&gt;For Each oBody As SurfaceBody In compDef.SurfaceBodies&lt;BR /&gt;Dim oBodyProxy As SurfaceBodyProxy = Nothing&lt;BR /&gt;oCompOcc.CreateGeometryProxy(oBody, oBodyProxy)&lt;BR /&gt;objCol.Add(oBody)&lt;BR /&gt;Next&lt;BR /&gt;Next&lt;BR /&gt;'finish.SetAffectedBodies(objCol) '??&lt;BR /&gt;finish.Definition.IncludedEntities.Add(objCol) '??&lt;BR /&gt;End If&lt;BR /&gt;Next&lt;BR /&gt;End Sub&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 19 Dec 2025 14:08:38 GMT</pubDate>
    <dc:creator>HermJan.Otterman</dc:creator>
    <dc:date>2025-12-19T14:08:38Z</dc:date>
    <item>
      <title>adding components to an existing finish definition</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/adding-components-to-an-existing-finish-definition/m-p/13951545#M178669</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an assembly with some parts (only first level). I created a finish, but because there is also a pattern I want to add all components / ocurrences / bodies /proxies... to this finish. but it does not work. can someone help me? thx.&lt;/P&gt;&lt;P&gt;my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Private Sub addComponentsToFinish(samenstelling As Inventor.AssemblyDocument)&lt;/P&gt;&lt;P&gt;Dim compAssyDef As Inventor.AssemblyComponentDefinition&lt;BR /&gt;compAssyDef = samenstelling.ComponentDefinition&lt;/P&gt;&lt;P&gt;Dim finishFeatures As FinishFeatures = compAssyDef.Features.FinishFeatures&lt;BR /&gt;Dim objCol As ObjectCollection = _inventorApplication.TransientObjects.CreateObjectCollection()&lt;/P&gt;&lt;P&gt;For Each finish As Inventor.FinishFeature In finishFeatures&lt;/P&gt;&lt;P&gt;finish.Definition.IncludedEntities.Clear()&lt;BR /&gt;'Controleer of het een FinishFeature is&lt;BR /&gt;If finish.Type = Inventor.ObjectTypeEnum.kFinishFeatureObject Then&lt;/P&gt;&lt;P&gt;For Each oCompOcc As Inventor.ComponentOccurrence In compAssyDef.Occurrences&lt;BR /&gt;Dim compDef As ComponentDefinition = CType(oCompOcc.Definition, ComponentDefinition)&lt;BR /&gt;For Each oBody As SurfaceBody In compDef.SurfaceBodies&lt;BR /&gt;Dim oBodyProxy As SurfaceBodyProxy = Nothing&lt;BR /&gt;oCompOcc.CreateGeometryProxy(oBody, oBodyProxy)&lt;BR /&gt;objCol.Add(oBody)&lt;BR /&gt;Next&lt;BR /&gt;Next&lt;BR /&gt;'finish.SetAffectedBodies(objCol) '??&lt;BR /&gt;finish.Definition.IncludedEntities.Add(objCol) '??&lt;BR /&gt;End If&lt;BR /&gt;Next&lt;BR /&gt;End Sub&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Dec 2025 14:08:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/adding-components-to-an-existing-finish-definition/m-p/13951545#M178669</guid>
      <dc:creator>HermJan.Otterman</dc:creator>
      <dc:date>2025-12-19T14:08:38Z</dc:date>
    </item>
    <item>
      <title>Re: adding components to an existing finish definition</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/adding-components-to-an-existing-finish-definition/m-p/13951666#M178678</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/562667"&gt;@HermJan.Otterman&lt;/a&gt;.&amp;nbsp; Your code is using a property that became available in 2025.1, and I am still using 2024.4, so I could not test this, but have a look at how I modified your code example below.&amp;nbsp; Since the 'ObjectCollection' is 'transient', it does not persist or exist after transferring data to or from somewhere, so we can not just edit its contents, when we are getting it from a property value, but would need to set a changed collection back to that property, as its value.&amp;nbsp; Also, pay attention that the 'Definition' property of this feature is 'Read/Write', which usually indicates that we will need to set a modified definition as its value, not simply edit the definition 'in-line', so to speak.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Private Sub addComponentsToFinish(samenstelling As Inventor.AssemblyDocument)
	Dim compAssyDef As Inventor.AssemblyComponentDefinition = samenstelling.ComponentDefinition
	Dim finishFeatures As FinishFeatures = compAssyDef.Features.FinishFeatures
	For Each finish As Inventor.FinishFeature In finishFeatures
		Dim oFinishDef As Inventor.FinishDefinition = finish.Definition
		Dim oInclEntsColl As Inventor.ObjectCollection = oFinishDef.IncludedEntities
		oInclEntsColl.Clear()
		'Controleer of het een FinishFeature is
		If finish.Type = Inventor.ObjectTypeEnum.kFinishFeatureObject Then
			For Each oCompOcc As Inventor.ComponentOccurrence In compAssyDef.Occurrences
				If oCompOcc.Suppressed Then Continue For
				Dim compDef As Inventor.ComponentDefinition = oCompOcc.Definition
				If TypeOf compDef Is VirtualComponentDefinition Then Continue For
				If TypeOf compDef Is WeldsComponentDefinition Then Continue For
				For Each oBody As Inventor.SurfaceBody In compDef.SurfaceBodies
					oInclEntsColl.Add(oBody)
				Next 'oBody
			Next 'oCompOcc
			oFinishDef.IncludedEntities = oInclEntsColl
			finish.Definition = oFinishDef
		End If
	Next 'finish
End Sub&lt;/LI-CODE&gt;
&lt;P&gt;If this solved your problem, or answered your question, please click &lt;SPAN&gt;&lt;STRONG&gt; ACCEPT SOLUTION &lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;BR /&gt;Or, if this helped you, please click (LIKE or KUDOS) &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Dec 2025 15:31:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/adding-components-to-an-existing-finish-definition/m-p/13951666#M178678</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2025-12-19T15:31:33Z</dc:date>
    </item>
    <item>
      <title>Re: adding components to an existing finish definition</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/adding-components-to-an-existing-finish-definition/m-p/13951705#M178686</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;for your reply,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried your code and it gives an error ( System.Runtime.InteropServices.COMException: unknown) on line&amp;nbsp;oFinishDef.IncludedEntities = oInclEntsColl, maybe this is what you say, that the&amp;nbsp;oFinishDef.IncludedEntities can not be changed?&amp;nbsp;&lt;/P&gt;&lt;P&gt;in my code it did not crash on that line, but it did also not change the number of entities).&lt;/P&gt;&lt;P&gt;I also tried to create a new definition, but it did not work. the example form autodesk is in a part...&lt;/P&gt;&lt;P&gt;i will try some more&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Dec 2025 15:57:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/adding-components-to-an-existing-finish-definition/m-p/13951705#M178686</guid>
      <dc:creator>HermJan.Otterman</dc:creator>
      <dc:date>2025-12-19T15:57:35Z</dc:date>
    </item>
    <item>
      <title>Re: adding components to an existing finish definition</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/adding-components-to-an-existing-finish-definition/m-p/13951734#M178688</link>
      <description>&lt;P&gt;In 2024, the&amp;nbsp;&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=FinishFeatures_CreateFinishDefinition" target="_blank" rel="noopener"&gt;FinishFeatures.CreateFinishDefinition&lt;/A&gt;&amp;nbsp;method asked for a FaceCollection, then we had the&amp;nbsp;&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=FinishDefinition_InputFaces" target="_blank" rel="noopener"&gt;FinishDefinition.InputFaces&lt;/A&gt;&amp;nbsp;property, which was Read/Write, but I guess in 2025 they started allowing SurfaceBody objects also, and now using an ObjectCollection.&amp;nbsp; I assumed that since we are accessing the ComponentOccurrence.SurfaceBodies collection of top level components that those should already be 'in context' of the assembly (already proxies).&amp;nbsp; Whereas, if we were using ComponentOccurrence.Definition.SurfaceBodies collection, then we would definitely need to create 'proxies', because those would be the original bodies in the 'context' of the component's definition.&amp;nbsp; So I'm not sure context is the issue here.&amp;nbsp; I see the&amp;nbsp;&lt;A href="https://help.autodesk.com/view/INVNTOR/2026/ENU/?guid=FinishFeature_RemoveParticipant" target="_blank" rel="noopener"&gt;FinishFeature.RemoveParticipant&lt;/A&gt;&amp;nbsp;method, which is meant for use in an assembly, but only accepts a whole ComponentOccurrence as input, not individual faces or bodies.&amp;nbsp; But then there is no 'AddParticipant(s)' method(s), which is a bit odd.&amp;nbsp; I just assumed that the&amp;nbsp;&lt;A href="https://help.autodesk.com/view/INVNTOR/2026/ENU/?guid=FinishFeature_SetAffectedBodies" target="_blank" rel="noopener"&gt;FinishFeature.SetAffectedBodies&lt;/A&gt;&amp;nbsp;was only for use in the context of a part, but the documentation does not say one way or the other, so maybe it will work in an assembly too, if getting the bodies from the&amp;nbsp;ComponentOccurrence.SurfaceBodies collection.&amp;nbsp; Worth testing though.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Dec 2025 16:24:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/adding-components-to-an-existing-finish-definition/m-p/13951734#M178688</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2025-12-19T16:24:09Z</dc:date>
    </item>
    <item>
      <title>Re: adding components to an existing finish definition</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/adding-components-to-an-existing-finish-definition/m-p/13953089#M178706</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054" target="_blank"&gt;@WCrihfield&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;when I take your code and put in the proxy part than it works but not as I would expect...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;Private Sub addComponentsToFinish2(samenstelling As Inventor.AssemblyDocument)&lt;BR /&gt;Dim compAssyDef As Inventor.AssemblyComponentDefinition = samenstelling.ComponentDefinition&lt;BR /&gt;Dim finishFeatures As FinishFeatures = compAssyDef.Features.FinishFeatures&lt;BR /&gt;For Each finish As Inventor.FinishFeature In finishFeatures&lt;BR /&gt;Dim oFinishDef As Inventor.FinishDefinition = finish.Definition&lt;BR /&gt;Dim oInclEntsColl As Inventor.ObjectCollection = oFinishDef.IncludedEntities&lt;BR /&gt;oInclEntsColl.Clear()&lt;BR /&gt;'Controleer of het een FinishFeature is&lt;BR /&gt;If finish.Type = Inventor.ObjectTypeEnum.kFinishFeatureObject Then&lt;BR /&gt;For Each oCompOcc As Inventor.ComponentOccurrence In compAssyDef.Occurrences&lt;BR /&gt;'If oInclEntsColl.Count &amp;gt;= 13 Then Exit For&lt;BR /&gt;If oCompOcc.Suppressed Then Continue For&lt;BR /&gt;Dim compDef As Inventor.ComponentDefinition = oCompOcc.Definition&lt;BR /&gt;If TypeOf compDef Is VirtualComponentDefinition Then Continue For&lt;BR /&gt;If TypeOf compDef Is WeldsComponentDefinition Then Continue For&lt;BR /&gt;For Each oBody As Inventor.SurfaceBody In oCompOcc.SurfaceBodies&lt;BR /&gt;Dim oBodyProxy As SurfaceBodyProxy = Nothing&lt;BR /&gt;oCompOcc.CreateGeometryProxy(oBody, oBodyProxy)&lt;BR /&gt;oInclEntsColl.Add(oBodyProxy)&lt;BR /&gt;Next 'oBody&lt;BR /&gt;Next 'oCompOcc&lt;BR /&gt;oFinishDef.IncludedEntities = oInclEntsColl&lt;BR /&gt;finish.Definition = oFinishDef&lt;BR /&gt;End If&lt;BR /&gt;Next 'finish&lt;BR /&gt;End Sub&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;als long as the ocuurrences are unique parts it works, BUT, if you add a second surfacebodyproxy from a different occurrence, of the same component, you get an error.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;so 10 unique parts in an assembly , than this works.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;one component copied ten times, in an assembly,&amp;nbsp; the first will be oke, the second will give an error.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if do it manualy, I select two ore more ocuurrences of the same part, in the finish-object under definition.IncludedEntities, only one surfacebodyproxy is listed?? I can not find the others!!&lt;/SPAN&gt;&lt;SPAN&gt;?? &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is this not supported yet? or what am I missing?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Dec 2025 13:09:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/adding-components-to-an-existing-finish-definition/m-p/13953089#M178706</guid>
      <dc:creator>HermJan.Otterman</dc:creator>
      <dc:date>2025-12-21T13:09:36Z</dc:date>
    </item>
  </channel>
</rss>

