Open Sheet and View Programatically

Open Sheet and View Programatically

Anonymous
Not applicable
1,889 Views
6 Replies
Message 1 of 7

Open Sheet and View Programatically

Anonymous
Not applicable

I've been developing an add-in, where I have a list of sheets and views. I'd like to allow the user to open the sheet(s) or view(s) from the add-in. I'm not sure how I'll achieve this functionality through API. Would really appreciate if someone could explain how I can achieve this functionality through API. Thank you

 

view.PNG

0 Likes
1,890 Views
6 Replies
Replies (6)
Message 2 of 7

jeremytammik
Autodesk
Autodesk

Dear Ali,

 

You can probably use the approach described here:

 

http://thebuildingcoder.typepad.com/blog/2018/03/switch-view-or-document-by-showing-elements.html

 

Cheers,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 7

Anonymous
Not applicable

Thanks, @jeremytammik for replying to the thread. I already had used this approach but it didn't work. Because when I use the showelements method, following error happen. Which says no good view could be found. Any resolution to this you could think of, please?

 

error.PNG

0 Likes
Message 4 of 7

Revitalizer
Advisor
Advisor

Hi,

 

for the ShowElements method, I've submitted an idea:

https://forums.autodesk.com/t5/revit-ideas/showelements-additional-parameters-return-value/idi-p/806...

I don't want to intercept this no-good-view-found dialog by workarounds any more.

 

 

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





Message 5 of 7

tomerFUNPJ
Enthusiast
Enthusiast

Is there any solution to this topic?

0 Likes
Message 6 of 7

svein.horve
Contributor
Contributor

I use RequestViewChange in UIDocument to open multiple views/sheets.

 

new UIDocument(doc).RequestViewChange(view);

 

 

Message 7 of 7

engrodriggo2
Participant
Participant

I just got the first VIewport inside the view.

 

worked for me

 

ViewSheet viewSheet = _doc.GetElement(id) as ViewSheet;

ElementId viewPortId = viewSheet.GetAllViewports().First();

if(viewPortId != null)
{
ElementUtilHelper.HighlightElement(_doc, viewPortId);
}

0 Likes