Author Topic: I want read a dwg File from fileStream,How can I do.  (Read 1971 times)

0 Members and 1 Guest are viewing this topic.

xys1995

  • Guest
I want read a dwg File from fileStream,How can I do.
« on: July 23, 2012, 08:44:45 PM »
a dwg file in network,I want to read it from a client PC using WCF.how can I do.

n.yuan

  • Bull Frog
  • Posts: 348
Re: I want read a dwg File from fileStream,How can I do.
« Reply #1 on: July 24, 2012, 09:49:05 AM »
You probably want to open a file stream and then read the stream into a byte[] chunk by chunk.

Look into

System.IO.File.Read()
System.IO.Stream.Read()

Googling File.Read()/Stream.Read() brings tons of links.

xys1995

  • Guest
Re: I want read a dwg File from fileStream,How can I do.
« Reply #2 on: July 25, 2012, 12:34:48 AM »
Yes,I can read the file,but the Database.readFile(string),I want get the Database Entity as Steam.

MexicanCustard

  • Swamp Rat
  • Posts: 705
Re: I want read a dwg File from fileStream,How can I do.
« Reply #3 on: July 25, 2012, 07:47:10 AM »
Can you save the stream as a temporary file (Path.TemporaryFileName) and then Database.ReadDwg the temp file?

I don't think AutoCAD is capable of what I think you want to do.  Since a dwg is nothing more than a database and AutCAD needs mutliple pieces of the database just to load the visual representation.  So I would think you would need the entire file available to AutoCAD in order to load/ open it. Unlike streaming media which can be read sequentially.
« Last Edit: July 25, 2012, 07:50:27 AM by MexicanCustard »
Revit 2019, AMEP 2019 64bit Win 10