Skip to content

Opening dwg-files as read only #194

Answered by DomCR
thorster asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @thorster,

ACadSharp supports a Stream as an input to read a file:

		const string _file = "../../../../samples/sample_AC1032.dwg";

		static void Main(string[] args)
		{
			CadDocument doc;

			FileStream fs = new FileStream(_file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
			using (DwgReader reader = new DwgReader(fs))
			{
				doc = reader.Read();
			}

			exploreDocument(doc);
		}

I've tested this code while the file was opened by Autocad at the same time.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by thorster
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants