eFileSharingViolation error when running in AutoCAD2016

eFileSharingViolation error when running in AutoCAD2016

Anonymous
Not applicable
1,791 Views
9 Replies
Message 1 of 10

eFileSharingViolation error when running in AutoCAD2016

Anonymous
Not applicable

Hello,

 

Why am I getting a eFileSharingViolation error when running in AutoCAD2016 and not in AutoCAD2014 version with this code?:

 

Public Sub DwgSaveAs()

 

Dim doc As Document = Application.DocumentManager.MdiActiveDocument
Dim dwg = doc.Database

 

dwg.SaveAs(doc.Name, DwgVersion.Current)

 

End Sub

 

I tryed also the code: 

 dwg.SaveAs(doc.Name, False, DwgVersion.Current, doc.Database.SecurityParameters)

 

What is the different between those two version of AutoCAD? 

 

Gerrit

0 Likes
1,792 Views
9 Replies
Replies (9)
Message 2 of 10

SENL1362
Advisor
Advisor
2. 🙂
And Fibers (the way multiple documents are handled).
This error is not new and the advise is to not Save the current document that way.
https://www.theswamp.org/index.php?topic=42016.0
http://www.private.peterlink.ru/poleshchuk/cad/2009/Bug2apie.htm
...
0 Likes
Message 3 of 10

Anonymous
Not applicable

Thanks for your replay Senl 1362

 

I have seen these posts, but why works the code in Acad 2014 and not in Acad2016

 

Regards

Gerrit

0 Likes
Message 4 of 10

augusto.goncalves
Alumni
Alumni
We removed Fibers on AutoCAD 2015, which modifies some behaviours.
Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network
0 Likes
Message 5 of 10

Anonymous
Not applicable

Thanks for your answer Augusto.Concalves,

 

Is there another solution for?, or do i need to change my code?

If the answer is yes then wich code we have to use?

 

Regards, Gerrit

0 Likes
Message 6 of 10

augusto.goncalves
Alumni
Alumni
Please try:

DocumentExtension.GetAcadDocument(doc).Save()
Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network
0 Likes
Message 7 of 10

Anonymous
Not applicable

Thanks Augusto,

 

It works, but now i have another problem with this, because we need for a customer the only can use dwg's saved in a earlier version of AutoCAD (AC1800 - 2004) So how can i save Dwg's to this version?

I did that with this code, it works fine in AutoCad 2014 but AutoCAD2016 get a error with this:

 

AcDocument = Application.DocumentManager.MdiActiveDocument

 

AcDocument.Database.SaveAs(strPath "\" & strDir, intDwgVers)

intDwgVersion get a integer with the AutoCAD version through a combobox with this code:

  

Select Case cmbFileType.SelectedIndex

 Case 0

intDwgVers = DwgVersion.Newest

  Case 1

intDwgVers =DwgVersion.AC1800

  Case Else

  End Select

 

Gerrit

 

0 Likes
Message 8 of 10

augusto.goncalves
Alumni
Alumni
Can you re-append the error message?
Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network
0 Likes
Message 9 of 10

Anonymous
Not applicable

Hi Augusto,

 

This is the message what i get from AutoCAD 2016.

 

Gerrit

 

Error_message.JPG

 

Efile.JPG

 

0 Likes
Message 10 of 10

augusto.goncalves
Alumni
Alumni
You probably need to pass a different file name, you cannot saveAs to the same file name already open. Try, for instance, saveAs to a different name (temp name).
Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network
0 Likes