Strange behaviour - BrowserPane.GetBrowserNodeFromObject

Strange behaviour - BrowserPane.GetBrowserNodeFromObject

amitabhVA4SD
Advocate Advocate
359 Views
5 Replies
Message 1 of 6

Strange behaviour - BrowserPane.GetBrowserNodeFromObject

amitabhVA4SD
Advocate
Advocate

Hello Everyone,

 

I am using the BrowserPane.GetBrowserNodeFromObject Inventor API (Inventor 2020.4) to read the Browser Nodes/Tree Nodes from the Inventor Browser Pane. I am using this API to read the node path all the way from the tree root node (i.e AAA/BBBB/CCCC/...). This path is then used to determine if there are any Parts inside specific Browser Folders (Like Standards, Reference, etc) that I should ignore while collecting all the Parts in the Assembly. I have to do this round-about way since Inventor does not have any direct API that provides the Browser Folder Name which is Parent to the Part. Strangely this API is failing the first time and working without any code changes every subsequent time.

 

Has anyone faced a similar issue?

 

Thanks,

Amitabh

0 Likes
360 Views
5 Replies
Replies (5)
Message 2 of 6

bradeneuropeArthur
Mentor
Mentor
It will help if you share the code here.

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 6

WCrihfield
Mentor
Mentor

Hi @amitabhVA4SD.  This does sound a little familiar, but can't recall anything specific.  A couple questions to ponder though.  Is it possible that the assembly is loaded in 'Express Mode', instead of 'Full', and the path of that node includes something that was not initially loaded yet?  If that was the case, the initial access may load it into memory, then subsequent calls are finding it.  Or is it possible that something in the node's path is suppressed?  Maybe if that is the case, something similar is happening...a reference gets loaded to support your access call the first time, but not available for that first call, then available for follow up calls.  Just a couple of thoughts to explore.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 4 of 6

amitabhVA4SD
Advocate
Advocate

Thanks for the insight, @WCrihfield. The explanation is starting to  make sense but we are loading the Assembly Fully using Inventor Command Manager with code and also ignoring any suppressed or invisible parts in the assembly while collecting the occurrences from the Inventor Tree. Then we are feeding these occurrences to the API to read the path. The reason we have to load the assembly fully is to do with working with the Topology, Geometry and Bounding Box as part of the bigger problem statement.
I will share some sample code as well (for reference)

Thanks,

Amitabh

0 Likes
Message 5 of 6

amitabhVA4SD
Advocate
Advocate

sure @bradeneuropeArthur . We are getting the issue while working with the very first occurrence in the tree.

 

 public static class StaticVariables
    {
        private static BrowserPane _browserPane;
        public static Inventor.BrowserPane BrowserPane =>
            _browserPane ?? (_browserPane =
                (VctApplication.InventorApp.ActiveDocument as Inventor.AssemblyDocument).BrowserPanes[
                    "AmBrowserArrangement"]);

        public static string GetPath(ComponentOccurrence occurrence)
        {
            if (occurrence.Name.ToUpper().Contains("WELDBEAD")) return string.Empty;
            return BrowserPane.GetBrowserNodeFromObject(occurrence).FullPath;
        }
    }


Thanks,

Amitabh

0 Likes
Message 6 of 6

WCrihfield
Mentor
Mentor

I do not profess to be that fluent in C#, but that code seems fairly simple.  Now I am wandering if maybe your overall project code is somehow simply not waiting for the assembly get fully loaded before proceeding to attempt this 'get' request from it that first time.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes