Quantcast
Channel: Rhino Developer - McNeel Forum
Viewing all articles
Browse latest Browse all 8664

Delete Block

$
0
0

@Tom_Holt wrote:

Hi,

I have issue with blocks.

I delete blocks like this:

//Find block with similar name and delete them all

List<int> deleteId = new List<int>();

 foreach (Rhino.DocObjects.InstanceDefinition idef in Rhino.RhinoDoc.ActiveDoc.InstanceDefinitions)
       if (idef.Name.Length > blockName.Length)
           if (idef.Name.Substring(0, blockName.Length) == blockName)
               deleteId.Add(idef.Index);

 foreach (int i in deleteId)
       Rhino.RhinoDoc.ActiveDoc.InstanceDefinitions.Delete(i, true, true);

They do not appear on the screen anymore but when I count total instance of the objects they are somewhere in the document as this number is increasing. I do not see any blocks on block manager, but guids of them appears.

How to delete blocks correctly?

 Rhino.RhinoApp.WriteLine(Rhino.RhinoDoc.ActiveDoc.InstanceDefinitions.Count.ToString());

I tried manually purge all objects. But still the number is increasing. Let say I have totally 30 intances in doucument.
First time there are 30 , I delete them nothing on the screen but counter says there is 60 after I place new blocks, then 90 , 120 ... to whatever big number.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 8664

Trending Articles