BrowserNode.Expanded = True throws an exception

BrowserNode.Expanded = True throws an exception

Anton_Chernomazov
Contributor Contributor
386 Vistas
4 Respuestas
Mensaje 1 de 5

BrowserNode.Expanded = True throws an exception

Anton_Chernomazov
Contributor
Contributor

I'm using C# Inventor AddIn to search an BrowserNode object in BrowserPane and execute some command. When I have target BrowserNode I try to set Expanded propery value as True. But in this case an exception occurs. How to expand BrowserNode?

0 Me gusta
387 Vistas
4 Respuestas
Respuestas (4)
Mensaje 2 de 5

JelteDeJong
Mentor
Mentor

I did a small test. This is my test code and it works like expected.

PartDocument doc = (PartDocument)ThisDoc.Document;
BrowserNode node = doc.BrowserPanes["Model"].TopNode;

BrowserNode childNode = node.BrowserNodes[1];
childNode.Expanded = true;

 Can you share a bit more of your code and/or the node that you are trying to expand?

Jelte de Jong
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


Blog: hjalte.nl - github.com

0 Me gusta
Mensaje 3 de 5

Anton_Chernomazov
Contributor
Contributor

This case work for me too. But if I take browser node for drawing view on drawing document and try to expand it I have an exception. 

0 Me gusta
Mensaje 4 de 5

JelteDeJong
Mentor
Mentor

I changed my test setup to this code and it still works.

DrawingDocument doc = (DrawingDocument)ThisDoc.Document;
BrowserNode node = doc.BrowserPanes["Model"].TopNode;

BrowserNode sheetNode = node.BrowserNodes[2];

BrowserNode baseDrawingViewNode = sheetNode.BrowserNodes[3];
baseDrawingViewNode.Expanded = true;

BrowserNode projectedDrawingViewNode = sheetNode.BrowserNodes[3];
projectedDrawingViewNode.Expanded = true;

Jelte de Jong
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


Blog: hjalte.nl - github.com

0 Me gusta
Mensaje 5 de 5

Anton_Chernomazov
Contributor
Contributor

Thank you for reply. I think your case works because you use indexator BrowserNode[object index] to get target node. But I use BrowserPane.GetBrowserNodeFromObject method for DrawingView

0 Me gusta