iLogic component browser names

iLogic component browser names

Anonymous
Not applicable
3,123 Views
12 Replies
Message 1 of 13

iLogic component browser names

Anonymous
Not applicable

I am stabilizing many component names in assemblies for use in iLogic rules. But this has lead to many complaints about no longer being able to identify the file name easily.

Is there a setting in Inventor that could display the file name next to the display name? Or another quicker method than accessing iProperties or the BOM dialog to see file names.

0 Likes
3,124 Views
12 Replies
Replies (12)
Message 2 of 13

Anonymous
Not applicable

I thought I was onto something when I read this on the Inventor help page

 

"You can change the component back to its original name and still preserve its stability. To change the component, make a minor change to the name, and then change it back to the original."

 

But I don't understand how this works in practice, changing the name back removes its stability and the rules that reference it no longer work.

0 Likes
Message 3 of 13

Anonymous
Not applicable

Hi @Anonymous

 

Component's browser name settings can be changed from "Assemble<Productivity<Rename Browser Nodes" tab on Ribbon

Browser name can be changed to File Name or Part Number or Default

 

Browser Node Name#1.JPGBrowser Node Name#2.JPGBrowser Node Name#3.JPG

 

Thanks & Regards,

Tushar

 

Message 4 of 13

Anonymous
Not applicable

@Anonymous

Thanks, but I was hoping there would be a way of keeping the browser names stabilized (as they are referenced in iLogic rules), but somehow show their part number or file name as well in the browser. Renaming the browser nodes causes the rules to fail.

component.replace.PNG

0 Likes
Message 5 of 13

Curtis_Waguespack
Consultant
Consultant

Hi c.henderson2HQZG,

 

Could you create a custom iProperty called something like "Stabilized Name", and then before the rule runs, have the display name change to use that iProperty, and then at the end of the rule have it change to use the file name?

 

I would make this 2 separate external iLogic rules and then run the 1 rule at the beginning of your other rules, and the 2nd at the end.

 

I've been intending to write something like that for a while, because I'm like your users and prefer to see the file names, but just haven't stopped to do it yet.

 

Post back if you try it and it doesn't work and I'll to take a closer look.

 

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

EESignature

Message 6 of 13

NachoShaw
Advisor
Advisor
Hi

I wrote 2 functions a while ago that I'm happy to share.

Routine 1
Renames the browser node to the display name of the document referenced in the first view on each page

Routine 2
Resets the sheet names to Sheet

If you think they will help, let me know and I'll send then tomorrow evening


Nacho

Nacho
Automation & Design Engineer

Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 Likes
Message 7 of 13

Anonymous
Not applicable

@NachoShaw Yeah please, hopefully that could give me a good start to achieve something like @Curtis_Waguespack has suggested above.

 

Thanks guys, much appreciated!

0 Likes
Message 8 of 13

NachoShaw
Advisor
Advisor

Hi

 

Here is the code I mentioned (also see attached video of it working)-

 

Rename Sheets

Add 'RenameSheets' to the ribbon as a button

When clicked, it will rename each sheet to the name of the referenced object in the 1st drawing view

 

Public Sub ReNameSheets()

Dim oDoc As DrawingDocument
Set oDoc = ThisApplication.ActiveDocument

Dim osheets As Sheets
Set osheets = oDoc.Sheets

Dim oSheet As Sheet
Set oSheet = oDoc.ActiveSheet

Dim defSheetLabel As String
defSheetLabel = oDoc.SheetSettings.SheetLabel

Dim sCount As Integer


For Each oSheet In osheets
    On Error Resume Next
    'oSheet.Activate
    Dim oDrawingView As DrawingView
    Set oDrawingView = oSheet.DrawingViews(1)
    omodelname = oDrawingView.ReferencedDocumentDescriptor.ReferencedDocument.DisplayName
oSheet.Name = omodelname & " - " & defSheetLabel
Next

End Sub

Reset Sheets

Add 'ResetSheets' to the ribbon as a button

When clicked, it will rename all sheets to the generic 'Sheet'

Public Sub ResetSheets()

Dim oDoc As DrawingDocument
Set oDoc = ThisApplication.ActiveDocument

Dim osheets As Sheets
Set osheets = oDoc.Sheets

Dim oSheet As Sheet
Set oSheet = oDoc.ActiveSheet

Dim defSheetLabel As String
defSheetLabel = oDoc.SheetSettings.SheetLabel

Dim sCount As Integer


For Each oSheet In osheets
    'oSheet.Activate
    Dim oDrawingView As DrawingView
    Set oDrawingView = oSheet.DrawingViews(1)
    
oSheet.Name = defSheetLabel
Next

 

Nacho
Automation & Design Engineer

Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 Likes
Message 9 of 13

JimmyDoe
Collaborator
Collaborator

Any chance you got around to this?...Smiley Surprised

0 Likes
Message 10 of 13

Curtis_Waguespack
Consultant
Consultant

@JimmyDoe wrote:

Any chance you got around to this?...Smiley Surprised



Hi JimmyDoe,

 

Sort of.

 

Here's an example that gets the stabilized name and writes it to a custom iprop, and then toggle the browser name to the be the file name, or vice versa.

 

Experiment with this on a test assembly in case it's buggy, as it could wipe out your stabilized names.

 

Note too that as written it uses the assembly name as part of the custom iProp, so that a file used in multiple assemblies can have multiple "stabilized" names. Meaning that you'd have multiple custom iprops in the part file. You can remove that if needed, and just have it write to the same iprop if you want.

 

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

 

 

'check for variable to hold inputradiobox value
If SharedVariable.Exists("Input_Value") = False Then
	SharedVariable("Input_Value") = True
End If

'get user input
sOption1 = "Browser currently has Stablized Names"
sOption2 = "Browser currently has File Names"
bStabilizedName = InputRadioBox("Select an option:", sOption1, sOption2, _
	SharedVariable("Input_Value"), "iLogic - Toggle browser names")

Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition

oAssemblyName = _
System.IO.Path.GetFileNameWithoutExtension(ThisApplication.ActiveDocument.FullFileName)

oIpropName = "Stabilized_Name_" & oAssemblyName

'Iterate through all of the occurrences
Dim oOcc As ComponentOccurrence
For Each oOcc In oAsmCompDef.Occurrences.AllReferencedOccurrences(oAsmCompDef)  
	docFile = oOcc.Definition.Document
    docName = System.IO.Path.GetFileNameWithoutExtension(docFile.FullFileName)

	If bStabilizedName = True Then
		iProperties.Value(oOcc.Name, "Custom", oIpropName) = oOcc.Name 
		'clear browser name override by setting to nothing
		'which resets it to file name
		oOcc.Name  = ""
		
		'set variable to hold inputradiobox value
		SharedVariable("Input_Value") = False
	Else
		'set occurence name to stablized name
		oOcc.Name = iProperties.Value(oOcc.Name, "Custom", oIpropName) 
		
		'set 'variable to hold inputradiobox value
		SharedVariable("Input_Value") = True
	End If
	
Next


EESignature

Message 11 of 13

RoyWickrama_RWEI
Advisor
Advisor
		docFile = oOcc.Definition.Document
    		oParent = System.IO.Path.GetFileNameWithoutExtension(docFile.FullFileName)

I used the above part from your rule: that is working. But could I extract the file extension.

I appreciate if you could reply, Thanks.

0 Likes
Message 12 of 13

RoyWickrama_RWEI
Advisor
Advisor

Hi Curtis;

Please disregard my previous request. I m getting it around

		docFile = oOcc.Definition.Document
'    		oParent = System.IO.Path.GetFileNameWithoutExtension(docFile.FullFileName)
    		oParent = System.IO.Path.GetFileName(docFile.FullFileName)

All the best.

0 Likes
Message 13 of 13

maxim.teleguz
Advocate
Advocate
c = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAllEntitiesFilter, "Select component")
d = Component.InventorComponent(c.name).Definition.Document.FullFileName
f = IO.Path.GetFileNameWithoutExtension(d)
MsgBox(f)

 

0 Likes