Home > Net >  C # how to read the information in the CAD file logo?
C # how to read the information in the CAD file logo?

Time:11-11

How to read CAD DWG file generated in c #, I want to how to identify its components identified in the drawing files, text information? What a great god have good ideas! For help!

CodePudding user response:

Declare a storage layer bai variable

Open the du graph database
Open the LayerTable

Traverse zhiLayerTable acquisition LayerTableRecord and join the LayerID variables to store the dao layer

Relevant layer are obtained from the Record information, such as the layer name, color, status, etc.
1
2
3
4
5
6
7
8
9
10
11.
12
13
14
15
16
17
18
19
///& lt; Summary>
///get the current graphics all layers in the
///& lt;/summary>
///& lt; Param name="db" & gt; A database object & lt;/param>
///& lt; Returns> Return a list of all the layers record & lt;/returns>
Public static List GetAllLayers (this Database db)
{
//open the layer table
LayerTable lt=(LayerTable) db. LayerTableId. GetObject (OpenMode. ForRead);
//used to return a list of all layer table record
List LTRS=new List (a);
Foreach (ObjectId id in lt)//traverse layer table
{
//open the layer table record
LayerTableRecord LTR=(LayerTableRecord) id. GetObject (OpenMode. ForRead);
LTRS. Add (LTR);//add to the list of return
}
Return LTRS.//return a list of all the layers record
}

CodePudding user response:

https://blog.csdn.net/guo1wu3shi4/article/details/88786019
  •  Tags:  
  • C#
  • Related