How can I detect the yellow lines array? #333
-
I'm trying to detect the entities in a DXF file using the library. But those yellow lines are the only ones I can't get. Using DWG TrueView LIST command I can get the following information about those lines. But I need some help to get this information into the netDxf library
I can upload the original file into a Zip if needed. Thank you very much in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
The lines you are looking for where created by an Array, which, at the moment, are not implemented in this library. Nonetheless, the internal block created as the graphical representation of the Array is loaded. You will have to look for an Insert that references a block named "*U#" where '#' is an integer. |
Beta Was this translation helpful? Give feedback.
-
I found this fraction of code in the file. How should I look for every code number intepretation at the Dxf format documentation? I'm sure this code represents the array of lines as the numbers at the line 3 and 5 are the same as the BasePoint.X and BasePoint.Y shown in my discussion opening.
|
Beta Was this translation helpful? Give feedback.
-
An excerpt of a DXF has a very limited use specially with complex objects like the Array. Most of the time the necessary information is spread through the whole file. In your case you are dealing with an Array. When an Array is build in AutoCad it creates a block named "U#" that holds the entities for each cell of the array, then it builds another block, also named "U#", with all references to that block (Inserts) ordered according to the properties of the Array, and then it inserts it into the drawing. So, you will need to look for an Insert in the document entities and then, inside the entities of the block associated with that insert, you will find a list of Insert entities that references another block in which list of entities you should find the lines. When you load a DXF with this library you loose all information of the original array but the Insert entities and its blocks (its graphical representation) is loaded. The main problem of implementing the Array object is that its properties are stored in the DXF Objects section which is an undocumented hodgepodge, and the only way to try to make some sense out of it, is to manually track the handle references through it. In general terms, I cannot tell you how to find a specific entity without having some kind of constraint to limit the search. You could search an entity knowing its handle (the best way), giving a unique color or layer, adding some kind of extended data to it, by its coordinates, etc. For an array object, as in your sample, you could use the handle or attach some extended data to it, since that information is stored in the Insert. In your first post the output of the list command shows the information of an array with handle "2aa", try to find the Insert with that handle. For this kind of operations, in the DxfDocument class, there is a method called "GetObjectByHandle", and then search through the tree of inserts. Hopefully this will also clarify your other post. |
Beta Was this translation helpful? Give feedback.
An excerpt of a DXF has a very limited use specially with complex objects like the Array. Most of the time the necessary information is spread through the whole file.
In your case you are dealing with an Array. When an Array is build in AutoCad it creates a block named "U#" that holds the entities for each cell of the array, then it builds another block, also named "U#", with all references to that block (Inserts) ordered according to the properties of the Array, and then it inserts it into the drawing. So, you will need to look for an Insert in the document entities and then, inside the entities of the block associated with that insert, you will find a list of Insert entities that refere…