.NET

Reply
Contributor
classof
Posts: 14
Registered: ‎06-26-2010
Message 1 of 2 (232 Views)
Accepted Solution

Problem about saving the active drawing

232 Views, 1 Replies
04-08-2013 03:06 AM

Hi..

The following code was copied from ‘autocad 2013 help’.

When I debug the code of help file, the autocad is open and there is ERROR named strDWGName=”C:MyDrawing.dwg”..

but, I revised the name to strDWGName=”MyDrawing.dwg” and then, the file is saved in the DEBUG folder WITHOUT ANY ERROR.

Could you please explain this matter in details?

 

 

Save the active drawing

This example saves the active drawing to "c:\MyDrawing.dwg" if it is currently not saved or under its current name.

VB.NET

 

 

Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.Runtime
 
<CommandMethod("SaveActiveDrawing")> _
Public Sub SaveActiveDrawing()
  Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
  Dim strDWGName As String = acDoc.Name
 
  Dim obj As Object = Application.GetSystemVariable("DWGTITLED")
 
  '' Check to see if the drawing has been named
  If System.Convert.ToInt16(obj) = 0 Then
      '' If the drawing is using a default name (Drawing1, Drawing2, etc)
      '' then provide a new name
      strDWGName = "c:\MyDrawing.dwg"
  End If
 
  '' Save the active drawing
  acDoc.Database.SaveAs(strDWGName, True, DwgVersion.Current, _
                        acDoc.Database.SecurityParameters)
End Sub

 

What do you want to be explanined? Why you expect error when there should not be an error? If you supply a file name without path, where you expect the file is samed to? Hint: AutoCAD takes the application's current folder, which is where the application is loaded from.

*Expert Elite*
norman.yuan
Posts: 993
Registered: ‎04-27-2009
Message 2 of 2 (206 Views)

Re: Problem about saving the active drawing

04-08-2013 06:30 AM in reply to: classof

What do you want to be explanined? Why you expect error when there should not be an error? If you supply a file name without path, where you expect the file is samed to? Hint: AutoCAD takes the application's current folder, which is where the application is loaded from.

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 or visit the Installation and Licensing Forum to get help installing your software.