in AutoCAD VBA the object ThisDrawing had a property FullName which gives the full pathname to the current active drawing, this is missing at VB.NET.
I have found some code for AutoCAD2013 which is:
Dim doc As Document = Application.DocumentManager.MdiActiveDocument Dim db As Database = doc.Database
My ThisDrawing code is
Dim m_AcadDoc As Autodesk.AutoCAD.ApplicationServices.Document m_AcadDoc = Autodesk.AutoCAD.ApplicationServices.Application.D
Why is FullName missing from the .Net object, is there anyother way to modify the ThisDrawing object to give the property?
In .NET API, Autodesk.AutoCAD.ApplicationServices.Document class has a "Name" property, which is eqivalent to COM API's AcadDocument.FullName.
So, if you need full path, you can
Dim fullName As Strng=Application.DocumentManager.MdiActiveDocumen
A bit off topic: I see quite some code samples/articles claiming how easy to move from Acad VBA to .NET API and showing code to implement VBA's equivalent of "ThisDrawing" and then go to use COM API with VB.NET. IMO, this is the worst way to learn AutoCAD .NET API, especially for those who have VBA experience, but not very deep into programming as profession. If you find you are trying to create your own "ThsiDrawing" of AcadDocument type with VB.NET/C# without your unique requirement other than doing things like you do in VBA, you are not in a good direction of learning, although you may eventually be there, but with big detour.
For some people migrating from VBA to VB.NET is a huge leap, learning costs, reimplemetation costs, or both - therefore using the COM Interop libraries gives a very simple solution for those people.
Rewriting VBA code to native VBA can cost weeks of work, and what for? Proven, tested VBA code becomes buggy when rewritten in VB.NET and you've just spent 6 months to do it when you could have just ported your VBA to VB.NET and created new modules to do your new features in.
I'll say the same for LISP too - if you have a proven app written in LISP that works fine, unless you are running into performance issues - why rewrite it in another language? My advice is, create your *new* stuff with the latest technologies and let the legacy be.
In case you haven't seen it, check this out - http://adndevblog.typepad.com/autocad/2012/07/the-
About the original question - if you are not seeing the same property, then you are doing something wrong with your references - have you included all the *Interop*.dll's into your VS project?
Thanks for the info & advice. For a bit of history, we have a small VBA module that creates a High Res Tiff image of the drawing during the SAVE event. We are moving from 2009 to 2013 and so now need to convert our VBA code into VB.NET hence my question.
I am fairly new to VB.NET and very new to AutoCAD vb.net so I dont understand most of what you have said.
I have seen a lot of VB code that would appear to work at 2009 but no longer works at 2013 so documentation I downloaded from Autodesk does not work in the 2013 environment so I'm not having a whole lot of fun trying to do this.
I seem to have my Tiff code working, I just need to somehow run my code whenever the user selects SAVE
Hope the suggestions you got helped you... if so, please go ahead and mark as 'Accept as Solution'
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register
Start with some of our most frequented solutions to get help installing your software.