ACadSharp icon indicating copy to clipboard operation
ACadSharp copied to clipboard

Insert inside Insert

Open merco opened this issue 1 year ago • 1 comments

I can't figure out how can I iterate over all "insert objects".

This is the file:

UniRif4-63125_151-Rev2.zip

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

immagine

How can I get their attributes values?

merco avatar Feb 07 '24 15:02 merco

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.

DomCR avatar Feb 07 '24 16:02 DomCR