.NET

Reply
Distinguished Contributor spu
Distinguished Contributor
spu
Posts: 141
Registered: ‎02-21-2007
Message 1 of 3 (310 Views)

save all open drawings

310 Views, 2 Replies
08-09-2011 01:49 AM

Hi,

 

I tried the following method to save all drawing currently open. It always fire fill access arror, whereas AutoCAD can save the file wihthout any issue. Here I am checking for drawings that not even saved once and ask the user to take action for those files.

 

 try
            {

                DocumentCollection docs = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager;

                foreach (Document doc in docs)
                {
                    string dname = doc.Name;
                    string s = doc.Name.Substring(doc.Name.LastIndexOf('\\') + 1);


                    if (s != doc.Name)  //checking for additional path
                    {
                       doc.Database.SaveAs(dname, true, DwgVersion.Current,doc.Database.SecurityParameters);
                    }
                    else
                    {
                        System.Windows.Forms.MessageBox.Show("Please save " + doc.Name + " manualy!!!!");
                    }

                }
            }
            catch (System.Exception ee)
            {
                System.Windows.Forms.MessageBox.Show("Exception: " + ee.Message);
            }

 

Regards,

Shijith

 

Active Contributor
jamierobertson1
Posts: 39
Registered: ‎04-11-2004
Message 2 of 3 (286 Views)

Re: save all open drawings

08-09-2011 10:05 AM in reply to: spu

For some reason I have had some problems saving to some acad versions. Try changing this bit to see if this works:

doc.Database.SaveAs(dname, DwgVersion.AC1800)

 

Distinguished Contributor spu
Distinguished Contributor
spu
Posts: 141
Registered: ‎02-21-2007
Message 3 of 3 (265 Views)

Re: save all open drawings

08-09-2011 09:38 PM in reply to: jamierobertson1

Hi,

 

Thanks for the reply.

I tried it, it also behaves the same.....It gives the following AutoCAD message and exception.

 

Autocad Message: Error writing / closing file.

 

Exception: efileAccessErr

 

But the same drawing Autocad saves with out any trouble.

 

Regards,

Shijith

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