Selection issues

Hi - I have a custom function that runs through meshes and creates centerlines based on their geometry.  However, I have some drawings where the mesh seems to consist of entities that are not connected.  why would that be (ie when I select certain meshes, it also selects some other meshes (others work fine)).  There are no hidden entities. My selection method is set to  "actionType.SelectByPick"... Thx in advance

0

Comments

2 comments
Date Votes
  • Hello,

    You can try `Mesh.SplitDisjoint()` method to separate them.

    0
  • Thanks for the quick reply.  However, this seems to "explode" the entity into very small meshes, and not into 2 meshes - as expected?  Perhaps I'm missing some other settings? 

    I tried this: 

    List<Mesh> newList = new List<Mesh>();

    for (int i = 0; i < design1.Entities.Count; i++)
    {
        if (design1.Entities[i] is Mesh mesh && mesh.Visible)
        {
           var newMEsh =  mesh.SplitDisjoint();

            if (newMEsh.Count() >= 1)
            {
                design1.Entities.Remove(mesh);

                foreach (var ent in newMEsh)
                {
                    newList.Add(ent);
                }
                //design1.Entities.AddRange(newMEsh);
                
            }
        }
    }

    design1.Entities.AddRange(newList);

    design1.UpdateBoundingBox();
    design1.Invalidate();
    0

Please sign in to leave a comment.

Didn't find what you were looking for?

New post