Load From File vs. Load From Stream
Moderators: SDS, support, admin
Load From File vs. Load From Stream
<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.
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.
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
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
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
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
Hello James!
We tested reading from the stream useing the following code:
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
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();
Sergey.
Please post questions to the forum or write to support@cadsofttools.com
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
Sergey.
Please post questions to the forum or write to support@cadsofttools.com
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
Sergey.
Please post questions to the forum or write to support@cadsofttools.com