
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello!
First of all, sorry for bad english. I searched the internet for this and cant find a solution.
I need to check multiple drawings if they have the correct layer, blocknames etc. This worked well, it was fast and no problems, however there are also object tables in the drawing that needs to be checked. The program can check the current drawing when selected from form with a checkbox, and it works.
So when i try to retrieve tables from a current drawing in this form it works:
Document doc = Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Tables odTables = Autodesk.Gis.Map.HostMapApplicationServices.Application.GetProjectForDB(db).ODTables;
But if i try to do this with a sidedrawing like this:
Database db = new Database(false,true);
db.ReadDwgFile(dwgPath, FileOpenMode.OpenForReadAndAllShare, false, "");
db.CloseInput(true);
Tables odTables = Autodesk.Gis.Map.HostMapApplicationServices.Application.GetProjectForDB(db).ODTables;
I get this error:
"Operation is not valid due to the current state of the object."
I read that this error means that the database cannot be opened for read (or to write?), but why is this different from the current opened drawing?
Tried a lot of things, but cant fix the problem, can someone solve this problem? How to get odtables from a dwg as a sidedrawing without opening it?
Thank you in andvance.
Solved! Go to Solution.