After having a closer look, it looks like the way things
are designed, you do not use the ResultBuffer to build
a selection set filter.
You just create an array of TypedValue's and pass that
to the SelectionFilter's c'tor.
That's the good news.
Unfortunately, the SelectionFilter class uses an internal
class called FilterExtractor which in turn, uses the same
ResultBuffer class to convert the array of TypedValue's
into an unmanaged resbuf chain. I have no idea what the
FilterExtractor is for, or why it uses ResultBuffer internally,
but given the fact that the latter assumes that it deals
only with DWG-persistent data (data stored in a .DWG),
it appears that the ResultBuffer was never intended to be
used for building filter lists to begin with.
I guess whomever was responsible for the SelectionFilter
and FilterExtractor implementations didn't realize that,
and that's why the former can't deal with some resbuf
types like the -4 logical filter grouping delimters.
So, there is no workaround for the problem because in
any case, the filter data is going to end up going through
a ResultBuffer before it is used.
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com
wrote in message news:4864330@discussion.autodesk.com...
I want to select circles and lines using selectionset.
The source code file is in the attachment.
But when i test it in AutoCAD,I get the following error message:
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. --->
System.NullReferenceException: Object reference not set to an ins
tance of an object.
at Autodesk.AutoCAD.DatabaseServices.ResultBuffer..ctor(TypedValue[] values)
at Autodesk.AutoCAD.EditorInput.FilterExtractor.__ctor(FilterExtractor* , SelectionFilter filter)
at Autodesk.AutoCAD.EditorInput.Editor.GetSelection(SelectionFilter filter)
at ClassLibrary.DNOTClass.test()
--- End of inner exception stack trace ---
at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[]
parameters,
CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess)
at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[]
parameters, CultureInfo culture, Boolean verifyAccess)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[]
parameters, CultureInfo culture)
at AcMgPerDocumentCommandClass.Invoke(AcMgPerDocumentCommandClass* , gcroot<:REFL>
ection::MethodInfo __gc *>* mi)
at Autodesk.AutoCAD.Runtime.SEHExceptionFilter.InvokeWorker()
at Autodesk.AutoCAD.Runtime.ExceptionFilter.Invoke()
How to solve this problem?Thanks.