Collapsing "Drawing Ressources" in Drawing BrowserPane

Collapsing "Drawing Ressources" in Drawing BrowserPane

bshbsh
Collaborator Collaborator
754 Views
10 Replies
Message 1 of 11

Collapsing "Drawing Ressources" in Drawing BrowserPane

bshbsh
Collaborator
Collaborator

Hello,

I'm doing some edits on TitleBlocks with a macro, and the Edit always expands the "Drawingressources" node. But I can't get it collapsed no matter how I try.

I tried going thru all the Browsernodes in the Browserpane and set Expanded=false, which does set the Drawingressources.Expanded to false, but it still remains expanded, even after updating the pane.

I also tried to just set the entire BrowserPane.Topnode.Expanded to False (which would be what I want), but it doesn't work either - no visible effect.

Tried to select the node and run the internal command "AppBrowserCollapseChildrenCmd" and "AppBrowserCollapseAllCmd", no effect.

Does anyone know how to collapse this entire tree?

Thanks.

0 Likes
755 Views
10 Replies
Replies (10)
Message 2 of 11

Anonymous
Not applicable

Try this, it works for me:

 

    Dim oPane As BrowserPane
    Set oPane = oDrawDoc.BrowserPanes.Item("Model")
    
    oPane.TopNode.BrowserNodes.Item(1).Expanded = False

0 Likes
Message 3 of 11

bshbsh
Collaborator
Collaborator

for me it does not.

here's a snippet, with some things I tried in it (the commandmanager approach isnt there anymore).

    Dim DrwSketch As DrawingSketch
    If TitleBlockDef.Name = "xxxx" Then
        ThisApplication.ScreenUpdating = False
        Call TitleBlockDef.Edit(DrwSketch)
        OrigDatum = DrwSketch.TextBoxes.Item(16).FormattedText
        DrwSketch.TextBoxes.Item(16).FormattedText = "<StyleOverride FontSize='0,2'>" & Format(InvDoc.ReferencedDocuments.Item(1).PropertySets.Item("Design Tracking Properties").Item("Creation Time").Value, "DD.MM.YYYY") & "</StyleOverride>"
        DrwSketch.TextBoxes.Item(16).SingleLineText = True
Call TitleBlockDef.ExitEdit(True) ThisApplication.ScreenUpdating = True For Each BrowserNode In InvDoc.BrowserPanes.Item("DlHierarchy").TopNode.BrowserNodes BrowserNode.Expanded = False Next InvDoc.BrowserPanes.Item("DlHierarchy").TopNode.BrowserNodes.Item(1).Expanded = False InvDoc.BrowserPanes.Item("DlHierarchy").TopNode.Expanded = False InvDoc.BrowserPanes.Item("DlHierarchy").Update End If
0 Likes
Message 4 of 11

Anonymous
Not applicable

Are you trying to set .Expanded value for "DlHierarchy" or for "Drawing Resources"? FYI, in your code you are trying to change .Expanded value for "DlHierarchy" which, I think, is misspelled.

 

0 Likes
Message 5 of 11

bshbsh
Collaborator
Collaborator

No it's not misspelled.

I've tried everything. Those are different tries.

The for each loop should "compact" all nodes under the top node (xxxxx.idw), the first of those is the drawing resources "folder".

The next line should directly collapse the drawing ressources, which is the first node under the DlHierarchy topnode.

The next line should completely collapse the entire browser to a single line (xxxxx.idw)

I've been playing with this a lot, and don't get it: sometimes, if traced line by line, it does work (all of the three different methods above!), but sometimes it does not, even though I see in the watch window that it does set expanden to false, yet it does not compact anything. But sometimes it does.

I think this could be a screen redraw/update issue or something.

0 Likes
Message 6 of 11

Anonymous
Not applicable

Why don't you call this node Item(1) in your code or by its name "Drawing Resources" and in your loop when node name matches string, then you set expand to false?

0 Likes
Message 7 of 11

bshbsh
Collaborator
Collaborator

because it isn't always called "Drawing Resources"? It's language dependant. (That's why I'm using "dlhierarchy" instead of "model".)

0 Likes
Message 8 of 11

Anonymous
Not applicable

"Model" tab is always Item(1). Use this instead of tab name.

    Dim oPane As BrowserPane
    Set oPane = oDrawDoc.BrowserPanes.Item(1)

Then use

oPane.TopNode.BrowserNodes.Item(1).Expanded = False

to focus on first node.

This code is language independent.

0 Likes
Message 9 of 11

Tiffany_Hayden_
Collaborator
Collaborator

I just ran into a situation where the Set oPane = oDrawDoc.BrowserPanes.Item(1) did not point to the one that had the nodes. So the oDrawDoc.BrowserPanes.item("DlHierarchy") worked perfectly. So there are situations where 1 doesn't work. 

 

Just FYI! 

Thanks! 

Tiffany Hayden
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.

EESignature

0 Likes
Message 10 of 11

tobias_wiesendanger
Advocate
Advocate

I can totally relate to OP's problem. This doesnt work most of the time. Im not sure if it is something that is not working with the german inventor version but I tried alot of "solutions" and most of the time this just doesnt work and should be fixed. Autodesk support was of no help either.

 

There are even situations where Expanded = false leads to expanding a node that already is collapsed, because ** me I guess.

 

The best thing is. It works perfectly for me when using vba but does not when used in c#.

0 Likes
Message 11 of 11

Matt22SC
Explorer
Explorer

Try this

 

oDoc = ThisApplication.ActiveDocument
oModelBP = oDoc.BrowserPanes.Item("DlHierarchy")
For Each oNode In oModelBP.TopNode.BrowserNodes
	oNode.Expanded = False
Next
0 Likes