<?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 Re: iLogic AddUsingiMates in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-addusingimates/m-p/6616002#M67327</link>
    <description>&lt;P&gt;I tried what you are doing in Inventor 2016 and it works fine...!?&lt;/P&gt;
&lt;P&gt;I have a block1, cilinder1 and block 2.&lt;/P&gt;
&lt;P&gt;block1 and cilinder1 are constrained.&lt;/P&gt;
&lt;P&gt;block2 has one imate connecting with the other end of the cilinder1.&lt;/P&gt;
&lt;P&gt;block2 has two imates in a composite connecting&amp;nbsp;with block1&lt;/P&gt;
&lt;P&gt;all imates/composite have matching names.&lt;/P&gt;
&lt;P&gt;when I place block2 (manually), the imate and composite&amp;nbsp;get connected&lt;/P&gt;
&lt;P&gt;when I do this with your code, this also works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;it could be something with 2015?&lt;/P&gt;
&lt;P&gt;what happens when you place it manually?&lt;/P&gt;
&lt;P&gt;are the imates all at the same level in the browser? and not in a sub assembly?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;what happens if you copy the part you want to place and create a different part (with other name).&lt;/P&gt;
&lt;P&gt;then place one of the parts, so that the&amp;nbsp;imate/composite are connected.&lt;/P&gt;
&lt;P&gt;then Replace it with the copy. this should work. if not, then probably the imates are incorrect.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;could you post a (stripped) assembly with the tree involving parts?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 11 Oct 2016 20:15:44 GMT</pubDate>
    <dc:creator>HermJan.Otterman</dc:creator>
    <dc:date>2016-10-11T20:15:44Z</dc:date>
    <item>
      <title>iLogic AddUsingiMates</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-addusingimates/m-p/6611818#M67303</link>
      <description>&lt;P&gt;I'm trying to place a part in an assembly using the iLogic code below:&lt;/P&gt;
&lt;PRE&gt;oOccEnumerator = oAsmCompDef.Occurrences.AddUsingiMates("&lt;EM&gt;filename&lt;/EM&gt;", False)&lt;/PRE&gt;
&lt;P&gt;It works well on&amp;nbsp;most of my files but there's one in particular that has a composite iMate and a single iMate, because it requires constraining to two different parts. The code only generates one of these when executed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does anyone have experience with this or knows of an alternative solution?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2016 10:02:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-addusingimates/m-p/6611818#M67303</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-10-10T10:02:33Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic AddUsingiMates</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-addusingimates/m-p/6613385#M67311</link>
      <description>&lt;P&gt;You could create a dummy part / master part to constraint alll parts to. put in only sketches and workplanes for constrainning the parts to the right place.&lt;/P&gt;
&lt;P&gt;Then you have two parts and can use the imates. further you can freely delete other parts without messing up the assembly.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2016 21:38:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-addusingimates/m-p/6613385#M67311</guid>
      <dc:creator>HermJan.Otterman</dc:creator>
      <dc:date>2016-10-10T21:38:38Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic AddUsingiMates</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-addusingimates/m-p/6614269#M67313</link>
      <description>&lt;P&gt;Thanks for your suggestion,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I was hoping there was something out there that could generate a result between two&amp;nbsp;iMates with&amp;nbsp;matching names?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I could then use this workflow:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Place component with AddUsingiMates, which generates a result for iMate1 on each part.&lt;/LI&gt;
&lt;LI&gt;Generate a result between iMate2 on each part using another line of code.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Appreciate any advice!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Oct 2016 08:39:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-addusingimates/m-p/6614269#M67313</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-10-11T08:39:35Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic AddUsingiMates</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-addusingimates/m-p/6616002#M67327</link>
      <description>&lt;P&gt;I tried what you are doing in Inventor 2016 and it works fine...!?&lt;/P&gt;
&lt;P&gt;I have a block1, cilinder1 and block 2.&lt;/P&gt;
&lt;P&gt;block1 and cilinder1 are constrained.&lt;/P&gt;
&lt;P&gt;block2 has one imate connecting with the other end of the cilinder1.&lt;/P&gt;
&lt;P&gt;block2 has two imates in a composite connecting&amp;nbsp;with block1&lt;/P&gt;
&lt;P&gt;all imates/composite have matching names.&lt;/P&gt;
&lt;P&gt;when I place block2 (manually), the imate and composite&amp;nbsp;get connected&lt;/P&gt;
&lt;P&gt;when I do this with your code, this also works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;it could be something with 2015?&lt;/P&gt;
&lt;P&gt;what happens when you place it manually?&lt;/P&gt;
&lt;P&gt;are the imates all at the same level in the browser? and not in a sub assembly?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;what happens if you copy the part you want to place and create a different part (with other name).&lt;/P&gt;
&lt;P&gt;then place one of the parts, so that the&amp;nbsp;imate/composite are connected.&lt;/P&gt;
&lt;P&gt;then Replace it with the copy. this should work. if not, then probably the imates are incorrect.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;could you post a (stripped) assembly with the tree involving parts?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Oct 2016 20:15:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-addusingimates/m-p/6616002#M67327</guid>
      <dc:creator>HermJan.Otterman</dc:creator>
      <dc:date>2016-10-11T20:15:44Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic AddUsingiMates</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-addusingimates/m-p/6616867#M67339</link>
      <description>&lt;P&gt;Hi, I got there with it eventually. This code will delete any instances of part with a specific name, place it in the assembly again and generate a result on the 1st iMate (i.e Part1 with Part2) which in my case was a composite iMate, then generate a result on the 2nd iMate (i.e Part1 with Part3) which was a single Insert iMate.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;' Get the component definition of the currently open assembly.&lt;BR /&gt;' This will fail if an assembly document is not open.&lt;BR /&gt;Dim doc As AssemblyDocument&lt;BR /&gt;doc = ThisDoc.Document&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Dim oAsmCompDef As AssemblyComponentDefinition&lt;BR /&gt;oAsmCompDef = doc.ComponentDefinition&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Dim oComp As ComponentOccurrence&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Dim oComps As ComponentOccurrences&lt;BR /&gt;oComps = doc.ComponentDefinition.Occurrences&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Dim oOccEnumerator As ComponentOccurrencesEnumerator&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;'Delete any instances of files containing "Spring"&lt;BR /&gt;For Each oComp In oComps&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; If oComp.Name.Contains("Spring") Then&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; oComp.Delete&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; End If&lt;BR /&gt;Next&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;'Place part in assembly using automatically generated iMates (will generate a result for the 1st iMate in the placed part)&lt;/P&gt;
&lt;P&gt;oOccEnumerator = oAsmCompDef.Occurrences.AddUsingiMates("&lt;EM&gt;fullfilepath&lt;/EM&gt;\Spring.iam", False)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;'Set part to flexible (remove if not required)&lt;BR /&gt; i = 1&lt;BR /&gt; For Each oComp In oComps&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; If oComp.Name.Contains("Spring") Then&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; oComp.Flexible = True&lt;/P&gt;
&lt;P&gt;i = i+1&lt;BR /&gt; End If&lt;BR /&gt; Next&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;'Define two occurences&lt;BR /&gt;Dim oOcc1 As ComponentOccurrence&lt;BR /&gt;Dim oOcc2 As ComponentOccurrence&lt;BR /&gt;&lt;BR /&gt;'Set two occurrences using their names as in model browser &lt;BR /&gt;oOcc1 = oAsmCompDef.Occurrences.ItemByName("Spring")&lt;BR /&gt;oOcc2 = oAsmCompDef.Occurrences.ItemByName("Panel")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;'Define iMate1 on oOcc1&lt;BR /&gt;i = 1&lt;BR /&gt;For Each iMateDefinition In oOcc1.iMateDefinitions&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; If iMateDefinition.Name= "Insert1" Then&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; iMate1 = oOcc1.iMateDefinitions.Item(i)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Exit For&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; End If&lt;BR /&gt;i = i+1&lt;BR /&gt;Next&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;'Define iMate2 on oOcc2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;i = 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;For Each iMateDefinition In oOcc2.iMateDefinitions&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; If iMateDefinition.Name= "Insert1" Then&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; iMate2 = oOcc2.iMateDefinitions.Item(i)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Exit For&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; End If&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;i = i+1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Next&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;' Create an iMate result between two iMate1 and iMate2&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Dim oiMateResult As iMateResult&lt;BR /&gt;oiMateResult = oAsmCompDef.iMateResults.AddByTwoiMates(iMate1, iMate2)&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 08:29:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-addusingimates/m-p/6616867#M67339</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-10-12T08:29:08Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic AddUsingiMates</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-addusingimates/m-p/6616889#M67340</link>
      <description>&lt;P&gt;Nice that it is working.&lt;/P&gt;
&lt;P&gt;I am wondering why both, the imate and composite are not connected, maybe a 2015 issue..&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 08:45:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-addusingimates/m-p/6616889#M67340</guid>
      <dc:creator>HermJan.Otterman</dc:creator>
      <dc:date>2016-10-12T08:45:26Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic AddUsingiMates</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-addusingimates/m-p/6616902#M67341</link>
      <description>&lt;P&gt;Perhaps its due to version, could you post your files so I can test them on my Inventor?&lt;/P&gt;
&lt;P&gt;I'd prefer not to have the code so long and complicated so if I can get it to work with just AddUsingiMates that would be great.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;P.S When I place the part manually it only constrains the composite.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 08:51:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-addusingimates/m-p/6616902#M67341</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-10-12T08:51:48Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic AddUsingiMates</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-addusingimates/m-p/6616977#M67344</link>
      <description>&lt;P&gt;My files are created in 2016, You can't open them in 2015....&lt;/P&gt;
&lt;P&gt;but here the are, open the assembly, delete part2. then insert part2 again, and they are connected.&lt;/P&gt;
&lt;P&gt;here is a screencast: &lt;A href="http://autode.sk/2dVrnIF" target="_blank"&gt;http://autode.sk/2dVrnIF&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;one other thing you could try is making the copy. this copy can be a dummy and should only have the iMate and Composite.&lt;/P&gt;
&lt;P&gt;Place this dummy in the assembly (you will not see it, only in the browser). now you can use the replace function.&lt;/P&gt;
&lt;P&gt;this is also less code and should work.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 09:33:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-addusingimates/m-p/6616977#M67344</guid>
      <dc:creator>HermJan.Otterman</dc:creator>
      <dc:date>2016-10-12T09:33:26Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic AddUsingiMates</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-addusingimates/m-p/6636786#M67532</link>
      <description>&lt;P&gt;did you get any further?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2016 08:39:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-addusingimates/m-p/6636786#M67532</guid>
      <dc:creator>HermJan.Otterman</dc:creator>
      <dc:date>2016-10-21T08:39:38Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic AddUsingiMates</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-addusingimates/m-p/6636823#M67533</link>
      <description>&lt;P&gt;It must be due to the version. For now I'm just going to stick with the long code I have as it's at least working the way I want, and perhaps if we upgrade to 2016 I will simplify it.&lt;/P&gt;
&lt;P&gt;Thanks for your help though.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2016 09:01:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-addusingimates/m-p/6636823#M67533</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-10-21T09:01:46Z</dc:date>
    </item>
  </channel>
</rss>

