Inventor Customization

Reply
Active Contributor
Passi
Posts: 48
Registered: ‎03-24-2011
Message 1 of 15 (408 Views)

The Browser is not refreshing after replacing elements with iLogic

408 Views, 14 Replies
07-10-2012 11:27 PM

Hi,

 

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
InventorVb.DocumentUpdate() 

 

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?

 

Best Regards

 

Passi 

Employee
Posts: 950
Registered: ‎02-24-2009
Message 2 of 15 (404 Views)

Re: The Browser is not refreshing after replacing elements with iLogic

07-11-2012 07:28 AM in reply to: Passi

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)

or

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.



Mike Deck
Software Developer
DLS - Mechanical Design
Autodesk, Inc.

Active Contributor
Passi
Posts: 48
Registered: ‎03-24-2011
Message 3 of 15 (393 Views)

Re: The Browser is not refreshing after replacing elements with iLogic

07-13-2012 02:41 AM in reply to: Passi

Hi and thanks for the answer.

 

It's not as easy as I hoped it would be :smileyhappy: But ok.

 

Best Regards

 

Passi 

*Expert Elite*
jdkriek
Posts: 527
Registered: ‎03-29-2007
Message 4 of 15 (375 Views)

Re: The Browser is not refreshing after replacing elements with iLogic

07-24-2012 08:45 AM in reply to: Passi

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("AssemblyBonusTools_RenameBrowserNodesCmd").Execute2(True)
End Sub

 

Jonathan D. Kriek

Autodesk Inventor Certified Expert
Microsoft Certified Application Developer
_____________________________________________________
Did I help you? Please choose Accept as Solution or Kudos below

*Expert Elite*
jdkriek
Posts: 527
Registered: ‎03-29-2007
Message 5 of 15 (360 Views)

Re: The Browser is not refreshing after replacing elements with iLogic

07-25-2012 09:31 AM in reply to: Passi

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).Name = ""
Next thisOcc

 

Set a trigger for on save and your done :smileywink:

Jonathan D. Kriek

Autodesk Inventor Certified Expert
Microsoft Certified Application Developer
_____________________________________________________
Did I help you? Please choose Accept as Solution or Kudos below

Active Contributor
Passi
Posts: 48
Registered: ‎03-24-2011
Message 6 of 15 (343 Views)

Re: The Browser is not refreshing after replacing elements with iLogic

07-29-2012 09:58 PM in reply to: Passi

Nice idea :smileyhappy:

 

To get an automatically refresh by changing the name into "" is quiet interesting.

 

Best Regards

 

Passi

Contributor
Posts: 12
Registered: ‎12-06-2012
Message 7 of 15 (252 Views)

Re: The Browser is not refreshing after replacing elements with iLogic

12-06-2012 03:54 AM in reply to: jdkriek

Hi,

 

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

Hel

*Expert Elite*
jdkriek
Posts: 527
Registered: ‎03-29-2007
Message 8 of 15 (241 Views)

Re: The Browser is not refreshing after replacing elements with iLogic

12-07-2012 08:49 AM in reply to: complex2014

lagsgh,

 

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?

Jonathan D. Kriek

Autodesk Inventor Certified Expert
Microsoft Certified Application Developer
_____________________________________________________
Did I help you? Please choose Accept as Solution or Kudos below

Contributor
Posts: 12
Registered: ‎12-06-2012
Message 9 of 15 (234 Views)

Re: The Browser is not refreshing after replacing elements with iLogic

12-09-2012 09:46 PM in reply to: Passi

incoming!

 

Thanks in advance.

*Expert Elite*
jdkriek
Posts: 527
Registered: ‎03-29-2007
Message 10 of 15 (222 Views)

Re: The Browser is not refreshing after replacing elements with iLogic

12-11-2012 11:03 AM in reply to: complex2014

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).Name = ""
        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.

Jonathan D. Kriek

Autodesk Inventor Certified Expert
Microsoft Certified Application Developer
_____________________________________________________
Did I help you? Please choose Accept as Solution or Kudos below

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor

Twitter

Facebook

Blogs

Pinterest

Youtube