<?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: Calling Local Form Part From Assembly in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/calling-local-form-part-from-assembly/m-p/13008783#M171542</link>
    <description>&lt;P&gt;Correct,...&lt;/P&gt;&lt;P&gt;If I Resume the workflow of the video example Code.&lt;/P&gt;&lt;P&gt;The Code in Assembly, Calling Local rule from The Part Or Sub-Assembly, Which Part Selected.&lt;/P&gt;&lt;P&gt;Where is the Local rule Calling to Open Local Form The Part Or Sub-Assembly.&lt;/P&gt;&lt;P&gt;*Be care full&amp;nbsp; ***Form***&amp;amp;***From***&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry, My Next Question.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I have Just Only 1 Form. In-Sub Assembly or Part but Potential with Deferent Name. If I work in Assembly Which have Many&amp;nbsp;Sub Assembly or Part.&amp;nbsp;&lt;/P&gt;&lt;P&gt;should I Add a Rule Named "Show Form" in Each Part or Each Sub-Assembly To Open Form in Assembly?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I Drop The Example Video Code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;'Check Whether Open Document is an assembly And Exit Rule If Not
oDoc = ThisDoc.ModelDocument
If oDoc.DocumentType = kPartDocumentObject Then
MessageBox.Show ("This rule can only be run in an assembly file - exiting rule", "Excitech i-Logic")
Return
End If

Dim targetOcc As ComponentOccurrence = Nothing
Do While True
	targetOcc = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter, "Select Sub-Assembly Or Part to Modify... (Press ESC to Cancel)")
	If Not targetOcc Is Nothing Then
		Exit Do
	else
		Dim Res As MsgBoxResult = MsgBox("No Sub-Assembly Selected - Exit?",36, "Excitech i-Logic")
		If Res = vbYes Then
			Return
		Else
			'Do Nothing-Keep On Looping
		End If
	End If
Loop

Try
iLogicVb.RunRule(targetOcc.Name, "Show Form") 'Show Form is Your rule in Part to Open Form Part or Sub-Assembly
Catch
MessageBox.Show ("There needs to be a rule called 'Show Form' in the Part Or Sub-Assembly to Run Their Local Form", "Excitech i-Logic")
End Try

&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 09 Sep 2024 09:44:32 GMT</pubDate>
    <dc:creator>drafter_sby2</dc:creator>
    <dc:date>2024-09-09T09:44:32Z</dc:date>
    <item>
      <title>Calling Local Form Part From Assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/calling-local-form-part-from-assembly/m-p/13008656#M171540</link>
      <description>&lt;P&gt;Hi All,..&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want an Asking Few Question.&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Can We Do "Call Local Form a Part From Assembly in I-Logic" ??&lt;/P&gt;&lt;P&gt;2. Its Possible Or Not?&lt;/P&gt;&lt;P&gt;3. Where I get A Xample Code or Tutorial?&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>Mon, 09 Sep 2024 08:25:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/calling-local-form-part-from-assembly/m-p/13008656#M171540</guid>
      <dc:creator>drafter_sby2</dc:creator>
      <dc:date>2024-09-09T08:25:51Z</dc:date>
    </item>
    <item>
      <title>Re: Calling Local Form Part From Assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/calling-local-form-part-from-assembly/m-p/13008666#M171541</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/15945680"&gt;@drafter_sby2&lt;/a&gt;&amp;nbsp;.&amp;nbsp;If I understand correctly, you want to run a local form from the part in assembly. Yes it is possible, you can see a sample code in &lt;A title="www.youtube.com" href="https://www.youtube.com/watch?v=lPQBLVDLHbI&amp;amp;ab_channel=SymetriUK" target="_blank" rel="noopener"&gt;this video&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2024 08:32:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/calling-local-form-part-from-assembly/m-p/13008666#M171541</guid>
      <dc:creator>Andrii_Humeniuk</dc:creator>
      <dc:date>2024-09-09T08:32:40Z</dc:date>
    </item>
    <item>
      <title>Re: Calling Local Form Part From Assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/calling-local-form-part-from-assembly/m-p/13008783#M171542</link>
      <description>&lt;P&gt;Correct,...&lt;/P&gt;&lt;P&gt;If I Resume the workflow of the video example Code.&lt;/P&gt;&lt;P&gt;The Code in Assembly, Calling Local rule from The Part Or Sub-Assembly, Which Part Selected.&lt;/P&gt;&lt;P&gt;Where is the Local rule Calling to Open Local Form The Part Or Sub-Assembly.&lt;/P&gt;&lt;P&gt;*Be care full&amp;nbsp; ***Form***&amp;amp;***From***&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry, My Next Question.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I have Just Only 1 Form. In-Sub Assembly or Part but Potential with Deferent Name. If I work in Assembly Which have Many&amp;nbsp;Sub Assembly or Part.&amp;nbsp;&lt;/P&gt;&lt;P&gt;should I Add a Rule Named "Show Form" in Each Part or Each Sub-Assembly To Open Form in Assembly?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I Drop The Example Video Code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;'Check Whether Open Document is an assembly And Exit Rule If Not
oDoc = ThisDoc.ModelDocument
If oDoc.DocumentType = kPartDocumentObject Then
MessageBox.Show ("This rule can only be run in an assembly file - exiting rule", "Excitech i-Logic")
Return
End If

Dim targetOcc As ComponentOccurrence = Nothing
Do While True
	targetOcc = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter, "Select Sub-Assembly Or Part to Modify... (Press ESC to Cancel)")
	If Not targetOcc Is Nothing Then
		Exit Do
	else
		Dim Res As MsgBoxResult = MsgBox("No Sub-Assembly Selected - Exit?",36, "Excitech i-Logic")
		If Res = vbYes Then
			Return
		Else
			'Do Nothing-Keep On Looping
		End If
	End If
Loop

Try
iLogicVb.RunRule(targetOcc.Name, "Show Form") 'Show Form is Your rule in Part to Open Form Part or Sub-Assembly
Catch
MessageBox.Show ("There needs to be a rule called 'Show Form' in the Part Or Sub-Assembly to Run Their Local Form", "Excitech i-Logic")
End Try

&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2024 09:44:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/calling-local-form-part-from-assembly/m-p/13008783#M171542</guid>
      <dc:creator>drafter_sby2</dc:creator>
      <dc:date>2024-09-09T09:44:32Z</dc:date>
    </item>
    <item>
      <title>Re: Calling Local Form Part From Assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/calling-local-form-part-from-assembly/m-p/13008956#M171543</link>
      <description>&lt;P&gt;Yes, you must add the iLogic "Show Form" rule to your subcomponents to trigger the form in the main assembly. This rule can activate a rule in subcomponents, which in turn shows your form.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2024 11:11:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/calling-local-form-part-from-assembly/m-p/13008956#M171543</guid>
      <dc:creator>Andrii_Humeniuk</dc:creator>
      <dc:date>2024-09-09T11:11:55Z</dc:date>
    </item>
    <item>
      <title>Re: Calling Local Form Part From Assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/calling-local-form-part-from-assembly/m-p/13009391#M171550</link>
      <description>&lt;P&gt;Hi guys.&amp;nbsp; Not sure how you may need to make this happen as far as any further automation plans go, but there may be another, more direct way.&amp;nbsp; Since around Inventor 2021 or so, we can use an iLogic tool that will allow us to initialize many of the common iLogic API code snippets with an actual Document object for them to be referencing, to help clarify which document they will be focused on.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=a233a5cb-6f7b-fb33-283f-778245fccc04" target="_blank" rel="noopener"&gt;StandardObjectFactory Class&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=0437e51f-f2bd-bb7d-fc2f-9faca72ecd2f" target="_blank" rel="noopener"&gt;StandardObjectFactory.Create Method&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=1edcd6a4-f9bb-3553-e8d8-0f3da13dc8a6" target="_blank" rel="noopener"&gt;IStandardObjectProvider Interface&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Review the following iLogic rule code example, to try it out.&amp;nbsp; The first couple lines let you manually select an assembly component, and if none was selected, it will exit the rule.&amp;nbsp; If one was selected, it attempts to get the Document object that the assembly component is referencing, so that we can access the internal iLogic Form within it.&amp;nbsp; Once it has the Document, it uses the create object provider method to create an object provider, with that Document as input (specified which document it should focus on).&amp;nbsp; Then it uses that provider to show the internal iLogic form within that document.&amp;nbsp; However, you will need to change "Form 1" to the actual name of the form within that document.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Dim oOcc As ComponentOccurrence = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter, "Select Component - or press ESC key to quit.")
If oOcc Is Nothing Then Return 'Return means exit this code routine
Dim oOccDoc As Document = oOcc.ReferencedDocumentDescriptor.ReferencedDocument
Dim SOP As IStandardObjectProvider = iLogicVb.CreateObjectProvider(oOccDoc)
SOP.iLogicForm.Show("Form 1", FormMode.Modal)&lt;/LI-CODE&gt;
&lt;P&gt;If the name of the form changes, then you will likely need a more complex code solution which will be able to find the form by some other means than by its name.&amp;nbsp; If there is only one form in the document, then there is actually still a way to do that without getting super complicated.&amp;nbsp; Something like the following maybe.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Dim oOcc As ComponentOccurrence = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter, "Select Component - or press ESC key to quit.")
If oOcc Is Nothing Then Return 'Return means exit this code routine
Dim oOccDoc As Document = oOcc.ReferencedDocumentDescriptor.ReferencedDocument
Dim SOP As IStandardObjectProvider = iLogicVb.CreateObjectProvider(oOccDoc)
Dim oFormNames As IEnumerable(Of String) = SOP.iLogicForm.FormNames
If oFormNames IsNot Nothing Then
	Dim sFormName As String = oFormNames.ElementAt(0)
	SOP.iLogicForm.Show(sFormName, FormMode.Modal)
End If&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;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@7401B55A0A518861312A0F851CD29320/emoticons/1f44d.png" alt=":thumbs_up:" title=":thumbs_up:" /&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2024 14:27:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/calling-local-form-part-from-assembly/m-p/13009391#M171550</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2024-09-09T14:27:33Z</dc:date>
    </item>
    <item>
      <title>Re: Calling Local Form Part From Assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/calling-local-form-part-from-assembly/m-p/13018281#M171731</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13518190"&gt;@Andrii_Humeniuk&lt;/a&gt;,&amp;nbsp;yes Its Totaly Works on me.&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;, Hi Sir. I Will Tray Your Code First...&lt;/P&gt;&lt;P&gt;I Have Idea that.&lt;/P&gt;&lt;P&gt;May be Or Potential. If it Works, can Put Form from Sub-Assembly or Part in First Form with Different name. it can Be default Add Ins I think.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Sep 2024 06:57:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/calling-local-form-part-from-assembly/m-p/13018281#M171731</guid>
      <dc:creator>drafter_sby2</dc:creator>
      <dc:date>2024-09-13T06:57:52Z</dc:date>
    </item>
  </channel>
</rss>

