Does not contain a definition for ‘Application’

Does not contain a definition for ‘Application’

aclarke
Advocate Advocate
2,270 Views
3 Replies
Message 1 of 4

Does not contain a definition for ‘Application’

aclarke
Advocate
Advocate

Hi all,

I am working with C# in the SharpDevelop Revit Macro Manager.
I am creating a sub routine class outside of ThisDocument to be called into ThisDocument.

I am running into an error:
does not contain a definition for ‘Application’ and no extension method…

How can I create a subfunction that calls Revit UIDocument.  This sub function is within the same namespace as 'ThisDocument'

 

Thanks for any help!

0 Likes
Accepted solutions (1)
2,271 Views
3 Replies
Replies (3)
Message 2 of 4

jeremytammik
Autodesk
Autodesk

Look at the Revit API documentation, either in the Windows help file RevitAPI.chm in the Revit SDK or in the online help:

 

https://www.revitapidocs.com/

 

Document class:

 

https://www.revitapidocs.com/2020/db03274b-a107-aa32-9034-f3e0df4bb1ec.htm

 

Application property:

 

https://www.revitapidocs.com/2020/b517ce21-cec3-4cf3-e74b-aa0f219f6724.htm

 



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

0 Likes
Message 3 of 4

naveen.kumar.t
Autodesk Support
Autodesk Support
Accepted solution

Hi @aclarke ,

try using the below code

UIDocument uidoc=this.ActiveUIDocument;
Document doc=this.ActiveUIDocument.Document;

I hope this helps.


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 4 of 4

aclarke
Advocate
Advocate

Naveen

Thank you.  it was a combination of your answer and this other forum answer that helped me figure it out

 

thanks

 

https://forum.dynamobim.com/t/does-not-contain-a-definition-for-application/42517

 

 

UIDocument uidoc = new ThisDocument();
Document doc = new ThisDocument().Document;