CloseAndSave()method not saving the file

CloseAndSave()method not saving the file

Mohamed_Arshad
Advisor Advisor
1,181 Views
4 Replies
Message 1 of 5

CloseAndSave()method not saving the file

Mohamed_Arshad
Advisor
Advisor

Hi Guys!!

 

      I need to save the opened document, I use CloseAndSave() method but it not saving the file. Can anyone explain me how the above method works.

 

@_gile @Norman_Yuan @ActivistInvestor 


Mohamed Arshad K
Software Developer (CAD & BIM)

0 Likes
Accepted solutions (1)
1,182 Views
4 Replies
Replies (4)
Message 2 of 5

_gile
Consultant
Consultant

Hi,

You could use Database.SaveAs before closing the document.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 3 of 5

Mohamed_Arshad
Advisor
Advisor

HI @_gile 

 

   Thank you so much for quick reply, As you mentioned I have used SaveAs also it is working fine. But I need to know how to use SaveAndClose() Method so that I get an additional information.


Mohamed Arshad K
Software Developer (CAD & BIM)

0 Likes
Message 4 of 5

_gile
Consultant
Consultant
Accepted solution

I cannot help you further without seeing any code and having some information on the context this is run.

This minimalist test command works as expected:

[CommandMethod("Test", CommandFlags.Session)]
public static void Test()
{
    var doc = Application.DocumentManager.MdiActiveDocument;
    doc.CloseAndSave(@"F:\Drawings\Test.dwg");
}

 



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 5 of 5

Mohamed_Arshad
Advisor
Advisor

HI @_gile 

 

  I forget to Change the Command Flags, Now its working fine. Thank you so much 🙂


Mohamed Arshad K
Software Developer (CAD & BIM)

0 Likes