<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: .net cannot do Conditional Filtering!! in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/net-cannot-do-conditional-filtering/m-p/1339826#M84852</link>
    <description>hi,Tony Tanzillo.Thanks for your reply.&lt;BR /&gt;
But your code does not work,can you give a full example?Or can you give an example for using the acutBuildList in C# through the unmanaged codes.&lt;BR /&gt;
Here is my code(but it does not work),can you exam it?</description>
    <pubDate>Thu, 02 Jun 2005 06:38:05 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2005-06-02T06:38:05Z</dc:date>
    <item>
      <title>.net cannot do Conditional Filtering!!</title>
      <link>https://forums.autodesk.com/t5/net-forum/net-cannot-do-conditional-filtering/m-p/1339822#M84848</link>
      <description>In objectarx(C++) ,You can use the following code selects all circles in the drawing  with a radius of 1.0 and all lines on the layer "ABC".&lt;BR /&gt;
&lt;BR /&gt;
struct resbuf* prb;&lt;BR /&gt;
prb=acutBuildList(-4,"&lt;OR&gt;",-4,"&lt;AND&gt;",-4,"or&amp;gt;",0);&lt;BR /&gt;
acedSSGet("X",NULL,NULL,prb,ssname);&lt;BR /&gt;
But how to do this in .net?&lt;/AND&gt;&lt;/OR&gt;</description>
      <pubDate>Mon, 30 May 2005 12:30:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/net-cannot-do-conditional-filtering/m-p/1339822#M84848</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-05-30T12:30:17Z</dc:date>
    </item>
    <item>
      <title>Re: .net cannot do Conditional Filtering!!</title>
      <link>https://forums.autodesk.com/t5/net-forum/net-cannot-do-conditional-filtering/m-p/1339823#M84849</link>
      <description>You can't. This is a bug. The managed wrapper is interpreting -4 &lt;BR /&gt;
incorrectly. The internal bug number is 646182 in case you ever want to &lt;BR /&gt;
inquire its status through official support channels.&lt;BR /&gt;
&lt;BR /&gt;
Albert&lt;BR /&gt;
&lt;TANGFERRY&gt; wrote in message news:4859917@discussion.autodesk.com...&lt;BR /&gt;
In objectarx(C++) ,You can use the following code selects all circles in the &lt;BR /&gt;
drawing  with a radius of 1.0 and all lines on the layer "ABC".&lt;BR /&gt;
&lt;BR /&gt;
struct resbuf* prb;&lt;BR /&gt;
prb=acutBuildList(-4,"&lt;OR&gt;",-4,"&lt;AND&gt;",-4,"or&amp;gt;",0);&lt;BR /&gt;
acedSSGet("X",NULL,NULL,prb,ssname);&lt;BR /&gt;
But how to do this in .net?&lt;/AND&gt;&lt;/OR&gt;&lt;/TANGFERRY&gt;</description>
      <pubDate>Mon, 30 May 2005 20:28:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/net-cannot-do-conditional-filtering/m-p/1339823#M84849</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-05-30T20:28:07Z</dc:date>
    </item>
    <item>
      <title>Re: .net cannot do Conditional Filtering!!</title>
      <link>https://forums.autodesk.com/t5/net-forum/net-cannot-do-conditional-filtering/m-p/1339824#M84850</link>
      <description>"Albert Szilvasy" wrote &lt;BR /&gt;
&lt;BR /&gt;
&amp;gt;&amp;gt; You can't. This is a bug. The managed wrapper is &lt;BR /&gt;
&amp;gt;&amp;gt; interpreting -4 incorrectly. &lt;BR /&gt;
&lt;BR /&gt;
Looks like the problem is that ResultBuffer is using&lt;BR /&gt;
acdbGroupCodeToType (in ResbufToTypedValue and&lt;BR /&gt;
TypedValueToResbuf), which is fine for xdata and&lt;BR /&gt;
xrecord lists, but is not for selection set filter lists &lt;BR /&gt;
(never was). Not sure what the designer was thinking &lt;BR /&gt;
there &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
Given the problem, I'd guess that an interim fix for&lt;BR /&gt;
the current release is unlikely. &lt;BR /&gt;
&lt;BR /&gt;
But the good news is that a workaround (involving &lt;BR /&gt;
a bit of unsafe code) is fairly simple:&lt;BR /&gt;
&lt;BR /&gt;
////////// Requires /unsafe compiler switch&lt;BR /&gt;
&lt;BR /&gt;
unsafe private struct resbuf_thunk&lt;BR /&gt;
{&lt;BR /&gt;
   internal resbuf_thunk* rbnext;&lt;BR /&gt;
   internal short restype;&lt;BR /&gt;
   internal void* resval;&lt;BR /&gt;
};&lt;BR /&gt;
&lt;BR /&gt;
unsafe private void &lt;BR /&gt;
AddStringToResbuf(ResultBuffer buffer, short rtype, string val)&lt;BR /&gt;
{&lt;BR /&gt;
   const short RTSTR = 5005;&lt;BR /&gt;
   buffer.Add( new TypedValue( RTSTR, val )); &lt;BR /&gt;
   resbuf_thunk* rb = (resbuf_thunk*) buffer.UnmanagedObject.ToPointer();&lt;BR /&gt;
   resbuf_thunk* tail = null;&lt;BR /&gt;
   while( rb != null )&lt;BR /&gt;
   {&lt;BR /&gt;
      tail = rb;&lt;BR /&gt;
      rb = rb-&amp;gt;rbnext;&lt;BR /&gt;
   }&lt;BR /&gt;
   if( tail != null )&lt;BR /&gt;
      tail-&amp;gt;restype = rtype;&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
// with the above, he can do the same as this&lt;BR /&gt;
//&lt;BR /&gt;
//   acutBuildList(-4,"&lt;AND&gt;")&lt;BR /&gt;
//&lt;BR /&gt;
// like this:&lt;BR /&gt;
&lt;BR /&gt;
{&lt;BR /&gt;
    const short RTDXF0 = 5020;&lt;BR /&gt;
    ResultBuffer myFilter = new ResultBuffer();&lt;BR /&gt;
    AddStringToResbuf(myFilter, -4, "&lt;AND&gt;
    myFilter.Add( new TypedValue(RTDXF0, "CIRCLE"));&lt;BR /&gt;
    myFilter.Add( new TypedValue(40, 1.0));&lt;BR /&gt;
    AddStringToResbuf(myFilter, -4, "AND&amp;gt;");&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
if ResultBuffer does not like RTDXF0 (not sure, haven't &lt;BR /&gt;
tested this), AddString() should be useful for working&lt;BR /&gt;
around that as well.&lt;BR /&gt;
&lt;BR /&gt;
There is one caveat, which is that once a ResultBuffer has&lt;BR /&gt;
been hacked this way, we can't iterate over it; call the&lt;BR /&gt;
AsArray() member; or do anything else that renders the&lt;BR /&gt;
contents of the ResultBuffer as TypedValues, because that &lt;BR /&gt;
also leads to a call to acdbGroupCodeToType().&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006&lt;BR /&gt;
http://www.acadxtabs.com&lt;/AND&gt;&lt;/AND&gt;</description>
      <pubDate>Tue, 31 May 2005 08:44:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/net-cannot-do-conditional-filtering/m-p/1339824#M84850</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-05-31T08:44:27Z</dc:date>
    </item>
    <item>
      <title>Re: .net cannot do Conditional Filtering!!</title>
      <link>https://forums.autodesk.com/t5/net-forum/net-cannot-do-conditional-filtering/m-p/1339825#M84851</link>
      <description>Indeed, the fix will involve fixing acdbGroupCodeToType() so that it works &lt;BR /&gt;
properly for resbuf chains that specify a selection filter. The type codes &lt;BR /&gt;
in a resbuf chain should be unambiguous irregardless of the usage of the &lt;BR /&gt;
resbuf chain.&lt;BR /&gt;
&lt;BR /&gt;
Albert&lt;BR /&gt;
&lt;BR /&gt;
"Tony Tanzillo" &lt;TONY.TANZILLO&gt; wrote in message &lt;BR /&gt;
news:4860355@discussion.autodesk.com...&lt;BR /&gt;
"Albert Szilvasy" wrote&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt;&amp;gt; You can't. This is a bug. The managed wrapper is&lt;BR /&gt;
&amp;gt;&amp;gt; interpreting -4 incorrectly.&lt;BR /&gt;
&lt;BR /&gt;
Looks like the problem is that ResultBuffer is using&lt;BR /&gt;
acdbGroupCodeToType (in ResbufToTypedValue and&lt;BR /&gt;
TypedValueToResbuf), which is fine for xdata and&lt;BR /&gt;
xrecord lists, but is not for selection set filter lists&lt;BR /&gt;
(never was). Not sure what the designer was thinking&lt;BR /&gt;
there &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
Given the problem, I'd guess that an interim fix for&lt;BR /&gt;
the current release is unlikely.&lt;BR /&gt;
&lt;BR /&gt;
But the good news is that a workaround (involving&lt;BR /&gt;
a bit of unsafe code) is fairly simple:&lt;BR /&gt;
&lt;BR /&gt;
////////// Requires /unsafe compiler switch&lt;BR /&gt;
&lt;BR /&gt;
unsafe private struct resbuf_thunk&lt;BR /&gt;
{&lt;BR /&gt;
   internal resbuf_thunk* rbnext;&lt;BR /&gt;
   internal short restype;&lt;BR /&gt;
   internal void* resval;&lt;BR /&gt;
};&lt;BR /&gt;
&lt;BR /&gt;
unsafe private void&lt;BR /&gt;
AddStringToResbuf(ResultBuffer buffer, short rtype, string val)&lt;BR /&gt;
{&lt;BR /&gt;
   const short RTSTR = 5005;&lt;BR /&gt;
   buffer.Add( new TypedValue( RTSTR, val ));&lt;BR /&gt;
   resbuf_thunk* rb = (resbuf_thunk*) buffer.UnmanagedObject.ToPointer();&lt;BR /&gt;
   resbuf_thunk* tail = null;&lt;BR /&gt;
   while( rb != null )&lt;BR /&gt;
   {&lt;BR /&gt;
      tail = rb;&lt;BR /&gt;
      rb = rb-&amp;gt;rbnext;&lt;BR /&gt;
   }&lt;BR /&gt;
   if( tail != null )&lt;BR /&gt;
      tail-&amp;gt;restype = rtype;&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
// with the above, he can do the same as this&lt;BR /&gt;
//&lt;BR /&gt;
//   acutBuildList(-4,"&lt;AND&gt;")&lt;BR /&gt;
//&lt;BR /&gt;
// like this:&lt;BR /&gt;
&lt;BR /&gt;
{&lt;BR /&gt;
    const short RTDXF0 = 5020;&lt;BR /&gt;
    ResultBuffer myFilter = new ResultBuffer();&lt;BR /&gt;
    AddStringToResbuf(myFilter, -4, "&lt;AND&gt;
    myFilter.Add( new TypedValue(RTDXF0, "CIRCLE"));&lt;BR /&gt;
    myFilter.Add( new TypedValue(40, 1.0));&lt;BR /&gt;
    AddStringToResbuf(myFilter, -4, "AND&amp;gt;");&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
if ResultBuffer does not like RTDXF0 (not sure, haven't&lt;BR /&gt;
tested this), AddString() should be useful for working&lt;BR /&gt;
around that as well.&lt;BR /&gt;
&lt;BR /&gt;
There is one caveat, which is that once a ResultBuffer has&lt;BR /&gt;
been hacked this way, we can't iterate over it; call the&lt;BR /&gt;
AsArray() member; or do anything else that renders the&lt;BR /&gt;
contents of the ResultBuffer as TypedValues, because that&lt;BR /&gt;
also leads to a call to acdbGroupCodeToType().&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006&lt;BR /&gt;
http://www.acadxtabs.com&lt;/AND&gt;&lt;/AND&gt;&lt;/TONY.TANZILLO&gt;</description>
      <pubDate>Tue, 31 May 2005 16:39:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/net-cannot-do-conditional-filtering/m-p/1339825#M84851</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-05-31T16:39:24Z</dc:date>
    </item>
    <item>
      <title>Re: .net cannot do Conditional Filtering!!</title>
      <link>https://forums.autodesk.com/t5/net-forum/net-cannot-do-conditional-filtering/m-p/1339826#M84852</link>
      <description>hi,Tony Tanzillo.Thanks for your reply.&lt;BR /&gt;
But your code does not work,can you give a full example?Or can you give an example for using the acutBuildList in C# through the unmanaged codes.&lt;BR /&gt;
Here is my code(but it does not work),can you exam it?</description>
      <pubDate>Thu, 02 Jun 2005 06:38:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/net-cannot-do-conditional-filtering/m-p/1339826#M84852</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-06-02T06:38:05Z</dc:date>
    </item>
    <item>
      <title>Re: .net cannot do Conditional Filtering!!</title>
      <link>https://forums.autodesk.com/t5/net-forum/net-cannot-do-conditional-filtering/m-p/1339827#M84853</link>
      <description>&lt;TANGFERRY&gt; wrote &lt;BR /&gt;
&lt;BR /&gt;
&amp;gt; hi,Tony Tanzillo.Thanks for your reply.&lt;BR /&gt;
&amp;gt; But your code does not work&lt;BR /&gt;
&lt;BR /&gt;
It certainly does work. If it does not work for&lt;BR /&gt;
you, it is because you are doing something wrong.&lt;BR /&gt;
&lt;BR /&gt;
Are you expecting me to guess what that is?&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
,can you give a full example?Or can you give an example for using the acutBuildList in C# through the unmanaged codes.&lt;BR /&gt;
Here is my code(but it does not work),can you exam it?&lt;/TANGFERRY&gt;</description>
      <pubDate>Fri, 03 Jun 2005 08:08:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/net-cannot-do-conditional-filtering/m-p/1339827#M84853</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-06-03T08:08:04Z</dc:date>
    </item>
    <item>
      <title>Re: .net cannot do Conditional Filtering!!</title>
      <link>https://forums.autodesk.com/t5/net-forum/net-cannot-do-conditional-filtering/m-p/1339828#M84854</link>
      <description>This code is very interesting to me. It is exactly what I am finding. I took it BUT it doesn't work ???&lt;BR /&gt;
&lt;BR /&gt;
But am sure that it works at you.&lt;BR /&gt;
I have only one idea. What do you think about this.&lt;BR /&gt;
I am using Visual Studio 2003, and all may managed code works fine. May be problem that unmanaged code I may to use only in Visual Studio 2002 ?</description>
      <pubDate>Sun, 25 Sep 2005 16:11:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/net-cannot-do-conditional-filtering/m-p/1339828#M84854</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-09-25T16:11:48Z</dc:date>
    </item>
  </channel>
</rss>

