Load From File vs. Load From Stream

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

Post Reply
jgayhart
Posts: 6
Joined: 04 Oct 2006, 01:03

Load From File vs. Load From Stream

Post by jgayhart » 30 Mar 2007, 18:35

<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.

support
Posts: 3272
Joined: 30 Mar 2005, 11:36
Contact:

Post by support » 02 Apr 2007, 10:40

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

support
Posts: 3272
Joined: 30 Mar 2005, 11:36
Contact:

Post by support » 03 Apr 2007, 14:37

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

jgayhart
Posts: 6
Joined: 04 Oct 2006, 01:03

Post by jgayhart » 05 Apr 2007, 15:34

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.

support
Posts: 3272
Joined: 30 Mar 2005, 11:36
Contact:

Post by support » 05 Apr 2007, 16:52

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

jgayhart
Posts: 6
Joined: 04 Oct 2006, 01:03

Post by jgayhart » 05 Apr 2007, 17:29

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.

support
Posts: 3272
Joined: 30 Mar 2005, 11:36
Contact:

Post by support » 06 Apr 2007, 08:54

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

support
Posts: 3272
Joined: 30 Mar 2005, 11:36
Contact:

Post by support » 23 Oct 2007, 18:32

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

Post Reply