Tim.
This was the Method I was referring to for the PromptEntityOptions Class
... looks like they are not available for the PromptNestedEntityOptions Class
Not really a big deal. You can easily roll your own version of
what AddAllowedClass() and SetRejectMessage() does.
In fact, I did just that before R17 came along.
The code below is from MTextFragmentSample.cs available
on caddzone.com. It does essentially the same thing the
aforementioned methods do, 'cept it also automates the
generation of the 'reject message'.
Should be fairly trivial to do a variant (SelectNestedObject?)
that also supported the automated entity type validation,
with the added benefit that it works on on R16 later.
Another possible enhancement I've pondered by never
got around to doing, is to use the errno system variable
to distinguish a 'missed' pick, and retry.
The more important message here, for Tim and other
learners, is to keep in mind that the APIs and .NET
make it relatively simple to 'roll your own' reusable
solutions for common functionality needs like this.
So, don't look at what the AutoCAD API's do or do
not offer, and assume you're stuck with that and only
that. If you keep in mind that much of the managed
ObjectARX API is actually implemented in managed
code (as opposed to native code), it becomes clear
that you can solve many problems and/or address
deficiencies in the API yourself, and do it in ways that
are highly reusable.
;; Excerpt from http://www.caddzone.com/MTextFragmentSample.cs
static ObjectId SelectObject(string prompt, System.Type objectClass)
{
Editor e = AcadApp.DocumentManager.MdiActiveDocument.Editor;
using ( Transaction tr = e.Document.Database.TransactionManager.StartTransaction() )
{
while( true )
{
PromptEntityResult res = e.GetEntity(prompt);
if( res.Status != PromptStatus.OK )
return ObjectId.Null;
DBObject ob = tr.GetObject(res.ObjectId, OpenMode.ForRead);
if( objectClass.IsAssignableFrom(ob.GetType()) )
return res.ObjectId;
e.WriteMessage("\nInvalid selection, {0} entity expected",
RXClass.GetClass(objectClass).DxfName);
}
}
}