Page 1 of 1

Load From File vs. Load From Stream

Posted: 30 Mar 2007, 18:35
by jgayhart
<font color="black">Hello,

I have an application which displays dwg files. The dwg files are stored in a database and retrieved into a byte array. I create a stream from the byte array and call the LoadFromStream function. It works for the most part. However, I have found that it does not work for .dwg files saved in the 2007 format (earlier versions work okay). I did find that the file loads fine when calling LoadFromFile.

I have included some sample code:

<font color="blue">Dim </font id="blue"> sFileName <font color="blue">As String </font id="blue"> = IO.Path.Combine(<font color="blue">My</font id="blue">.Computer.FileSystem.SpecialDirectories.Desktop, <font color="maroon">"2007.dwg"</font id="maroon">)
<font color="blue">Dim </font id="blue"> abytPictureData() <font color="blue">As Byte </font id="blue"> = <font color="blue">My</font id="blue">.Computer.FileSystem.ReadAllBytes(sFileName)

mCADImage = <font color="blue">New </font id="blue"> DWG.DWGImage

<font color="green">' Load the picture data into a stream.</font id="green">
<font color="blue">Dim </font id="blue"> str <font color="blue">As </font id="blue"> System.IO.Stream = <font color="blue">New </font id="blue"> System.IO.MemoryStream(abytPictureData)
<font color="blue">With </font id="blue"> mCADImage

<font color="green">' The next line does not work on 2007 files</font id="green">
<font color="green">'.LoadFromStream(str)</font id="green">

<font color="green">' The next line does work on 2007 files</font id="green">
.LoadFromFile(sFileName)

.DrawMode = CADImport.CADDrawMode.Black
.DefaultColor = Color.White
.UseWinEllipse = <font color="blue">False</font id="blue">
<font color="blue"> End With</font id="blue">

Again, the LoadFromStream does not work for 2007 files. I look forward to your response.</font id="black">

-- James "ACE" Gayhart: If at first you don't succeed, call it Version 1.0.

Posted: 02 Apr 2007, 10:40
by support
Hello1

Thank you for the question.
We will solve this problem and inform you when update will be available.

Sergey.

Please post questions to the forum or write to support@cadsofttools.com

Posted: 03 Apr 2007, 14:37
by support
Hello!

This problem has been solved.
Please find updated beta version of the library at the following link: http://www.cadsofttools.com/download/CA ... 7_beta.zip

Sergey.

Please post questions to the forum or write to support@cadsofttools.com

Posted: 05 Apr 2007, 15:34
by jgayhart
Hi,

I tried the new beta version. But, it seems to have caused more problems than it solved. I will try to work on a sample project where I can reproduce the crashes.

-- James "ACE" Gayhart: If at first you don't succeed, call it Version 1.0.

Posted: 05 Apr 2007, 16:52
by support
Hello James!

We tested reading from the stream useing the following code:

Code: Select all

       Stream str1 = File.OpenRead(@"C:\Test2007.dwg");
       FCADImage = <font color="blue">new</font id="blue"> DWG.DWGImage();
       FCADImage.LoadFromStream(str1);
       str1.Close();
We found no problems with lots of tested files. Can you please describe in detail what problems arose.

Sergey.

Please post questions to the forum or write to support@cadsofttools.com

Posted: 05 Apr 2007, 17:29
by jgayhart
Hi,

When I try the code with 2007 files, .AbsWidth and .AbsHeight are set to zero. But, again, loading via file works okay.

-- James "ACE" Gayhart: If at first you don't succeed, call it Version 1.0.

Posted: 06 Apr 2007, 08:54
by support
Can you please send us your files for testing to support@cadsofttools.com. And please make a reference to this topic in your letter.

Sergey.

Please post questions to the forum or write to support@cadsofttools.com

Posted: 23 Oct 2007, 18:32
by support
This problem has been solved. Please contact us to info@cadsofttools.com for getting update.

Sergey.

Please post questions to the forum or write to support@cadsofttools.com