Active Project .WDP Full File Path

Active Project .WDP Full File Path

mcoH3VZV
Advocate Advocate
874 Views
3 Replies
Message 1 of 4

Active Project .WDP Full File Path

mcoH3VZV
Advocate
Advocate

Hi,

 

I am wondering if anyone knows how to get the .WDP full File path into a string in C#.NET. ("C:\AutoCAD Home\Test Project\TEST.wdp")

 

I tried looking through the options on Application.DocumentManager, but cannot seem to find it. 

 

Any thoughts?  Thanks

0 Likes
Accepted solutions (2)
875 Views
3 Replies
Replies (3)
Message 2 of 4

fieldguy
Advisor
Advisor
Accepted solution

you could try "findfile".

on the command line try (findfile "test.wdp").  If that works, you can use it in code.

example: (findfile "acaddoc.lsp") returns 
"C:\\program files\\autodesk\\autocad 2018\\support\\acaddoc.lsp"
to use it in code you need a try/catch.

string fpath = string.Empty;
try
{
fpath = Autodesk.AutoCAD.DatabaseServices.HostApplicationServices.Current.FindFile("test.wdp", doc.Database, acdb.FindFileHint.Default);
}
catch
{ }

if (fpath != string.empty)

i am not sure it works with verticals (projects, etc.) 

0 Likes
Message 3 of 4

mcoH3VZV
Advocate
Advocate

Perfect! Looks like findfile works great.  However, while running the updates I want, I will not know the name of the .wdp file. Is there a way to get the name of the active .wdp? From there, I can use findfile.

 

Thanks,

0 Likes
Message 4 of 4

mcoH3VZV
Advocate
Advocate
Accepted solution

To find the active project wdp, use the solution found here:

 

https://forums.autodesk.com/t5/autocad-electrical-forum/acade-net-api/td-p/5738510

0 Likes