.NET

.NET

Reply
Valued Mentor
AubelecBE
Posts: 407
Registered: ‎01-27-2010
Message 1 of 4 (227 Views)
Accepted Solution

How to check if a drawving is saved

227 Views, 3 Replies
01-23-2014 03:30 AM

Hi all.

i want to check if my file is saved or not. (already named). I need to do this for launch the command "-etransmit"

 

but i dont know how to do that.

No global var and found nothing here.

 

Thanks for your help.

If you check 'DBMOD' system variable, you can get the drawing modification status. Below is the sample code to check if drawing has been saved or not.

 

Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.Runtime
<CommandMethod("DrawingSaved")> _
Public Sub DrawingSaved()
Dim obj As Object = Application.GetSystemVariable("DBMOD")
'' Check the value of DBMOD, if 0 then the drawing has not been changed
If Not (System.Convert.ToInt16(obj) = 0) Then
If MsgBox("Do you wish to save this drawing?", _ 
MsgBoxStyle.YesNo, _
"Save Drawing") = MsgBoxResult.Yes Then Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
acDoc.Database.SaveAs(acDoc.Name, True, DwgVersion.Current, _
acDoc.Database.SecurityParameters) End If End If End Sub

 

You can find details about DBMOD variable in below location:

http://exchange.autodesk.com/autocad/enu/online-help/search#WS1a9193826455f5ffa23ce210c4a30acaf-50a8.htm

 

Distinguished Mentor
gasty1001
Posts: 582
Registered: ‎04-11-2010
Message 2 of 4 (211 Views)

Re: How to check if a drawving is saved

01-23-2014 05:50 AM in reply to: AubelecBE

Hi,

 

I think a combination of "DWGTITLED" and "DBMOD" system variables  should provide you the information needed to etransmit or to not etransmit.

 

Gaston Nunez

Mentor
mzakiralam
Posts: 231
Registered: ‎11-09-2012
Message 3 of 4 (195 Views)

Re: How to check if a drawving is saved

01-23-2014 08:07 AM in reply to: AubelecBE

If you check 'DBMOD' system variable, you can get the drawing modification status. Below is the sample code to check if drawing has been saved or not.

 

Imports Autodesk.AutoCAD.ApplicationServices 
Imports Autodesk.AutoCAD.DatabaseServices 
Imports Autodesk.AutoCAD.Runtime 
<CommandMethod("DrawingSaved")> _ 
Public Sub DrawingSaved() 
Dim obj As Object = Application.GetSystemVariable("DBMOD") 
'' Check the value of DBMOD, if 0 then the drawing has not been changed 
If Not (System.Convert.ToInt16(obj) = 0) Then 
If MsgBox("Do you wish to save this drawing?", _                 
MsgBoxStyle.YesNo, _
"Save Drawing") = MsgBoxResult.Yes Then Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
acDoc.Database.SaveAs(acDoc.Name, True, DwgVersion.Current, _
acDoc.Database.SecurityParameters) End If End If End Sub

 

You can find details about DBMOD variable in below location:

http://exchange.autodesk.com/autocad/enu/online-help/search#WS1a9193826455f5ffa23ce210c4a30acaf-50a8...

 

Valued Mentor
AubelecBE
Posts: 407
Registered: ‎01-27-2010
Message 4 of 4 (161 Views)

Re: How to check if a drawving is saved

01-24-2014 03:20 AM in reply to: mzakiralam

Thanks, work fine.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.