<?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: Create a Ribbon Button to run iLogic in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/create-a-ribbon-button-to-run-ilogic/m-p/8480382#M92666</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That's the problem, I cannot modify the templates as our company overviews them. I delete the rule as later on the model will be used by people, who are not familiar with iLogic and it is not necessary. Kind of cleaning the model.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But the idea of external rule is perfect! I don't know why I didn't figure it out by myself &lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@F982DDE76110C67DBDB6AF220B48480A/emoticons/1f604.png" alt=":grinning_face_with_smiling_eyes:" title=":grinning_face_with_smiling_eyes:" /&gt; But this will work on my case, thanks !&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-Ossi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 20 Dec 2018 10:21:19 GMT</pubDate>
    <dc:creator>InventorMan1</dc:creator>
    <dc:date>2018-12-20T10:21:19Z</dc:date>
    <item>
      <title>Create a Ribbon Button to run iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/create-a-ribbon-button-to-run-ilogic/m-p/8472655#M92501</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not too familiar with VBA but I have been using iLogic in order to set up some basic data on some part/assembly-files. I cannot create myself a different template, as my company restricts this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thing I need:&lt;BR /&gt;&amp;nbsp;- New custom iProperties. I've been using iProperties.Value-snippet.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;- New parameters, with certain formatting. For this i have used iLogic, shown below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;doc = ThisDoc.Document 'Defining document and providing access to parameters on different levels.&lt;/P&gt;
&lt;P&gt;Dim oPartCompDef As PartComponentDefinition = doc.ComponentDefinition&lt;/P&gt;
&lt;P&gt;Dim oParams As Parameters = oPartCompDef.Parameters&lt;/P&gt;
&lt;P&gt;Dim oUserParams As UserParameters = oParams.UserParameters&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;oUserParams.AddByValue(“XXX_LENGTH”, 0, “mm”) 'Creating needed XXX-parameters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;oLength = Parameter.Param("XXX_LENGTH") 'Defining Custom Properties for parameter&lt;/P&gt;
&lt;P&gt;oLength.ExposedAsProperty = True&lt;/P&gt;
&lt;P&gt;oFormat=oLength.CustomPropertyFormat&lt;/P&gt;
&lt;P&gt;oFormat.PropertyType=Inventor.CustomPropertyTypeEnum.kTextPropertyType&lt;/P&gt;
&lt;P&gt;oFormat.Precision=Inventor.CustomPropertyPrecisionEnum.kZeroDecimalPlacePrecision&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My question is, how could I create a button to my Inventor ribbon, that could run these kind of iLogic codes?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-Ossi&lt;/P&gt;</description>
      <pubDate>Mon, 17 Dec 2018 15:17:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/create-a-ribbon-button-to-run-ilogic/m-p/8472655#M92501</guid>
      <dc:creator>InventorMan1</dc:creator>
      <dc:date>2018-12-17T15:17:55Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Ribbon Button to run iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/create-a-ribbon-button-to-run-ilogic/m-p/8473036#M92517</link>
      <description>&lt;P&gt;iLogic's only easy method is the iLogic browser which is not ribbon based, but it is a nifty dockable palette.&amp;nbsp; However, iLogic editor allows you to write VB.Net code, from there you can write a command that can edit the ribbon, and add one or many CommandControls.&amp;nbsp; If your going that far, you could write a complete add-in using straight up vb.net and visual studio, that autoloads every time Inventor opens (next level stuff = learning curve).&lt;/P&gt;</description>
      <pubDate>Mon, 17 Dec 2018 17:17:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/create-a-ribbon-button-to-run-ilogic/m-p/8473036#M92517</guid>
      <dc:creator>JamieVJohnson2</dc:creator>
      <dc:date>2018-12-17T17:17:17Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Ribbon Button to run iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/create-a-ribbon-button-to-run-ilogic/m-p/8480218#M92660</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;
&lt;P&gt;If the iLogic rules are placed in the documents, use this VBA code.&lt;/P&gt;
&lt;P&gt;Add it to a Module in the VBA editor.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Public Sub LaunchMyRule1   '&amp;lt;--- This is what you would tie to a button in a toolbar.
  RuniLogic "MyRule1"      '&amp;lt;--- Name of your iLogic rule
End sub
 
Public Sub LaunchMyRule2   '&amp;lt;--- This is what you would tie to a button in a toolbar.
  RuniLogic "MyRule2"      '&amp;lt;--- Name of your iLogic rule
End sub

Public Sub RuniLogic(ByVal RuleName As String)
  Dim iLogicAuto As Object
  Dim oDoc As Document
  Set oDoc = ThisApplication.ActiveDocument
  If oDoc Is Nothing Then
    MsgBox "Missing Inventor Document"
    Exit Sub
  End If
  Set iLogicAuto = GetiLogicAddin(ThisApplication)
  If (iLogicAuto Is Nothing) Then Exit Sub
  iLogicAuto.RunRule oDoc, RuleName
End Sub
 
Public Function GetiLogicAddin(oApplication As Inventor.Application) As Object
Set addIns = oApplication.ApplicationAddIns
'Find the add-in you are looking for
Dim addIn As ApplicationAddIn
On Error GoTo NotFound
Set addIn = oApplication.ApplicationAddIns.ItemById("{3bdd8d79-2179-4b11-8a5a-257b1c0263ac}")
If (addIn Is Nothing) Then Exit Function
addIn.Activate
Set GetiLogicAddin = addIn.Automation
Exit Function
NotFound:
End Function&lt;/PRE&gt;
&lt;P&gt;Then just add it to your ribbon.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ribbon.JPG" style="width: 875px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/583460i52F109A2B9BC7A83/image-size/large?v=v2&amp;amp;px=999" role="button" title="Ribbon.JPG" alt="Ribbon.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Dec 2018 08:31:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/create-a-ribbon-button-to-run-ilogic/m-p/8480218#M92660</guid>
      <dc:creator>Jesper_S</dc:creator>
      <dc:date>2018-12-20T08:31:54Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Ribbon Button to run iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/create-a-ribbon-button-to-run-ilogic/m-p/8480333#M92663</link>
      <description>&lt;P&gt;Is it possible to do a iLogic Browser rule, that is always in the application, no matter what part-file is open?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, that when I'm creating a new file, I could just run the rule and get the properties updated?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-Ossi&lt;/P&gt;</description>
      <pubDate>Thu, 20 Dec 2018 09:49:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/create-a-ribbon-button-to-run-ilogic/m-p/8480333#M92663</guid>
      <dc:creator>InventorMan1</dc:creator>
      <dc:date>2018-12-20T09:49:14Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Ribbon Button to run iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/create-a-ribbon-button-to-run-ilogic/m-p/8480338#M92664</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the code. Unfortunately, when I create a new file, the rule is not in place in the file. That is the root problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Currently I just create a new rule, copy-paste the code from word-file and run the rule. Code itself includes line, that removes the rule. So situation is quite decent, but it's always nice, when you can reduce the amount of clicks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-Ossi&lt;/P&gt;</description>
      <pubDate>Thu, 20 Dec 2018 09:52:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/create-a-ribbon-button-to-run-ilogic/m-p/8480338#M92664</guid>
      <dc:creator>InventorMan1</dc:creator>
      <dc:date>2018-12-20T09:52:26Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Ribbon Button to run iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/create-a-ribbon-button-to-run-ilogic/m-p/8480364#M92665</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Either you place the Rule in your Templates so it's always there.&lt;/P&gt;
&lt;P&gt;Or you place your Rule as an External Rule in Inventor.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why do you remove the code?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can't you add the parameters and iProperty to your Templates?&lt;/P&gt;</description>
      <pubDate>Thu, 20 Dec 2018 10:12:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/create-a-ribbon-button-to-run-ilogic/m-p/8480364#M92665</guid>
      <dc:creator>Jesper_S</dc:creator>
      <dc:date>2018-12-20T10:12:52Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Ribbon Button to run iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/create-a-ribbon-button-to-run-ilogic/m-p/8480382#M92666</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That's the problem, I cannot modify the templates as our company overviews them. I delete the rule as later on the model will be used by people, who are not familiar with iLogic and it is not necessary. Kind of cleaning the model.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But the idea of external rule is perfect! I don't know why I didn't figure it out by myself &lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@F982DDE76110C67DBDB6AF220B48480A/emoticons/1f604.png" alt=":grinning_face_with_smiling_eyes:" title=":grinning_face_with_smiling_eyes:" /&gt; But this will work on my case, thanks !&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-Ossi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Dec 2018 10:21:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/create-a-ribbon-button-to-run-ilogic/m-p/8480382#M92666</guid>
      <dc:creator>InventorMan1</dc:creator>
      <dc:date>2018-12-20T10:21:19Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Ribbon Button to run iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/create-a-ribbon-button-to-run-ilogic/m-p/8480510#M92669</link>
      <description>&lt;P&gt;Create an External rule.&lt;/P&gt;
&lt;P&gt;Then add this to VBA instead.&lt;/P&gt;
&lt;PRE&gt;Public Sub LaunchMyRule1()
RuniLogic ("MyRule1")
End Sub&lt;BR /&gt;
Public Sub LaunchMyRule2()
RuniLogic ("MyRule2")
End Sub&lt;BR /&gt;
Public Sub RuniLogic(ByVal RuleName As String)
Dim iLogicAuto As Object
Dim oDoc As Document
Set oDoc = ThisApplication.ActiveEditDocument
If oDoc Is Nothing Then
MsgBox "Missing Inventor Document"
Exit Sub
End If
Set iLogicAuto = GetiLogicAddin(ThisApplication)
If (iLogicAuto Is Nothing) Then Exit Sub
iLogicAuto.RunExternalRule oDoc, RuleName
End Sub
Public Function GetiLogicAddin(oApplication As Inventor.Application) As Object
Dim addIn As ApplicationAddIn
On Error GoTo NotFound
Set addIn = oApplication.ApplicationAddIns.ItemById("{3bdd8d79-2179-4b11-8a5a-257b1c0263ac}")
If (addIn Is Nothing) Then Exit Function
addIn.Activate
Set GetiLogicAddin = addIn.Automation
Exit Function
NotFound:
End Function
&lt;/PRE&gt;
&lt;P&gt;Same thing but this works with External rules.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Dec 2018 11:38:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/create-a-ribbon-button-to-run-ilogic/m-p/8480510#M92669</guid>
      <dc:creator>Jesper_S</dc:creator>
      <dc:date>2018-12-20T11:38:32Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Ribbon Button to run iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/create-a-ribbon-button-to-run-ilogic/m-p/9071905#M101965</link>
      <description>&lt;P&gt;Works fantastic! I just had to change the module name, and presto!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2019 20:56:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/create-a-ribbon-button-to-run-ilogic/m-p/9071905#M101965</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-10-07T20:56:50Z</dc:date>
    </item>
  </channel>
</rss>

