<?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 How Can I Make This Neat? VBA code in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-this-neat-vba-code/m-p/6491918#M66006</link>
    <description>&lt;P&gt;I've written a piece of code that inspects large assemblies and part of it is going through each assembly and sub assembly until it gets to the parts (and then does things).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've attached an image of my code as copy and paste doesn't seem to be helping.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I basically have this many times- is there a way to make it neater? It's awful coding I'm sure &lt;img id="smileytongue" class="emoticon emoticon-smileytongue" src="https://forums.autodesk.com/i/smilies/16x16_smiley-tongue.png" alt="Smiley Tongue" title="Smiley Tongue" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 10 Aug 2016 15:53:22 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-08-10T15:53:22Z</dc:date>
    <item>
      <title>How Can I Make This Neat? VBA code</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-this-neat-vba-code/m-p/6491918#M66006</link>
      <description>&lt;P&gt;I've written a piece of code that inspects large assemblies and part of it is going through each assembly and sub assembly until it gets to the parts (and then does things).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've attached an image of my code as copy and paste doesn't seem to be helping.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I basically have this many times- is there a way to make it neater? It's awful coding I'm sure &lt;img id="smileytongue" class="emoticon emoticon-smileytongue" src="https://forums.autodesk.com/i/smilies/16x16_smiley-tongue.png" alt="Smiley Tongue" title="Smiley Tongue" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2016 15:53:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-this-neat-vba-code/m-p/6491918#M66006</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-08-10T15:53:22Z</dc:date>
    </item>
    <item>
      <title>Re: How Can I Make This Neat? VBA code</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-this-neat-vba-code/m-p/6492750#M66014</link>
      <description>&lt;P&gt;If you are looping through the collection of allreferenceddocuments then you don't need to call it multiple times, it is already the entire collection of every child and child's child etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My first question is does ThreadData and HoleData care what type it is? &amp;nbsp;The way it is written i would have to assume not, or it has it's own code to handle either doctype. &amp;nbsp;In which case why do you need to distinguish between doctype in this sub?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you really do you can do something like this (I'm going on memory, not intellisense)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;dim DocType as DocumentType: set DocType = aDoc.DocumentType&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Select Case DocType&lt;/P&gt;&lt;P&gt;Case kPartDocumentObject, kSheetMetalDocumentObject &amp;nbsp; 'Im just showing you can list types, not totally sure if sheet metal exists here.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ThreadData&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; HoleData&lt;/P&gt;&lt;P&gt;Case kAssemblyDocumentObject&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ThreadData&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; HoleData&lt;/P&gt;&lt;P&gt;Case Else&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 'Any other type&lt;/P&gt;&lt;P&gt;End Select&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>Wed, 10 Aug 2016 20:23:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-this-neat-vba-code/m-p/6492750#M66014</guid>
      <dc:creator>CadUser46</dc:creator>
      <dc:date>2016-08-10T20:23:59Z</dc:date>
    </item>
    <item>
      <title>Re: How Can I Make This Neat? VBA code</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-this-neat-vba-code/m-p/6493467#M66023</link>
      <description>&lt;P&gt;Oh so allreferenceddocuments will get all the parts within sub assemblies? I obviously missed that! I'm not calling it multiple times- that was just where I started and then from there I dug into assemblies from there - But I guess if allreferenceddocs gets the parts anyway this isn't required? HoleData and ThreadData are just other subs I'm calling to look into the parts (they're not really relevant).&lt;/P&gt;</description>
      <pubDate>Thu, 11 Aug 2016 07:15:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-this-neat-vba-code/m-p/6493467#M66023</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-08-11T07:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: How Can I Make This Neat? VBA code</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-this-neat-vba-code/m-p/6493502#M66026</link>
      <description>&lt;P&gt;It works and is so much better thank you!&lt;/P&gt;&lt;P&gt;That was the key bit that I just didn't quite catch on to!&lt;/P&gt;</description>
      <pubDate>Thu, 11 Aug 2016 07:41:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-this-neat-vba-code/m-p/6493502#M66026</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-08-11T07:41:32Z</dc:date>
    </item>
  </channel>
</rss>

