Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic component browser names

12 REPLIES 12
Reply
Message 1 of 13
Anonymous
2446 Views, 12 Replies

iLogic component browser names

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.

12 REPLIES 12
Message 2 of 13
Anonymous
in reply to: Anonymous

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.

Message 3 of 13
Anonymous
in reply to: Anonymous

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
in reply to: Anonymous

@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

Message 5 of 13
Curtis_Waguespack
in reply to: Anonymous

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

Message 6 of 13
NachitoMax
in reply to: Anonymous

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 Programmer (C#, VB.Net / iLogic)


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.


Message 7 of 13
Anonymous
in reply to: NachitoMax

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

 

Thanks guys, much appreciated!

Message 8 of 13
NachitoMax
in reply to: Anonymous

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 Programmer (C#, VB.Net / iLogic)


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.


Message 9 of 13

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

Message 10 of 13


@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


Message 11 of 13

		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.

Message 12 of 13

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.

Message 13 of 13
maxim.teleguz
in reply to: Anonymous

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

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report