When I replace elements with iLogic the Inventor Browser is not automatically refreshed.
E.g. I have a file A.ipt and I replace it with B.ipt then in the Brwoser will be shown: A.ipt:1, even when B is already inserted.
Is there some refresh, like "Update Browser nodes when done" ?
These both has no influence on it:
iLogicVb.UpdateWhenDone = True
By the way. To Update the Browser manually, I have to rename the block nodes (From Filename to Filename). So it's only opening up the Renaming Function and then hitting "ok".
If there's no direct function to update the Browser, maybe there's a way to do the manually way by iLogic?
The standard method is to rename the browser node manually (for instance to AorB:1). Then use that name in your rule:
Component.Replace("AorB:1", "A.ipt", False)
Component.Replace("AorB:1", "B.ipt", False)
With this method, the browser always shows the name "AorB:1" for the component. That is the constant name is used to identify the component in the iLogic rule. The disadvantage of this is that you don't see the particular filename in the browser. Instead, the component name is always the same.
In the Assembly look at Assemble Tab > Productivity > Rename Browser Nodes
You can then select either Filename or Part Number and update the entire browser with one click.
Perhaps we can trigger this programatically?
Public Sub RenameBrowserNodes() Dim oDoc As Document Dim oCommandMgr As CommandManager Set oDoc = ThisApplication.ActiveDocument Set oCommandMgr = ThisApplication.CommandManager Call oCommandMgr.ControlDefinitions.Item("AssemblyBonus
Tools_RenameBrowserNodesCmd").Execute2(True) End Sub
I ended up writing an automated solution in iLogic - quite easy actually.
Exactly what you were doing manually, but automaticly, lol
It fills in the name with a blank, which resets the name with current information.
'J.Kriek 2012 Dim oAssy As AssemblyDocument: oAssy = ThisApplication.ActiveDocument Dim thisOcc As Integer For thisOcc = 1 To oAssy.ComponentDefinition.Occurrences.count oAssy.ComponentDefinition.Occurrences(thisOcc).Nam
e = "" Next thisOcc
Set a trigger for on save and your done
I tried your ilogic-code in INV2012proSP2 and Ilogic says that there is following error
"method arguments must be enclosed in parentheses"
Also doesn't help if I check the "VB-only" checkbox in rules-editor.
Can you imagine what's wrong?
Thank you in advance
I don't get that error in 2012, or 2011-2013 for that matter.
Can you post the Assy that you are seeing this error in and any additional code you may be running?
Interesting, I have repeated your error, but I have no idea why it's doing that. The code works fine in VBA in all the latest versions and 2011 iLogic, but not in 2012 iLogic. They must have changed something.
Lets try this. Go to Tools > VBA Editor
Then Create a new Module by right-clicking the Project and choosing Insert > Module
Then paste this in that Module:
Public Sub ResetBrowser() 'J.Kriek 2012 Dim oApp As Application Set oApp = ThisApplication If oApp.ActiveDocument.DocumentType = kAssemblyDocumentObject Then Dim oAssy As AssemblyDocument Set oAssy = oApp.ActiveDocument Dim thisOcc As Integer For thisOcc = 1 To oAssy.ComponentDefinition.Occurrences.count oAssy.ComponentDefinition.Occurrences(thisOcc).Nam
e = "" Next thisOcc End If End Sub
Then in the iLogic Rule put the following:
InventorVb.RunMacro("VBAProjectName", "ModuleName", "ResetBrowser")
Be sure to change VBAProjectName and ModuleName to what you named them.
Access a broad range of knowledge to help get the most out of your products and services.