Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Document is "null".

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
oguzkomcu
422 Views, 3 Replies

Document is "null".

I want it to work in the codes I want with Revit opened. " using (var collector = new FilteredElementCollector(doc))" in this line goes into a loop after the code. It also does this in my other "doc" requested codes. As a result, the codes I want do not work. Is it because of "doc = null" or is there a different problem?

 

oguzkomcu_0-1658736903817.png

 

Labels (2)
3 REPLIES 3
Message 2 of 4
naveen.kumar.t
in reply to: oguzkomcu

Hi @oguzkomcu ,

 

Please take a look at the below link

https://forums.autodesk.com/t5/revit-api-forum/how-to-get-uiapplication-from-iexternalapplication/td... 


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 3 of 4
oguzkomcu
in reply to: oguzkomcu

I fixed the document error but my loop error continues. When I want "ActiveView", I run the method again, come to the uiapp.OpenAndActivateDocument method, return to the beginning of the method and loop it. What is the reason of this ?

 

oguzkomcu_1-1658740355641.png

 

Message 4 of 4

Hi,

 

Error checking helps figure these issues out. Have you tried using a Try{} Catch{}(ex Exception) to see what Revit tells you when you attempt to get the active view? Have you tried getting the active view using Document.ActiveView()?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


Autodesk Design & Make Report