IMPROVED: iProperty Tool-Tip with iLogic

@ClintBrown3D Autodesk Inventor 15-min.png

A few months back I created an iProperties Tool-Tip for Inventor Assembly files. The tool sets the selection filter to “Part Priority” and then displays a set of iProperties for that part. The original blog post can be found by clicking on the image below:

@ClintBrown3D Autodesk Inventor 07

New and improved:

I recently found myself working on a project for a customer, where I has imported a bunch of data from PTC Creo into Inventor. I had to learn my way around a relatively complex tooling model and I thought that my iProperties tool-tip would come in handy.

The first problem I encountered however was that the description for many of the parts was blank, and the second issue, is that I had to run the tool every time I wanted to look at a part. With this in mind, I tweaked the code to show me the name of the part, as the description (if the iProperty was not filled in), and to continue running until I hit Esc.

The message box on the left shows a description followed by an asterisk*, this is data pulled from the file name, the asterisk is to show that this is a derived property. The box on the right, is displaying the description from the iProperties.

Summary of Improvements:

  • Description is now pulled from the file name if iProperty is blank
  • Tool continues running, till users hits Esc

The Animated GIF below shows the tool-tip in action:

iProperties Tool Tip updated
Click me for higher res version

Here is the updated iLogic Code:

Note that the name of the rule should be “Iprop Tooltip”, otherwise you will need to re-name the rule in the code (see section with comments below). I have also included a section for internal as well as external rules.

'Code by @ClintBrown3D
'Originally posted at https://clintbrown.co.uk/iproperty-tool-tip-with-ilogic-updated
'This is an updated of the code found here: https://clintbrown.co.uk/iproperty-tool-tip-with-ilogic
'Mouse input code based on this forum post: https://forums.autodesk.com/t5/inventor-customization/ilogic-to-handle-mouse-event-for-part-selection/td-p/3902918

On Error GoTo ClintBrown3D

Dim doc = ThisApplication.ActiveDocument
Dim entity = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyLeafOccurrenceFilter, "Select a Part :) - or ESC to exit")

If (Not entity Is Nothing) Then
	oOne = "Part Number  : " & iProperties.Value(entity.Name, "Project", "Part Number")
	oTwo = "Mass               : " & Round(iProperties.MassOfComponent(entity.Name), 2) & " kg"
	oThree = "Material          : " & iProperties.MaterialOfComponent(entity.Name)
	oFour = "Designer         : " & iProperties.Value(entity.Name, "Project", "Designer")
	oFive = "Description     : " & iProperties.Value(entity.Name, "Project", "Description")
	
		'--------------Show File Name in oFive if Description iProp is empty---------------
		If iProperties.Value(entity.Name, "Project", "Description") = "" Then : oFive = "Description     : " & entity.Name & "     *" : End If
		'--------------Show File Name in oFive if Description iProp is empty---------------
	
	MessageBox.Show(oOne & vbLf & oTwo & vbLf & oThree & vbLf & oFour & vbLf & oFive, entity.Name & "    @ClintBrown3D")
	InventorVb.DocumentUpdate(False)
End If

'Allow Escape to Exit *** IMPORTANT Change the name of the rule below to match your rule ("Iprop Tooltip") = ("YOUR RULE NAME")
If (Not entity Is Nothing) Then
iLogicVb.RunExternalRule("Iprop Tooltip")'for External Rule
'iLogicVb.RunRule("Iprop Tooltip")'for internal rule
End If

Return 
ClintBrown3D:

CODE UPDATE: 19 – 08 – 2019

In this new iteration of the code, you do not need to worry about the rule name, just set whether the rule is internal or external (code below is defaulted to “internal”). This is commented towards the end of the rule, search for *** IMPORTANT

I have used iLogic to pull the rule name, meaning that the rule will continue to repeat itself until the user hits Esc the name of the rule no longer needs to be set manually.

GetRuleName = iLogicVb.RuleName

Here is the full code:

'Code by @ClintBrown3D
'Originally posted at https://clintbrown.co.uk/iproperty-tool-tip-with-ilogic-updated
'This is an updated of the code found here: https://clintbrown.co.uk/iproperty-tool-tip-with-ilogic
'Mouse input code based on this forum post: https://forums.autodesk.com/t5/inventor-customization/ilogic-to-handle-mouse-event-for-part-selection/td-p/3902918

On Error GoTo ClintBrown3D

Dim doc = ThisApplication.ActiveDocument
Dim entity = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyLeafOccurrenceFilter, "Select a Part :) - or ESC to exit")

If (Not entity Is Nothing) Then
	oOne = "Part Number  : " & iProperties.Value(entity.Name, "Project", "Part Number")
	oTwo = "Mass               : " & Round(iProperties.MassOfComponent(entity.Name), 2) & " kg"
	oThree = "Material          : " & iProperties.MaterialOfComponent(entity.Name)
	oFour = "Designer         : " & iProperties.Value(entity.Name, "Project", "Designer")
	oFive = "Description     : " & iProperties.Value(entity.Name, "Project", "Description")
	
		'--------------Show File Name in oFive if Description iProp is empty---------------
		If iProperties.Value(entity.Name, "Project", "Description") = "" Then : oFive = "Description     : " & entity.Name & "     *" : End If
		'--------------Show File Name in oFive if Description iProp is empty---------------
	
	MessageBox.Show(oOne & vbLf & oTwo & vbLf & oThree & vbLf & oFour & vbLf & oFive, entity.Name & "    @ClintBrown3D")
	InventorVb.DocumentUpdate(False)
End If

'Allow Escape to Exit *** IMPORTANT change the rule type below. It must be set to internal or external
If (Not entity Is Nothing) Then
GetRuleName = iLogicVb.RuleName
'iLogicVb.RunExternalRule(GetRuleName)'for External Rule
iLogicVb.RunRule(GetRuleName)'for internal rule
End If

Return 
ClintBrown3D:

2 thoughts on “IMPROVED: iProperty Tool-Tip with iLogic

  1. Great tool, but It only works once. It doesn’t keep working until escape is hit (at least not on my computer)…?

    Like

  2. Hi Johan, the name of the rule should be “Iprop Tooltip”, otherwise you will need to re-name the rule in the code (see section with comments below). I have also included a section for internal as well as external rules, so that you can choose.

    Liked by 1 person

Comments are closed.