.NET

Reply
Active Contributor
tangferry
Posts: 43
Registered: ‎04-21-2005
Message 1 of 16 (81 Views)

How to wrapper the acutBuilList function?

81 Views, 15 Replies
06-01-2005 11:57 PM
I was told that in the managed wrapper class,you cannot use the conditional selectionset.So anyone could wrapper the acutBuilList function so that it can be used in .NET?
*Albert Szilvasy
Message 2 of 16 (81 Views)

Re: How to wrapper the acutBuilList function?

06-02-2005 08:39 AM in reply to: tangferry
Tony already posted some code that does this. You reported that it doesn't
work but you just didn't read the caveat: you shouldn't call AsArray() on
the resulting ResultBuffer. I recommend you read Tony's post again.

albert
wrote in message news:4862889@discussion.autodesk.com...
I was told that in the managed wrapper class,you cannot use the conditional
selectionset.So anyone could wrapper the acutBuilList function so that it
can be used in .NET?
Active Contributor
tangferry
Posts: 43
Registered: ‎04-21-2005
Message 3 of 16 (81 Views)

Re: How to wrapper the acutBuilList function?

06-02-2005 07:19 PM in reply to: tangferry
I have tried his codes,but it does not work.
*Albert Szilvasy
Message 4 of 16 (81 Views)

Re: How to wrapper the acutBuilList function?

06-02-2005 08:23 PM in reply to: tangferry
What does that mean? What did you expect to happen and what actually
happened?

Albert
wrote in message news:4864286@discussion.autodesk.com...
I have tried his codes,but it does not work.
Active Contributor
tangferry
Posts: 43
Registered: ‎04-21-2005
Message 5 of 16 (81 Views)

Re: How to wrapper the acutBuilList function?

06-02-2005 09:56 PM in reply to: tangferry
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 instance 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<:REFLECTION::METHODINFO __gc="">* mi)
at Autodesk.AutoCAD.Runtime.SEHExceptionFilter.InvokeWorker()
at Autodesk.AutoCAD.Runtime.ExceptionFilter.Invoke()

How to solve this problem?Thanks.
*Tony Tanzillo
Message 6 of 16 (81 Views)

Re: How to wrapper the acutBuilList function?

06-03-2005 01:08 AM in reply to: tangferry
Sorry, I failed to consider that in order to use a
ResultBuffer for object selection filtering, you must
call the AsArray() member, and if you look at my
original workaround, you'll see the caveat that you
can't do that after hacking the ResultBuffer.

So, the workaround is essentially useless.

Let's see what else we can come up with ....

--
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.
*Tony Tanzillo
Message 7 of 16 (81 Views)

Re: How to wrapper the acutBuilList function?

06-03-2005 01:08 AM in reply to: tangferry
"Albert Szilvasy" wrote

>> What does that mean? What did you expect to
>> happen and what actually happened?

Well, I think I know what happened.

He has to pass the SelectionFilter's c'tor an array of TypedValue[],
which means he has to call ResultBuffer.AsArray() to get them.

Duh - oh well, so much for that workaround!


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com
*Tony Tanzillo
Message 8 of 16 (81 Views)

Re: How to wrapper the acutBuilList function?

06-03-2005 02:32 AM in reply to: tangferry
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.
*Albert Szilvasy
Message 9 of 16 (81 Views)

Re: How to wrapper the acutBuilList function?

06-03-2005 08:31 AM in reply to: tangferry
It is actually not completely useless. You just need to call acedSSGet
directly with the resbuf. I try to put together an example today or over the
weekend.

albert
"Tony Tanzillo" wrote in message
news:4864380@discussion.autodesk.com...
Sorry, I failed to consider that in order to use a
ResultBuffer for object selection filtering, you must
call the AsArray() member, and if you look at my
original workaround, you'll see the caveat that you
can't do that after hacking the ResultBuffer.

So, the workaround is essentially useless.

Let's see what else we can come up with ....

--
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.
*Tony Tanzillo
Message 10 of 16 (81 Views)

Re: How to wrapper the acutBuilList function?

06-03-2005 09:38 AM in reply to: tangferry
Thanks. I've already done just that. Attached is relevant
portions of a module that exposes selected parts of the
legacy RxAds API (including a fairly complete/robust port of
acedCommand() ).

The 'PickSet' class wraps an ADS-style selection set. It has
a default indexer that allows access to individual ads_names
in the pickset, but I was going to change that to render the
contents as managed ObjectId's. For now, its easy to do
the conversion (pass the second element of the ads_name
to the ObjectId's ctor).

The biggest wall I've hit, involves converting the resulting
ads_name (selection set) back to a managed SelectionSet
class, which doesn't appear to be possible since its ctor is
protected.

Now, I'm looking at how to bypass that and make a call to
an internal/protected/private method using reflection.

Have you done that yet?

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"Albert Szilvasy" wrote in message news:4864849@discussion.autodesk.com...
It is actually not completely useless. You just need to call acedSSGet
directly with the resbuf. I try to put together an example today or over the
weekend.

albert
"Tony Tanzillo" wrote in message
news:4864380@discussion.autodesk.com...
Sorry, I failed to consider that in order to use a
ResultBuffer for object selection filtering, you must
call the AsArray() member, and if you look at my
original workaround, you'll see the caveat that you
can't do that after hacking the ResultBuffer.

So, the workaround is essentially useless.

Let's see what else we can come up with ....

--
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.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community