using CADImport;
using CADImport.DWG;
using CADImport.DXF;
using CADImport.RasterImage;
...
| C# | Copy Code |
|---|---|
private void Access_line_data_Click(object sender, EventArgs e)
{
//CADImage.CreateImageByExtension detects format with by the extension specified in the argument.
//The correct class for any supported format will be used automatically. We recommend to
//create a new drawing object with CADImage.CreateImageByExtension if import from the existed
//file/stream is required.
CADImage vDrawing = CADImage.CreateImageByExtension(@"..\..\..\Files\Entities.dxf");
vDrawing.LoadFromFile(@"..\..\..\Files\Entities.dxf");
for (int i = 0; i < vDrawing.CurrentLayout.Count; i++)
{
if (vDrawing.CurrentLayout.Entities[i].EntType == EntityType.Line)
{
CADLine vLine = (CADLine)vDrawing.CurrentLayout.Entities[i];
MessageBox.Show("Line is found. Handle = " + vLine.Handle +
"; X: " + vLine.Point.X + "; Y: " + vLine.Point.Y +
"; X1: " + vLine.Point1.X + "; Y1: " + vLine.Point1.Y);
break;
}
}
}
| |