<?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 external rule open files in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-external-rule-open-files/m-p/11112423#M136908</link>
    <description>&lt;P&gt;It worked!&lt;/P&gt;&lt;P&gt;Thanks a lot!!&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7946284"&gt;@A.Acheson&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 18 Apr 2022 18:19:28 GMT</pubDate>
    <dc:creator>jacqueline.lima</dc:creator>
    <dc:date>2022-04-18T18:19:28Z</dc:date>
    <item>
      <title>iLogic external rule open files</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-external-rule-open-files/m-p/11085354#M136338</link>
      <description>&lt;P&gt;I need help to generate a .txt file with some infos&amp;nbsp;extracted from all open assemblies.&amp;nbsp;Besides that I need check if a open file is a iAssembly, if yes I need run the rule for all members of this iAssembly. I wrote the code bellow, but it works just for the assembly that are open.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim oAssembly As AssemblyDocument = ThisDoc.Document
Dim oCompDef As AssemblyComponentDefinition = oAssembly.ComponentDefinition
Dim IsiAssembly As Boolean = oCompDef.IsiAssemblyFactory()
Dim factory As iAssemblyFactory = oCompDef.iAssemblyFactory
Dim myList, mySelect As New ArrayList
Dim Instalacao

TolMax = InputBox("Qual a tolerância superior do diâmetro de passagem do parafuso?", "Tolerância Superior")
TolMin = InputBox("Qual a tolerância superior do diâmetro de passagem do parafuso?", "Tolerância Superior")
myList.Add("Cemented")
myList.Add("Screwed")
myList.Add("N/A")
myList_selected = InputListBox("Cimentado, Parafusado ou N/A?", myList, myList(0), Title := "Selecione abaixo", ListName := "List")
mySelect.Add(myList_selected)
For Each Instalacao In mySelect
	MessageBox.Show("Arquivo .txt gerado com sucesso! Todos os itens foram definidos como: " &amp;amp; Instalacao, "Sucesso!")
Next

'____Create and write to a text file_________________
oWrite = System.IO.File.CreateText(ThisDoc.Path &amp;amp; "\" &amp;amp; "VerificarConexoes" &amp;amp; ".txt")
'For Each oAssembly In ThisApplication.Documents.VisibleDocuments
For Each assembly As ComponentOccurrence In oCompDef.Occurrences
	oAssembly.Activate()
	oWrite.WriteLine(item &amp;amp; ";" &amp;amp; Round(A, 2) &amp;amp; ";" &amp;amp; Round(B, 2) &amp;amp; ";" &amp;amp; Round(Emax, 2) &amp;amp; ";" &amp;amp; Round(Emin, 2) &amp;amp; ";" &amp;amp; Instalacao)
	
	If oCompDef.IsiAssemblyFactory() = False Then
		item = iProperties.Value("Project", "Part Number")
		A = Parameter("Ap")
		Emax = Parameter("DIA") + TolMax
		Emin = Parameter("DIA") - TolMin
		B = Parameter("B")
	End If
	
	If oCompDef.IsiAssemblyFactory() = True Then
		Dim factoryRows As iAssemblyTableRows = factory.TableRows
		For Each row In factoryRows
			item = iProperties.Value("Project", "Part Number")
			A = Parameter("Ap")
			Emax = Parameter("DIA") + TolMax
			Emin = Parameter("DIA") - TolMin
			B = Parameter("B")
		Next
	End If	
Next

oWrite.Close()&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 05 Apr 2022 19:13:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-external-rule-open-files/m-p/11085354#M136338</guid>
      <dc:creator>jacqueline.lima</dc:creator>
      <dc:date>2022-04-05T19:13:40Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic external rule open files</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-external-rule-open-files/m-p/11099615#M136607</link>
      <description>&lt;P&gt;You can look at the&lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=GUID-21D1FCAF-F0E7-4A13-A0A3-B0977DEF6F7C" target="_blank" rel="noopener"&gt; visible document collection.&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The ilogic snippet will need to be changed&amp;nbsp; to a &lt;A href="https://modthemachine.typepad.com/my_weblog/iproperties" target="_blank" rel="noopener"&gt;property set&lt;/A&gt; version(API) otherwise the part number will be the document you called the rule from rather than the document in your visible documents loop. If you need help constructing just post back with the visible documents loop in place and also the required property set. Any questions ask away.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2022 00:58:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-external-rule-open-files/m-p/11099615#M136607</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2022-04-12T00:58:28Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic external rule open files</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-external-rule-open-files/m-p/11101501#M136656</link>
      <description>&lt;P&gt;I changed my code for this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim myList, mySelect As New ArrayList
Dim Instalacao

TolMax = InputBox("Qual a tolerância superior do diâmetro de passagem do parafuso?", "Tolerância Superior")
TolMin = InputBox("Qual a tolerância superior do diâmetro de passagem do parafuso?", "Tolerância Superior")
myList.Add("Cemented")
myList.Add("Screwed")
myList.Add("N/A")
myList_selected = InputListBox("Cimentado, Parafusado ou N/A?", myList, myList(0), Title := "Selecione abaixo", ListName := "List")
mySelect.Add(myList_selected)
For Each Instalacao In mySelect
'	MessageBox.Show("Arquivo .txt gerado com sucesso! Todos os itens foram definidos como: " &amp;amp; Instalacao, "Sucesso!")
Next

oWrite = System.IO.File.CreateText(ThisDoc.Path &amp;amp; "\" &amp;amp; "VerificarConexoes" &amp;amp; ".txt")
Dim oDoc As Inventor.Document
For Each oDoc In ThisApplication.Documents.VisibleDocuments
	If oDoc.DocumentType = kAssemblyDocumentObject Then
		item = iProperties.Value("Project", "Part Number")
		A = Parameter("Ap")
		Emax = Parameter("DIA") + TolMax
		Emin = Parameter("DIA") - TolMin
		B = Parameter("B")
		oWrite.WriteLine(item &amp;amp; ";" &amp;amp; Round(A, 2) &amp;amp; ";" &amp;amp; Round(B, 2) &amp;amp; ";" &amp;amp; Round(Emax, 2) &amp;amp; ";" &amp;amp; Round(Emin, 2) &amp;amp; ";" &amp;amp; Instalacao)
	End If
Next

oWrite.Close()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But still not working. The .txt file that is exporting returns just the infos from the assembly that are visible repeating for all documents opened, as below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jacquelinelima_0-1649783465088.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1054039i693CB0B0F254F4CA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jacquelinelima_0-1649783465088.png" alt="jacquelinelima_0-1649783465088.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2022 17:15:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-external-rule-open-files/m-p/11101501#M136656</guid>
      <dc:creator>jacqueline.lima</dc:creator>
      <dc:date>2022-04-12T17:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic external rule open files</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-external-rule-open-files/m-p/11101981#M136673</link>
      <description>&lt;P&gt;Here&amp;nbsp; is some changes removing the ilogic snippets for iproperty and parameters for API versions.&amp;nbsp;The tolerances retrieval may not be correct, so maybe check that section and test.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;myList&lt;/SPAN&gt;, &lt;SPAN&gt;mySelect&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;New&lt;/SPAN&gt; &lt;SPAN&gt;ArrayList&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;Instalacao&lt;/SPAN&gt;

&lt;SPAN&gt;TolMax&lt;/SPAN&gt; = &lt;SPAN&gt;InputBox&lt;/SPAN&gt;(&lt;SPAN&gt;"Qual a tolerância superior do diâmetro de passagem do parafuso?"&lt;/SPAN&gt;, &lt;SPAN&gt;"Tolerância Superior"&lt;/SPAN&gt;)
&lt;SPAN&gt;TolMin&lt;/SPAN&gt; = &lt;SPAN&gt;InputBox&lt;/SPAN&gt;(&lt;SPAN&gt;"Qual a tolerância superior do diâmetro de passagem do parafuso?"&lt;/SPAN&gt;, &lt;SPAN&gt;"Tolerância Superior"&lt;/SPAN&gt;)
&lt;SPAN&gt;myList&lt;/SPAN&gt;.&lt;SPAN&gt;Add&lt;/SPAN&gt;(&lt;SPAN&gt;"Cemented"&lt;/SPAN&gt;)
&lt;SPAN&gt;myList&lt;/SPAN&gt;.&lt;SPAN&gt;Add&lt;/SPAN&gt;(&lt;SPAN&gt;"Screwed"&lt;/SPAN&gt;)
&lt;SPAN&gt;myList&lt;/SPAN&gt;.&lt;SPAN&gt;Add&lt;/SPAN&gt;(&lt;SPAN&gt;"N/A"&lt;/SPAN&gt;)
&lt;SPAN&gt;myList_selected&lt;/SPAN&gt; = &lt;SPAN&gt;InputListBox&lt;/SPAN&gt;(&lt;SPAN&gt;"Cimentado, Parafusado ou N/A?"&lt;/SPAN&gt;, &lt;SPAN&gt;myList&lt;/SPAN&gt;, &lt;SPAN&gt;myList&lt;/SPAN&gt;(0), &lt;SPAN&gt;Title&lt;/SPAN&gt; := &lt;SPAN&gt;"Selecione abaixo"&lt;/SPAN&gt;, &lt;SPAN&gt;ListName&lt;/SPAN&gt; := &lt;SPAN&gt;"List"&lt;/SPAN&gt;)
&lt;SPAN&gt;mySelect&lt;/SPAN&gt;.&lt;SPAN&gt;Add&lt;/SPAN&gt;(&lt;SPAN&gt;myList_selected&lt;/SPAN&gt;)
&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;Instalacao&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;mySelect&lt;/SPAN&gt;
&lt;SPAN&gt;'	MessageBox.Show("Arquivo .txt gerado com sucesso! Todos os itens foram definidos como: " &amp;amp; Instalacao, "Sucesso!")&lt;/SPAN&gt;
&lt;SPAN&gt;Next&lt;/SPAN&gt;

&lt;SPAN&gt;oWrite&lt;/SPAN&gt; = &lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;IO&lt;/SPAN&gt;.&lt;SPAN&gt;File&lt;/SPAN&gt;.&lt;SPAN&gt;CreateText&lt;/SPAN&gt;(&lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Path&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"VerificarConexoes"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;".txt"&lt;/SPAN&gt;)
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Inventor&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;

&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oDoc&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;Documents&lt;/SPAN&gt;.&lt;SPAN&gt;VisibleDocuments&lt;/SPAN&gt;
	&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;DocumentType&lt;/SPAN&gt; = &lt;SPAN&gt;kAssemblyDocumentObject&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
		&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oAssyDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssemblyDocument&lt;/SPAN&gt; = &lt;SPAN&gt;oDoc&lt;/SPAN&gt; &lt;SPAN&gt;'Declare as either an assembly or part to gain access to object collections. &lt;/SPAN&gt;
		&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;Params&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Parameters&lt;/SPAN&gt; = &lt;SPAN&gt;oAssyDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;Parameters&lt;/SPAN&gt;
		&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;opn&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;[Property]&lt;/SPAN&gt;
		&lt;SPAN&gt;opn&lt;/SPAN&gt; = &lt;SPAN&gt;oAssyDoc&lt;/SPAN&gt;.&lt;SPAN&gt;PropertySets&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;"Design Tracking Properties"&lt;/SPAN&gt;).&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;"Part Number"&lt;/SPAN&gt;)
		
		&lt;SPAN&gt;Try&lt;/SPAN&gt;
			&lt;SPAN&gt;item&lt;/SPAN&gt; = &lt;SPAN&gt;opn&lt;/SPAN&gt;.&lt;SPAN&gt;Value&lt;/SPAN&gt;.&lt;SPAN&gt;ToString&lt;/SPAN&gt;   &lt;SPAN&gt;'cannot use ilogic snippet which is only valid in document the rule is ran from first 'iProperties.Value("Project", "Part Number")&lt;/SPAN&gt;
			&lt;SPAN&gt;A&lt;/SPAN&gt; = &lt;SPAN&gt;Params&lt;/SPAN&gt;(&lt;SPAN&gt;"Ap"&lt;/SPAN&gt;).&lt;SPAN&gt;Value&lt;/SPAN&gt;&lt;SPAN&gt;' Value returned in system units cm   'Parameter("Ap")&lt;/SPAN&gt;
			&lt;SPAN&gt;Emax&lt;/SPAN&gt; = &lt;SPAN&gt;Params&lt;/SPAN&gt;(&lt;SPAN&gt;"DIA"&lt;/SPAN&gt;) + &lt;SPAN&gt;TolMax&lt;/SPAN&gt;
			&lt;SPAN&gt;Emin&lt;/SPAN&gt; = &lt;SPAN&gt;Params&lt;/SPAN&gt;(&lt;SPAN&gt;"DIA"&lt;/SPAN&gt;) - &lt;SPAN&gt;TolMin&lt;/SPAN&gt;
			&lt;SPAN&gt;B&lt;/SPAN&gt; = &lt;SPAN&gt;Params&lt;/SPAN&gt;(&lt;SPAN&gt;"B"&lt;/SPAN&gt;)
		&lt;SPAN&gt;Catch&lt;/SPAN&gt;
		&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Try&lt;/SPAN&gt;
			&lt;SPAN&gt;oWrite&lt;/SPAN&gt;.&lt;SPAN&gt;WriteLine&lt;/SPAN&gt;(&lt;SPAN&gt;item&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;";"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Round&lt;/SPAN&gt;(&lt;SPAN&gt;A&lt;/SPAN&gt;, 2) &amp;amp; &lt;SPAN&gt;";"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Round&lt;/SPAN&gt;(&lt;SPAN&gt;B&lt;/SPAN&gt;, 2) &amp;amp; &lt;SPAN&gt;";"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Round&lt;/SPAN&gt;(&lt;SPAN&gt;Emax&lt;/SPAN&gt;, 2) &amp;amp; &lt;SPAN&gt;";"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Round&lt;/SPAN&gt;(&lt;SPAN&gt;Emin&lt;/SPAN&gt;, 2) &amp;amp; &lt;SPAN&gt;";"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Instalacao&lt;/SPAN&gt;)
	&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
&lt;SPAN&gt;Next&lt;/SPAN&gt;

&lt;SPAN&gt;oWrite&lt;/SPAN&gt;.&lt;SPAN&gt;Close&lt;/SPAN&gt;()&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2022 20:48:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-external-rule-open-files/m-p/11101981#M136673</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2022-04-12T20:48:58Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic external rule open files</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-external-rule-open-files/m-p/11112423#M136908</link>
      <description>&lt;P&gt;It worked!&lt;/P&gt;&lt;P&gt;Thanks a lot!!&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7946284"&gt;@A.Acheson&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2022 18:19:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-external-rule-open-files/m-p/11112423#M136908</guid>
      <dc:creator>jacqueline.lima</dc:creator>
      <dc:date>2022-04-18T18:19:28Z</dc:date>
    </item>
  </channel>
</rss>

