Wout Ware

September 10, 2010, 02:24:50 am *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Couldn't save the drawing  (Read 618 times)
Telefisch
Member
*
Posts: 34


« on: April 28, 2009, 08:22:34 am »

Hi Forum
hi wout...

I have Problems to write changes to a dwg.

I load the dwg with dwgReader and after changes have been made, I try to write them back.
Sometimes I got the error, that the drawing is in use already...

I could not see, when this is so, so my question, how is the reader working? Does it leave the file opened after reading?
Is there a way to get sure, the file is writeable? O r is there any special way to save an opened drawing?

Thanks Tele
Logged
wout
Administrator
Member
*****
Posts: 837


« Reply #1 on: April 29, 2009, 12:12:49 am »

Hi Tele,

The reader closes the stream always, unless the caller is the owner of the stream and tells the DxfReader to not close the stream. So I'm not sure why this is happening...

Wout
Logged
bmupton
Member
*
Posts: 82


METAL!!


« Reply #2 on: March 11, 2010, 03:18:40 pm »

I am having this exact problem...

I basically want to open a dwg, add some text to it, then save it back, and I get 'The file is already in use' every single time.

The code I am using is ultra simple:

Code:
Dim dwg As DxfModel = DwgReader.Read("C:\TEST1.dwg")
Dim dxfT As New DxfText("TEST", New Point3D(0, 0, 0))
dxfT.Height = 3 / 32
dwg.Layouts("TEST").Entities.Add(dxfT)
DwgWriter.Write("C:\TEST1.dwg", dwg)
Logged
bmupton
Member
*
Posts: 82


METAL!!


« Reply #3 on: March 11, 2010, 04:12:08 pm »

Hi again,

I just noticed that if I do this using dxf files instead of dwg, and bring it in with a dxfReader, then write it out using dxfWriter, I do not get this error.

It's only when using dwgReader/dwgWriter.
Logged
wout
Administrator
Member
*****
Posts: 837


« Reply #4 on: March 11, 2010, 11:04:42 pm »

Hi Brent,

In this version I've implemented the IDisposable interface in class DwgReader, which closes the stream after reading:

http://www.woutware.com/download/CadLib3.5.6.1.msi

Let me know if this works ok now!

Wout
Logged
bmupton
Member
*
Posts: 82


METAL!!


« Reply #5 on: March 12, 2010, 09:54:44 pm »

Hi Wout,

I'm getting very weird results using the new dwgReader/dwgWriter.  If I create a drawing using this version of CadLib, everything is fine.  It creates the drawing identical to the last release.

However, if I read in the file I just created, and save it back, it removes all the viewports from the layouts.  I'm literally just doing:

dwgreader.read("file.dwg")
dwgwriter.write("file.dwg")

and the resulting dwg has no viewports in any of the layouts, on any layout that also has a block.

I'm afraid I can't give any more time to this problem right now, so I'll leave it with you.

On the upside, overwriting the file works flawlessly and no longer complains about the file already being in use.  :-)

Cheers,
-Brent
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!