<?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 - Apply shell feature to all parts in assembly in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-apply-shell-feature-to-all-parts-in-assembly/m-p/9791681#M57410</link>
    <description>&lt;P&gt;I have over 100 solid parts in an assembly (simple rectangular extrusions) and i need to apply a shell with a wall thickness to all of them. I am a novice at ilogic, and i couldn't find anything that can help me create the rule. I know how to edit a parameter of all the parts via ilogic but not how to create a shell feature. I use a template code that goes through each part in an assembly to edit a parameter, i just need to know how to apply a shell feature to that code. Any ideas?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 08 Oct 2020 14:50:53 GMT</pubDate>
    <dc:creator>nbarbars</dc:creator>
    <dc:date>2020-10-08T14:50:53Z</dc:date>
    <item>
      <title>iLogic - Apply shell feature to all parts in assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-apply-shell-feature-to-all-parts-in-assembly/m-p/9791681#M57410</link>
      <description>&lt;P&gt;I have over 100 solid parts in an assembly (simple rectangular extrusions) and i need to apply a shell with a wall thickness to all of them. I am a novice at ilogic, and i couldn't find anything that can help me create the rule. I know how to edit a parameter of all the parts via ilogic but not how to create a shell feature. I use a template code that goes through each part in an assembly to edit a parameter, i just need to know how to apply a shell feature to that code. Any ideas?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2020 14:50:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-apply-shell-feature-to-all-parts-in-assembly/m-p/9791681#M57410</guid>
      <dc:creator>nbarbars</dc:creator>
      <dc:date>2020-10-08T14:50:53Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic - Apply shell feature to all parts in assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-apply-shell-feature-to-all-parts-in-assembly/m-p/9791880#M57411</link>
      <description>&lt;P&gt;Try this.&amp;nbsp; Just edit the value of the variable oThickness to whatever value you want, just keep in mind that this value will be understood as centimeters by the system, so you may have to either do some math or use a conversion tool.&lt;/P&gt;&lt;P&gt;This process assumes the first surface body within each part document is the main (and only) body, and that the first face in the faces collection is the one you would want to choose as the one to remove in the shell process.&amp;nbsp; To be more specific about which face to remove, you would most likely have to name the right face within each part file, then find that named face within each part file within the code to use the right one.&amp;nbsp; If you need to do it that way I can help, just let me know.&lt;/P&gt;&lt;P&gt;Here's the code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Dim oADoc As AssemblyDocument = ThisAssembly.Document
Dim oPDoc As PartDocument
Dim oPDef As PartComponentDefinition
Dim oFaces As FaceCollection = ThisApplication.TransientObjects.CreateFaceCollection
Dim oBody As SurfaceBody
Dim oFace As Inventor.Face
Dim oShellFeats As ShellFeatures
Dim oShellDef As ShellDefinition
Dim oShelllFeat As ShellFeature
Dim oThickness As Double = .125
For Each oRefDoc As Document In oADoc.AllReferencedDocuments
	If oRefDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then
		oPDoc = oRefDoc
		oPDef = oPDoc.ComponentDefinition
		oBody = oPDef.SurfaceBodies.Item(1)
		oFace = oBody.Faces.Item(1)
		oFaces.Add(oFace)
		oShellFeats = oPDef.Features.ShellFeatures
		oShellDef = oShellFeats.CreateShellDefinition(oFaces,oThickness,ShellDirectionEnum.kInsideShellDirection)
		oShelllFeat = oShellFeats.Add(oShellDef)
	End If
Next&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this solved your problem, or answered your question, please click &lt;SPAN style="background-color: green; color: white;"&gt;&lt;STRONG&gt;ACCEPT SOLUTION&lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;BR /&gt;Or, if this helped you, please click 'LIKE' &lt;SPAN&gt;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;Vote For &lt;A href="https://forums.autodesk.com/t5/forums/recentpostspage/post-type/message/interaction-style/idea/user-id/7812054/" target="_blank" rel="noopener"&gt;My IDEAS &lt;SPAN&gt;&lt;span class="lia-unicode-emoji" title=":light_bulb:"&gt;💡&lt;/span&gt;&lt;/SPAN&gt;&lt;/A&gt;and Explore &lt;A href="https://knowledge.autodesk.com/profile/LTSUSR7HXMSAE/articles" target="_blank" rel="noopener"&gt;My CONTRIBUTIONS &lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.autodesk.com/view/INVNTOR/2020/ENU/" target="_blank" rel="noopener"&gt;Inventor 2020 Help &lt;/A&gt;| &lt;A href="https://forums.autodesk.com/t5/inventor-forum/bd-p/78/" target="_blank" rel="noopener"&gt;Inventor Forum &lt;/A&gt;| &lt;A href="https://forums.autodesk.com/t5/inventor-customization/bd-p/120/" target="_blank" rel="noopener"&gt;Inventor Customization Forum &lt;/A&gt;| &lt;A href="https://forums.autodesk.com/t5/inventor-ideas/idb-p/v1232/" target="_blank" rel="noopener"&gt;Inventor Ideas Forum &lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2020 16:08:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-apply-shell-feature-to-all-parts-in-assembly/m-p/9791880#M57411</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2020-10-08T16:08:06Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic - Apply shell feature to all parts in assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-apply-shell-feature-to-all-parts-in-assembly/m-p/9791934#M57412</link>
      <description>&lt;P&gt;edit: it actually applied the shell to the first part, then threw the error&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hey, thank you for the reply. I'm getting this error when i tried to test this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error in rule: Rule0, in document: Assembly3&lt;/P&gt;&lt;P&gt;Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't need any faces removed either, i just need to make the parts hollow with a .25" wall thickness all around.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you in advance,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2020 16:28:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-apply-shell-feature-to-all-parts-in-assembly/m-p/9791934#M57412</guid>
      <dc:creator>nbarbars</dc:creator>
      <dc:date>2020-10-08T16:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic - Apply shell feature to all parts in assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-apply-shell-feature-to-all-parts-in-assembly/m-p/9791990#M57413</link>
      <description>&lt;P&gt;OK. Give this a try then.&lt;/P&gt;&lt;P&gt;I removed the variables oBody and oFace and am no longer adding a face into the oFaces collection.&amp;nbsp;&amp;nbsp; The first variable within the definition of a ShellDefinition is the FaceCollection object, so hopefully it will accept an empty collection.&lt;/P&gt;&lt;P&gt;I also threw in some code to ensure the part document is open before attempting to edit it, then closing it again after I'm done with it.&amp;nbsp; Hopefully one (or all) of these edits will eliminate the error message for you.&amp;nbsp; By the way when posting the results of an error message, it's always best to show what was on both tabs of the error message, because while one tab may be rather generic and practically meaningless, the information on the other tab may contain key information that helps us understand where the error occurred.&lt;/P&gt;&lt;P&gt;Here's the updated code:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim oADoc As AssemblyDocument = ThisAssembly.Document
Dim oPDoc As PartDocument
Dim oPDef As PartComponentDefinition
Dim oFaces As FaceCollection = ThisApplication.TransientObjects.CreateFaceCollection
Dim oShellFeats As ShellFeatures
Dim oShellDef As ShellDefinition
Dim oShelllFeat As ShellFeature
Dim oThickness As Double = .25
For Each oRefDoc As Document In oADoc.AllReferencedDocuments
	If oRefDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then
		oPDoc = oRefDoc
		If Not oPDoc.Open Then ThisApplication.Documents.Open(oPDoc.FullDocumentName,False)
		oPDef = oPDoc.ComponentDefinition
		oShellFeats = oPDef.Features.ShellFeatures
		oShellDef = oShellFeats.CreateShellDefinition(oFaces,oThickness,ShellDirectionEnum.kInsideShellDirection)
		oShelllFeat = oShellFeats.Add(oShellDef)
		oPDoc.Save
		oPDoc.Close
		oPDoc.ReleaseReference
	End If
Next
ThisApplication.Documents.CloseAll(True)&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 08 Oct 2020 16:42:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-apply-shell-feature-to-all-parts-in-assembly/m-p/9791990#M57413</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2020-10-08T16:42:23Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic - Apply shell feature to all parts in assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-apply-shell-feature-to-all-parts-in-assembly/m-p/9792009#M57414</link>
      <description>&lt;P&gt;Thank you, worked perfect! And i learned a bit from your code so thank you for that too!&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2020 16:46:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-apply-shell-feature-to-all-parts-in-assembly/m-p/9792009#M57414</guid>
      <dc:creator>nbarbars</dc:creator>
      <dc:date>2020-10-08T16:46:31Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic - Apply shell feature to all parts in assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-apply-shell-feature-to-all-parts-in-assembly/m-p/9792021#M57415</link>
      <description>&lt;P&gt;Always glad to help when I can. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Good luck in all your future customization endeavors.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2020 16:49:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-apply-shell-feature-to-all-parts-in-assembly/m-p/9792021#M57415</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2020-10-08T16:49:47Z</dc:date>
    </item>
  </channel>
</rss>

