.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Saving drawing

6 REPLIES 6
Reply
Message 1 of 7
pjones1
943 Views, 6 Replies

Saving drawing

I have searched and cannot find the method to save a drawing. I saw where I can do a saveandclose but I don't want to do a close.
I tried to do a db save but that gives me an error when I run the program. Any suggestions?

Thanks,

Patrick
6 REPLIES 6
Message 2 of 7
Anonymous
in reply to: pjones1

Database.SaveAs()

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message
news:6361064@discussion.autodesk.com...
I have searched and cannot find the method to save a drawing. I saw where I can
do a saveandclose but I don't want to do a close.
I tried to do a db save but that gives me an error when I run the program. Any
suggestions?

Thanks,

Patrick
Message 3 of 7
pjones1
in reply to: pjones1

Thanks for the reply. That gives me the same error - eFileInternalErr.
I have:
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;

DocumentCollection dm = Application.DocumentManager;
Database db = dm.MdiActiveDocument.Database;
db.SaveAs();

When I build the solution the db.SaveAs() gets a blue squiggly and it says "No overload for method 'SaveAs' takes '0' arguments"
If if do db.Save(), I get the same eFileInternalErr error but no blue squiggly. I must be missing something but I cannot fathom what.

Patrick
Message 4 of 7
Anonymous
in reply to: pjones1

If you want to save to the same file as the current document,
then I would suggest using the ActiveX Save() method.

{code}

public void MySave()
{
Document doc = Application.....MdiActiveDocument;
object oAcadDoc = doc.AcadDocument;
oAcadDoc.GetType().InvokeMember( "Save",
BindingFlags.InvokeMethod, null, oAcadDoc, null);
}

{code}

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message
news:6361385@discussion.autodesk.com...
Thanks for the reply. That gives me the same error - eFileInternalErr.
I have:
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;

DocumentCollection dm = Application.DocumentManager;
Database db = dm.MdiActiveDocument.Database;
db.SaveAs();

When I build the solution the db.SaveAs() gets a blue squiggly and it says "No
overload for method 'SaveAs' takes '0' arguments"
If if do db.Save(), I get the same eFileInternalErr error but no blue squiggly.
I must be missing something but I cannot fathom what.

Patrick
Message 5 of 7
pjones1
in reply to: pjones1

Ok, I was being an idiot. When I searched the forums is was set to the last 90 days. When I searched all I found where you had told people about this and why it would not work. Sorry about that. But now it is giving me a different error:
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at AcDbDatabase.saveAs(AcDbDatabase* , Char* , SecurityParams* )

What I am doing is:
db.SaveAs("c:\\temp\\temp.dwg", DwgVersion.Current);

Patrick
Message 6 of 7
pjones1
in reply to: pjones1

Thanks for the reply. This is really frustrating. Everything I try seems to end in error.
I decided to go with doc.SendStringToExecute but it is still giving me fits. Actually, C# is being the pain.
Do you know of a way to make things not threaded or at least execute in order? My program basically opens the drawing, plots the drawing, then opens the next one in the queue. The problem starts with when it opens the next one, AutoCAD asks if I want to save the previous drawing. If I could find a way for AutoCAD to not ask that question, my problems would go away. However, that problem has plagued me since AutoCAD R14 and I have gotten around it by saving the drawing, opening a blank drawing, then opening the next one. Now it seems that AutoCAD is opening the next one before the SendStringToExecute gets a chance to execute.

Patrick
Message 7 of 7
pjones1
in reply to: pjones1

Thanks for all your help. I think I have this issue solved. I decided to switch out of SDI and just use the discard and close method. It seems to work. Now onto my other issues 🙂

Patrick

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost