Visual C#.NET: Read CAD Drawings

How to read CAD drawings on document image using C#.NET
Yiigo.Image for .NET provides advanced CAD drawings reading & scanning support, allowing developers to read and process CAD drawings on documents and images from documents and images. Find more CAD drawings reading information on Yiigo.Imaging for .NET CAD Plugin.
Yiigo.Imaging for .NET CAD Plugin has those following functionalities:
  • Views both DWG and DXF format files
  • Read CAD drawings from any .NET Stream, scanned image, clipboard, http, ftp
  • Fit the width, height or fit CAD drawings to a page
  • Selectable background color
This document provides comprehensive Visual C#.NET samples for guiding developers to read CAD drawings on documents and images using Yiigo.Image for .NET. Find more CAD reading tutorials on VB.NET CAD Drawings Reading, Web Imaging Viewer CAD Drawings Reading Support and Read CAD Drawings in .NET Winforms.
Read CAD Drawings with C#.NET Sample Code

Requirements

Before reading CAD drawings in Visual C#.NET, make sure that you have installed.

Start to Read CAD Drawingss

  • Open and run your Microsoft Visual Studio;
  • Choose either "Visual C# Projects" in "New Project" dialog box;
  • Choose "Windows Application" in the "Templates" List and name it "YiigoImagingCADReadCsharp";
  • Right-click on the "References" folder, and select "Add Reference..." from the context menu in the "Solution Explorer" window;
  • In the "Add Reference" dialog box, select the ".NET" tab and browse to Yiigo.Imaging.Net.dll library and Yiigo.Imaging.Net.Cad.Read.dll ;
  • Add it to your Visual C# applications;
  • Call Yiigo .NET Image Namespace & Copy those following codes:
using System.IO;
using System.Drawing.Printing;
using Yiigo.Imaging;
using Yiigo.Imaging.Processing;
using Yiigo.Imaging.CadRead;

// Open CAD drawings
CADDecoder dwgdecode = new CADDecoder();
RegisteredDecoders.Decoders.Add(myCADDecoder);

// Extract text from CAD drawings
private List<ExtractText> _textList =
new List<ExtractText>();

private void ExtractText(string file)
{
if (file == null)
return;
_textList.Clear();

ExtractTextHandler txtHandler =
new ExtractTextHandler();

txtHandler.OnTextFound +=
new ExtractTextHandler.OnTextFoundHandler(
txtHandler_OnTextFound);

CADDecoder dwgdecode = new CADDecoder();

using (Stream s = File.OpenRead(file))
{
dwgdecode.Distill(s, txtHandler, null);
}

}

void txtHandler_OnTextFound(Text txt)
{
_textList.Add(txt);
}

// Save CAD drawings
Dwgdecode.Save();
Products
Other Plugins
Image Viewer CoreBarcode PluginPDF Read & WriteTesseract OCR PluginForm Processing PluginJBIG2 CodecJPEG2000 CodecISIS ScannerTwain ScannerDICOM ReaderCAD Scanner