Author Topic: PromptNestedEntityOptions exclude object  (Read 1639 times)

0 Members and 1 Guest are viewing this topic.

latour_g

  • Newt
  • Posts: 184
PromptNestedEntityOptions exclude object
« on: June 29, 2022, 01:23:14 PM »
Hi everyone,

Is it possible to exclude objects when using PromptNestedEntityOptions ? The issue is I want to select attributes but when there is hatch under it, it doesn't work or sometime it does work and sometime it doesn't work, depending of the picked point on the attribute.

So I would like the hatch to be ignore or only the attributes to be include. 

Or would there be another way to select attribute with a picked point ?

Code - C#: [Select]
  1.                         PromptNestedEntityOptions pneo = new PromptNestedEntityOptions("");
  2.                         pneo.AllowNone = false;
  3.                         pneo.UseNonInteractivePickPoint = true;
  4.                         pneo.NonInteractivePickPoint = per.PickedPoint;
  5.                         PromptNestedEntityResult pner = ed.GetNestedEntity(pneo);
  6.                         if (pner.ObjectId == ObjectId.Null) return;
  7.                         DBObject obj = tr.GetObject(pner.ObjectId, OpenMode.ForWrite);
  8.                         AttributeReference ar = obj as AttributeReference;
  9.  

Thank you

Jeff H

  • Needs a day job
  • Posts: 6150
Re: PromptNestedEntityOptions exclude object
« Reply #1 on: June 29, 2022, 06:26:23 PM »
Have tried something like
Code: [Select]
foreach (ObjectId id in pner.GetContainers())
            {

             // check if attribute

            }

Chumplybum

  • Newt
  • Posts: 97
Re: PromptNestedEntityOptions exclude object
« Reply #2 on: June 29, 2022, 07:27:33 PM »
Haven't tested this, but you could try SelectionAddedEventHandler, example here: https://www.keanw.com/2011/08/preventing-autocad-objects-from-being-selected-using-net.html

latour_g

  • Newt
  • Posts: 184
Re: PromptNestedEntityOptions exclude object
« Reply #3 on: July 05, 2022, 10:30:45 AM »
Jeff H : I was full of hope but unfortunately GetContainers() only contains the hatch. 

Chumplybum : Thanks I will check if I can use that.

I will come back if I found a solution.

Thanks to both of you !