create a ribbon button for an ilogic rule

create a ribbon button for an ilogic rule

bengee5454
Collaborator Collaborator
10,286 Views
9 Replies
Message 1 of 10

create a ribbon button for an ilogic rule

bengee5454
Collaborator
Collaborator

is there a way to add  buttn to the ribbon to activate an ilogic rule?

 

I have a rule called 'F Drive PDF' which saves a PDF to a certain drive (F:). I would like to have a button alongside my existing PDF button (in user commands) - which saves it to C:.

 

I cannot seem to figure it out!

0 Likes
Accepted solutions (2)
10,287 Views
9 Replies
Replies (9)
Message 2 of 10

Jef_E
Collaborator
Collaborator

You can add a in the ribbon button by creating an AddIn that does just that.

The button can then activate an iLogic rule, or you could just move the code entirely to the AddIn ( best option in my opinion ).

 

This community post is my similar question how to make a button.

http://forums.autodesk.com/t5/inventor-customization/add-in-creating-a-button/td-p/6268184

 

Please kudo if this post was helpfull

Please accept as solution if your problem was solved

 



Please kudo if this post was helpfull
Please accept as solution if your problem was solved

Inventor 2014 SP2
0 Likes
Message 3 of 10

mdavis22569
Mentor
Mentor

Why not set up your Ilogic browser like a ribbon ..just off to the side. You can just click it there.

The reason I say that is ...it's a lot easier this way..vs having to recode it etc via vba, registry, ini etc if the code needs to be updated or changed. You can set up your browser with external and locate ilogic depending on the template used. To me that seems a lot easier than coding.

 

 

ilogic.JPG


Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

---------
Mike Davis

EESignature

0 Likes
Message 4 of 10

bengee5454
Collaborator
Collaborator

Thank you for the response.

 

I am trying to get my head around AddIns - doesnt help that its Friday!

 

According to the link I need to access the SDK tools, however, when I follow the path (for IV 2010, I'm using IV 2014) the computer kindly tells me that it cant find any version of MS Visual Studio.Typical. I guess i need to get a version of that first..........job for next week I feel.

 

Thank you for pointing me in the right direction.

0 Likes
Message 5 of 10

bengee5454
Collaborator
Collaborator

Sorry Michael,

 

I have just seen your reply. Thats kind of what I've got at the moment (albeit under the Rules tab, not External Rules).

 

99% of the time I have the Forms tab displayed, so I was just really looking for a button to save me having to change tabs, then change back again.

forum.png

 

thanks

 

0 Likes
Message 6 of 10

mdavis22569
Mentor
Mentor

Could do a trigger ...so when you save it ..you're asked if you want to do the pdf ...and all that 


Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

---------
Mike Davis

EESignature

0 Likes
Message 7 of 10

Curtis_Waguespack
Consultant
Consultant

Hi ben.gee,

 

This can be done without creating an addin, but instead just calling a VBA macro and assigning that to a button. I'll post a video in a moment, but in the mean time here is the code that will be placed in a VBA module to do this. The video will show where to place this code.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

'Module_iLogicRules
'this module allows iLogic rules to be triggered
'from a VBA macro, fired from a ribbon button

Public Sub Hello_World()
    'ilogic rule name:
     RuniLogicExt "Hello World Rule"
End Sub
Public Sub My_Other_Rule()
    'ilogic rule name:
     RuniLogicExt "My_Other_Rule"
End Sub
Public Sub One_More_Rule()
    'ilogic rule name:
     RuniLogicExt "One_More_Rule"
End Sub

Public Sub RuniLogicExt(ByVal RuleName As String)

   Dim oPath As String
   oPath = "\\server\departments\CAD\Inventor\iLogic\"
   
   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
   MsgBox "iLogicAuto Is Nothing"
   Exit Sub
   End If

   iLogicAuto.RunExternalRule oDoc, oPath & RuleName & ".iLogicVb"
End Sub

Function GetiLogicAddin(oApplication As Inventor.Application) As Object
   Set addIns = oApplication.ApplicationAddIns
   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

 

 

You would change:

  • the macro name (Public Sub ...) 
  • the iLogic rule name (RuniLogicExt ...)
  • the Path to find the external iLogic rule(oPath = ...)

Autodesk Inventor iLogic Button Ribbon Menu.JPG

 

 

Here is the video:

 

EESignature

Message 8 of 10

Curtis_Waguespack
Consultant
Consultant

@Anonymous.gee wrote:

...

 

99% of the time I have the Forms tab displayed, so I was just really looking for a button to save me having to change tabs, then change back again.

 

 


Hi ben.gee ,

 

If that is all you're after, you can just add your internal rule to the "base" internal form see video.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

EESignature

Message 9 of 10

karthur1
Mentor
Mentor
Accepted solution

Check out the "Button Constructor" app in the app store. This is a free app that will place a button in the ribbon to fire your iLogic rule.

 

https://apps.autodesk.com/INVNTOR/en/Detail/Index?id=2268703737300536294&appLang=en&os=Win64

 

 

0 Likes
Message 10 of 10

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Updating this thread with the new info, since this thread comes up first when searching this question:

 

To create a custom button for your iLogic External Rule or  Global Form Ribbon:

  • Right-click empty space on any ribbon and select Customize User Commands
  • Set the filter for iLogic Rules or iLogic Forms in the drop-down above the left pane
  • Ensure the correct tab is listed in the drop-down above the right pane
  • In the left pane, double click a rule/form to add it to the right pane
  • Select the checkboxes to add text or make the button Large
  • Click the OK button

To create a custom icon for your iLogic External Rule or  Global Form Ribbon button:

  • Create a *.png file that is 16x16 pixels or 32x32 pixels
  • Place this image file in the same folder that the Rule or Form resides in
  • Format the name to be as such:
    • <Name of the iLogic Rule or Form> . <light or dark> . <small or large> .png

 

Example:

iLogic rule name:  Create PDF

iLogic rule button image name: Create PDF.light.small.png

 

Restart Inventor if needed.

 

 

see related link:

https://forums.autodesk.com/t5/inventor-forum/inventor-2023-ilogic-rules-and-forms-on-ribbon/m-p/110...

 

 

EESignature