.NET

Reply
Valued Contributor
CommCorp
Posts: 97
Registered: ‎03-19-2007
Message 1 of 4 (213 Views)

Saving a drawing that is open but not active

213 Views, 3 Replies
11-15-2012 10:35 AM

Any trick to using dwgDB.saveas on a drawing database that the user has open but NOT current on his screen?

For example, the user has DWG1 open and DWG2 open and currently active, my program modifies DWG1 (inactive) and when the program tries to run...

dwg1DB.SaveAs(filename, true, DwgVersion.Current, dwg1DB.SecurityParameters)

it errors with an elock violation, even though I lock the document with dwg1DOC.LockDocument before I try to save and unlock it after.

 

The same code runs fine on the current document so at this time I just ended making the other document current just to save it then switch back to previously current document.

 

What am I missing to save a document that is open but not current? 

Member
_RenderMan
Posts: 5
Registered: ‎11-17-2012
Message 2 of 4 (183 Views)

Re: Saving a drawing that is open but not active

11-18-2012 03:21 PM in reply to: CommCorp

As I understand it, since the Document is already open in the Editor, you'd either have to have the Editor save the Document via SendStringToExecute(), or consider an extension method via the AcadDocument.Save() method.

 

Here are a couple of example threads:

 

Implementing a "Quick SaveAs" command in AutoCAD using .NET

 

Database.SaveAs() Problems

 

"A bad mood is like bad breath. Nobody likes a person with bad breath" - Prager
"First tell the truth, then give your opinion" - Prager
"One who is offended by truth, has no place among those who seek wisdom" - RenderMan
Valued Contributor
CommCorp
Posts: 97
Registered: ‎03-19-2007
Message 3 of 4 (161 Views)

Re: Saving a drawing that is open but not active

11-19-2012 08:05 AM in reply to: CommCorp

Thanks!

AcadDocument.save() works great regardless of whether the document is current or not.

Member
_RenderMan
Posts: 5
Registered: ‎11-17-2012
Message 4 of 4 (127 Views)

Re: Saving a drawing that is open but not active

12-05-2012 06:32 PM in reply to: CommCorp

CommCorp wrote:

Thanks!

AcadDocument.save() works great regardless of whether the document is current or not.


You're welcome; I'm happy to help.

"A bad mood is like bad breath. Nobody likes a person with bad breath" - Prager
"First tell the truth, then give your opinion" - Prager
"One who is offended by truth, has no place among those who seek wisdom" - RenderMan

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community