ACadSharp
ACadSharp copied to clipboard
Insert inside Insert
I can't figure out how can I iterate over all "insert objects".
This is the file:
With this code I'm able to get first level of Insert
For Each entt In thedoc.Entities.OfType(Of ACadSharp.Entities.Insert)
But inside "FILLER" insert I have other child insert
How can I get their attributes values?
Hi @merco
I don't know much about VB, but I you can check this code in C# and see if it helps you:
var inserts = doc.Entities.OfType<Insert>().Where(e => e.Block.Name == "FILLER");
foreach (Insert insert in inserts)
{
foreach (var att in inserts.Select(b => b.Block.Entities.OfType<Insert>().Select(i => i.Attributes)))
{
// To something with the attribute
}
}
What this code does is to get the Inserts called FILLER and iterate throw the entities in the Block record and get the nested inserts, and then select the attributes in it.
Let me know if this helps.