PDA

View Full Version : Opening Drawing as Read-only causes AutoCAD to crash



bweir
2007-09-28, 03:26 PM
Working with VB.Net and AutoCAD Map 2007/2008.

I've been working on a dll and all the functions in it look like they work fabulously. Just one little problem, opening a file as read-only will make AutoCAD get a Fatal Error. I know it is something in this dll because AutoCAD only crashes when the dll is loaded. This dll has functions to add dictionaries, xrecords, and work with the map project of the active drawing. Any clues one could offer to what might cause the crash would be greatly appreciated.

bweir
2007-09-28, 05:16 PM
I think I've found the problem but yet don't know why this occurs. The problem seams to occur then I try to get the map project for a drawing that is read-only. This is the code that I believe is causing the problem.


Project = Autodesk.Gis.Map.HostMapApplicationServices.Application.Projects(Dwg.Name)
System = Project.Projection

RobertB
2007-09-28, 05:22 PM
Without knowing a thing about Map, my guess would be that you are attempting to open the project with full rights, when only RO rights are available due to the drawing being RO.

dmarcotte4
2007-09-29, 12:57 PM
I know nothing of map either, but this does seem strange. I am able to read/write (but not save) a read only database with vanilla AutoCAD. I suppose you could test the file or catch the exception as a work around.

One thing though, “System” is a namespace and I would really hesitate to use this as a variable.

Dan