.NET

Reply
Distinguished Contributor
cgay
Posts: 125
Registered: ‎08-02-2005
Message 1 of 11 (424 Views)

Selection Set with relational filter

424 Views, 10 Replies
08-03-2005 10:09 AM
I cannot create a selection set with a relational filter as such:

Private Sub CConvStart()

Dim ed As Editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor

Dim values() As TypedValue = { _
New TypedValue(-4, " New TypedValue(DxfCode.Start, "LWPOLYLINE"), _
New TypedValue(DxfCode.Int16, 1), _
New TypedValue(-4, "AND>"), _
New TypedValue(-4, " New TypedValue(DxfCode.LayerName, "Layer1"), _
New TypedValue(DxfCode.LayerName, "Layer2"), _
New TypedValue(DxfCode.LayerName, "Layer3"), _
New TypedValue(-4, "OR>") _
}

Dim sfilter As New SelectionFilter(values) ' Create the filter using our values...
'Set the selection options
Dim SelOpts As New PromptSelectionOptions
SelOpts.Keywords.Add("Options")
SelOpts.MessageForAdding = "Select Items to be Processed:"
SelOpts.AllowDuplicates = False

'Make the selection:
Try
Dim res As PromptSelectionResult = ed.GetSelection(SelOpts, sfilter)
Select Case res.Status
Case PromptStatus.OK
Dim SS As Autodesk.AutoCAD.EditorInput.SelectionSet = res.Value
Dim idarray As ObjectId() = SS.GetObjectIds()
Dim db As Database = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database
Dim tm As Autodesk.AutoCAD.DatabaseServices.TransactionManager = db.TransactionManager
'start a transaction
Dim myT As Transaction = tm.StartTransaction()
Try
Dim id As ObjectId
For Each id In idarray
Dim dbObj As DBObject = tm.GetObject(id, OpenMode.ForRead, True)
If TypeOf dbObj Is Entity Then
Dim entity As Entity = CType(dbObj, Entity)
ed.WriteMessage((ControlChars.Lf + "You selected: " + entity.GetType().FullName))
End If
Next id
Finally
myT.Dispose()
End Try
Case PromptStatus.Keyword
MsgBox(res.ToString)
Return
Case Else
'Cancelled
Return
End Select
Catch ex As Exception
Return
End Try
End Sub

This will cause an error when the function "ed.GetSelection(SelOpts, sfilter)" is called. The stack trace is:

{System.FormatException}
[System.FormatException]: {System.FormatException}
HelpLink: Nothing
InnerException: Nothing
Message: "Input string was not in a correct format."
Source: "mscorlib"
StackTrace: " at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at System.Int32.Parse(String s, NumberStyles style, IFormatProvider provider)
at System.Convert.ToInt32(String value, IFormatProvider provider)
at System.String.System.IConvertible.ToInt32(IFormatProvider provider)
at System.Convert.ToInt32(Object value, IFormatProvider provider)
at Autodesk.AutoCAD.DatabaseServices.ResultBuffer.TypedValueToResbuf(TypedValue value)
at Autodesk.AutoCAD.DatabaseServices.ResultBuffer..ctor(TypedValue[] values)
at Autodesk.AutoCAD.EditorInput.FilterExtractor.__ctor(FilterExtractor* , SelectionFilter filter)
at Autodesk.AutoCAD.EditorInput.PromptSelectionOptions.Select(SelectionFilter filter)
at Autodesk.AutoCAD.EditorInput.Editor.GetSelection(PromptSelectionOptions options, SelectionFilter filter)

Using reflection, I have walked up the call stack and found the function "TypedValueToResbuf(ByVal value As TypedValue) As resbuf*" which is called from "public unsafe ResultBuffer(params TypedValue[] values)" to be the location of hte fault:

internal static unsafe resbuf* TypedValueToResbuf(TypedValue value)
{
int num1 = value.m_typeCode;
object obj1 = value.m_value;
CultureInfo info1 = CultureInfo.InvariantCulture;
switch (?acdbGroupCodeToType@@$$FYA?AW4DwgDataType@AcDb@@F@Z((short) num1))
{
case 0:
{
return null;
}
case 1:
{
double num6 = Convert.ToDouble(obj1, info1);
resbuf* resbufPtr9 = acutNewRb(num1);
resbufPtr9[8] = (resbuf) num6;
return resbufPtr9;
}
case 2:
{
int num5 = Convert.ToInt32(obj1, info1);
resbuf* resbufPtr8 = acutNewRb(num1);
*(((int*) (resbufPtr8 + 8))) = num5;
return resbufPtr8;
}
case 3:
{
short num4 = Convert.ToInt16(obj1, info1);
resbuf* resbufPtr7 = acutNewRb(num1);
*(((short*) (resbufPtr7 + 8))) = num4;
return resbufPtr7;
}
case 4:
{
byte num3 = Convert.ToByte(obj1, info1);
resbuf* resbufPtr6 = acutNewRb(num1);
*(((short*) (resbufPtr6 + 8))) = num3;
return resbufPtr6;
}
case 5:
{
sbyte modopt(NoSignSpecifiedModifier)* localPtr1;
StringToCIF ocif1;
StringToCIF* ocifPtr1 = StringToCIF.__ctor((StringToCIF* modopt(IsConstModifier) modopt(IsConstModifier)) &ocif1, Convert.ToString(obj1, info1));
try
{
?acutNewString@@$$FYA?AW4ErrorStatus@Acad@@PBDAAPAD@Z(*((sbyte modopt(NoSignSpecifiedModifier) modopt(IsConstModifier)**) ocifPtr1), &localPtr1);
}
fault
{
__CxxCallUnwindDtor((void modopt(CallConvThiscall) *(void*)) __unep@??1StringToCIF@@$$FQAE@XZ, (void*) &ocif1);
}
StringToCIF.__dtor((StringToCIF* modopt(IsConstModifier) modopt(IsConstModifier)) &ocif1);
resbuf* resbufPtr5 = acutNewRb(num1);
*(((int*) (resbufPtr5 + 8))) = localPtr1;
return resbufPtr5;
}
case 6:
{
byte[] buffer1 = (byte[]) obj1;
volatile pinned ref byte local1 = buffer1;
resbuf* resbufPtr1 = acutNewRb(num1);
short num2 = Convert.ToInt16(buffer1.Length);
?acutNewBuffer@@$$FYA?AW4ErrorStatus@Acad@@AAPADI@Z((sbyte modopt(NoSignSpecifiedModifier)** modopt(IsCXXReferenceModifier)) (resbufPtr1 + 12), (uint) num2);
*(((short*) (resbufPtr1 + 8))) = num2;
IntPtr ptr1 = Marshal.UnsafeAddrOfPinnedArrayElement(buffer1, 0);
IntPtr ptr2 = ptr1;
memcpy(ptr2.ToPointer(), *(((int*) (resbufPtr1 + 12))), num2);
return resbufPtr1;
}
case 7:
{
AcDbHandle handle1;
Handle handle2 = (Handle) obj1;
resbuf* resbufPtr3 = acutNewRb(num1);
memcpy(&handle2.mValue, &handle1, 8);
AcDbHandle.copyToOldType((AcDbHandle modopt(IsConstModifier)* modopt(IsConstModifier) modopt(IsConstModifier)) &handle1, (byte*) (resbufPtr3 + 8));
return resbufPtr3;
}
case 8:
case 9:
case 10:
case 11:
{
ObjectId id1 = (ObjectId) obj1;
resbuf* resbufPtr4 = acutNewRb(num1);
Interop.Check(?acdbGetAdsName@@$$FYA?AW4ErrorStatus@Acad@@AAY01JVAcDbObjectId@@@Z(($ArrayType$0x41fa7b4e* modopt(IsCXXReferenceModifier)) (resbufPtr4 + 8), *((AcDbObjectId*) &id1)));
return resbufPtr4;
}
case 12:
{
Point3d pointd1 = (Point3d) obj1;
resbuf* resbufPtr2 = acutNewRb(num1);
memcpy(&pointd1, (resbufPtr2 + 8), 0x18);
return resbufPtr2;
}
}
Interop.ThrowExceptionForErrorStatus(0x33);
return null;
}




I can use the selection set calls from interop, but this is not a final solution because I will be generating the interop libraries myself.
So my questions:
1.) What is Autodesk doing to fix this?
2.) Has this issue even been addressed?


I have looked at DOTNETARX, but this resolution still uses the Interop assemblies and the COM function 'SelectOnScreen' which doesn't allow for the Managed Call's "PromptSelectionOptions". It is a workaround, but I would like to see "acdbmgd" fixed.
Distinguished Contributor
cgay
Posts: 125
Registered: ‎08-02-2005
Message 2 of 11 (424 Views)

Re: Selection Set with relational filter

08-03-2005 10:20 AM in reply to: cgay
Well, the code example is not complete so I am attaching the example as a text file.
*Tony Tanzillo
Message 3 of 11 (424 Views)

Re: Selection Set with relational filter

08-03-2005 11:22 AM in reply to: cgay
This is a known problem. You have to use ActiveX, then
use Editor.SelectPrevious to get the selection set as a
managed object.

--
http://www.caddzone.com

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

wrote in message news:4918645@discussion.autodesk.com...
I cannot create a selection set with a relational filter as such:

Private Sub CConvStart()

Dim ed As Editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor

Dim values() As TypedValue = { _
New TypedValue(-4, " New TypedValue(DxfCode.Start, "LWPOLYLINE"), _
New TypedValue(DxfCode.Int16, 1), _
New TypedValue(-4, "AND>"), _
New TypedValue(-4, " New TypedValue(DxfCode.LayerName, "Layer1"), _
New TypedValue(DxfCode.LayerName, "Layer2"), _
New TypedValue(DxfCode.LayerName, "Layer3"), _
New TypedValue(-4, "OR>") _
}

Dim sfilter As New SelectionFilter(values) ' Create the filter using our values...
'Set the selection options
Dim SelOpts As New PromptSelectionOptions
SelOpts.Keywords.Add("Options")
SelOpts.MessageForAdding = "Select Items to be Processed:"
SelOpts.AllowDuplicates = False

'Make the selection:
Try
Dim res As PromptSelectionResult = ed.GetSelection(SelOpts, sfilter)
Select Case res.Status
Case PromptStatus.OK
Dim SS As Autodesk.AutoCAD.EditorInput.SelectionSet = res.Value
Dim idarray As ObjectId() = SS.GetObjectIds()
Dim db As Database = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database
Dim tm As Autodesk.AutoCAD.DatabaseServices.TransactionManager = db.TransactionManager
'start a transaction
Dim myT As Transaction = tm.StartTransaction()
Try
Dim id As ObjectId
For Each id In idarray
Dim dbObj As DBObject = tm.GetObject(id, OpenMode.ForRead, True)
If TypeOf dbObj Is Entity Then
Dim entity As Entity = CType(dbObj, Entity)
ed.WriteMessage((ControlChars.Lf + "You selected: " + entity.GetType().FullName))
End If
Next id
Finally
myT.Dispose()
End Try
Case PromptStatus.Keyword
MsgBox(res.ToString)
Return
Case Else
'Cancelled
Return
End Select
Catch ex As Exception
Return
End Try
End Sub

This will cause an error when the function "ed.GetSelection(SelOpts, sfilter)" is called. The stack trace is:

{System.FormatException}
[System.FormatException]: {System.FormatException}
HelpLink: Nothing
InnerException: Nothing
Message: "Input string was not in a correct format."
Source: "mscorlib"
StackTrace: " at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at System.Int32.Parse(String s, NumberStyles style, IFormatProvider provider)
at System.Convert.ToInt32(String value, IFormatProvider provider)
at System.String.System.IConvertible.ToInt32(IFormatProvider provider)
at System.Convert.ToInt32(Object value, IFormatProvider provider)
at Autodesk.AutoCAD.DatabaseServices.ResultBuffer.TypedValueToResbuf(TypedValue value)
at Autodesk.AutoCAD.DatabaseServices.ResultBuffer..ctor(TypedValue[] values)
at Autodesk.AutoCAD.EditorInput.FilterExtractor.__ctor(FilterExtractor* , SelectionFilter filter)
at Autodesk.AutoCAD.EditorInput.PromptSelectionOptions.Select(SelectionFilter filter)
at Autodesk.AutoCAD.EditorInput.Editor.GetSelection(PromptSelectionOptions options, SelectionFilter filter)

Using reflection, I have walked up the call stack and found the function "TypedValueToResbuf(ByVal value As TypedValue) As resbuf*" which is called from "public unsafe ResultBuffer(params TypedValue[] values)" to be the location of hte fault:

internal static unsafe resbuf* TypedValueToResbuf(TypedValue value)
{
int num1 = value.m_typeCode;
object obj1 = value.m_value;
CultureInfo info1 = CultureInfo.InvariantCulture;
switch (?acdbGroupCodeToType@@$$FYA?AW4DwgDataType@AcDb@@F@Z((short) num1))
{
case 0:
{
return null;
}
case 1:
{
double num6 = Convert.ToDouble(obj1, info1);
resbuf* resbufPtr9 = acutNewRb(num1);
resbufPtr9[8] = (resbuf) num6;
return resbufPtr9;
}
case 2:
{
int num5 = Convert.ToInt32(obj1, info1);
resbuf* resbufPtr8 = acutNewRb(num1);
*(((int*) (resbufPtr8 + 8))) = num5;
return resbufPtr8;
}
case 3:
{
short num4 = Convert.ToInt16(obj1, info1);
resbuf* resbufPtr7 = acutNewRb(num1);
*(((short*) (resbufPtr7 + 8))) = num4;
return resbufPtr7;
}
case 4:
{
byte num3 = Convert.ToByte(obj1, info1);
resbuf* resbufPtr6 = acutNewRb(num1);
*(((short*) (resbufPtr6 + 8))) = num3;
return resbufPtr6;
}
case 5:
{
sbyte modopt(NoSignSpecifiedModifier)* localPtr1;
StringToCIF ocif1;
StringToCIF* ocifPtr1 = StringToCIF.__ctor((StringToCIF* modopt(IsConstModifier) modopt(IsConstModifier)) &ocif1, Convert.ToString(obj1, info1));
try
{
?acutNewString@@$$FYA?AW4ErrorStatus@Acad@@PBDAAPAD@Z(*((sbyte modopt(NoSignSpecifiedModifier) modopt(IsConstModifier)**) ocifPtr1), &localPtr1);
}
fault
{
__CxxCallUnwindDtor((void modopt(CallConvThiscall) *(void*)) __unep@??1StringToCIF@@$$FQAE@XZ, (void*) &ocif1);
}
StringToCIF.__dtor((StringToCIF* modopt(IsConstModifier) modopt(IsConstModifier)) &ocif1);
resbuf* resbufPtr5 = acutNewRb(num1);
*(((int*) (resbufPtr5 + 8))) = localPtr1;
return resbufPtr5;
}
case 6:
{
byte[] buffer1 = (byte[]) obj1;
volatile pinned ref byte local1 = buffer1;
resbuf* resbufPtr1 = acutNewRb(num1);
short num2 = Convert.ToInt16(buffer1.Length);
?acutNewBuffer@@$$FYA?AW4ErrorStatus@Acad@@AAPADI@Z((sbyte modopt(NoSignSpecifiedModifier)** modopt(IsCXXReferenceModifier)) (resbufPtr1 + 12), (uint) num2);
*(((short*) (resbufPtr1 + 8))) = num2;
IntPtr ptr1 = Marshal.UnsafeAddrOfPinnedArrayElement(buffer1, 0);
IntPtr ptr2 = ptr1;
memcpy(ptr2.ToPointer(), *(((int*) (resbufPtr1 + 12))), num2);
return resbufPtr1;
}
case 7:
{
AcDbHandle handle1;
Handle handle2 = (Handle) obj1;
resbuf* resbufPtr3 = acutNewRb(num1);
memcpy(&handle2.mValue, &handle1, 8);
AcDbHandle.copyToOldType((AcDbHandle modopt(IsConstModifier)* modopt(IsConstModifier) modopt(IsConstModifier)) &handle1, (byte*) (resbufPtr3 + 8));
return resbufPtr3;
}
case 8:
case 9:
case 10:
case 11:
{
ObjectId id1 = (ObjectId) obj1;
resbuf* resbufPtr4 = acutNewRb(num1);
Interop.Check(?acdbGetAdsName@@$$FYA?AW4ErrorStatus@Acad@@AAY01JVAcDbObjectId@@@Z(($ArrayType$0x41fa7b4e* modopt(IsCXXReferenceModifier)) (resbufPtr4 + 8), *((AcDbObjectId*) &id1)));
return resbufPtr4;
}
case 12:
{
Point3d pointd1 = (Point3d) obj1;
resbuf* resbufPtr2 = acutNewRb(num1);
memcpy(&pointd1, (resbufPtr2 + 8), 0x18);
return resbufPtr2;
}
}
Interop.ThrowExceptionForErrorStatus(0x33);
return null;
}




I can use the selection set calls from interop, but this is not a final solution because I will be generating the interop libraries myself.
So my questions:
1.) What is Autodesk doing to fix this?
2.) Has this issue even been addressed?


I have looked at DOTNETARX, but this resolution still uses the Interop assemblies and the COM function 'SelectOnScreen' which doesn't allow for the Managed Call's "PromptSelectionOptions". It is a workaround, but I would like to see "acdbmgd" fixed.
Active Contributor
tangferry
Posts: 43
Registered: ‎04-21-2005
Message 4 of 11 (424 Views)

Re: Selection Set with relational filter

08-03-2005 07:12 PM in reply to: cgay
You can use DOTNETARX to solve this problem.
*Tony Tanzillo
Message 5 of 11 (424 Views)

Re: Selection Set with relational filter

08-03-2005 11:12 PM in reply to: cgay
I don't think it's necessary to use a third party library
that solves problems using ActiveX, when anyone can
solve the problem directly with ActiveX.

--
http://www.caddzone.com

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

wrote in message news:4919233@discussion.autodesk.com...
You can use DOTNETARX to solve this problem.
Active Contributor
tangferry
Posts: 43
Registered: ‎04-21-2005
Message 6 of 11 (424 Views)

Re: Selection Set with relational filter

08-04-2005 03:38 AM in reply to: cgay
Tony Tanzillo
Date: Aug/04/05 - 06:12 (GMT)

Re: Selection Set with relational filter
I don't think it's necessary to use a third party library
that solves problems using ActiveX, when anyone can
solve the problem directly with ActiveX.

Then,you don't need any software,because you can write your own! Message was edited by: tangferry
*Tony Tanzillo
Message 7 of 11 (424 Views)

Re: Selection Set with relational filter

08-04-2005 07:43 AM in reply to: cgay
>> Then,you don't need any software,
>> because you can write your own!

Right - but the question is not if you
can write your own. The question is
whether it is better to write your own,
or not.

In this case, it is clearly better to
do the latter, since your code is much
slower at solving the problem, than
it needs to be.


--
http://www.caddzone.com

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

wrote in message news:4919387@discussion.autodesk.com...
Tony Tanzillo
Date: Aug/04/05 - 06:12 (GMT)

Re: Selection Set with relational filter
I don't think it's necessary to use a third party library
that solves problems using ActiveX, when anyone can
solve the problem directly with ActiveX.


Message was edited by: tangferry
Distinguished Contributor
cgay
Posts: 125
Registered: ‎08-02-2005
Message 8 of 11 (424 Views)

Re: Selection Set with relational filter

08-04-2005 11:50 AM in reply to: cgay
My intention was not to start an argument; it was just to alert Autodesk to the fact that there is a problem, and to point to the location where it came from. Also, I was hoping to get some feedback from some of you folks to ascertain whether or not their is a workaround that does NOT require referencing the AutoCAD 2006 Type libraries, and the AutoCAD 2006 Common Type Libraries.

Tony,
Yes, I see that the current workaround is to use COM. Do you have any info if Autodesk even knows about this issue, and if so, when do they plan to fix it?

tangferry,
I do realize that I can use DOTNETARX for this, but again I don't want the AutoCAD Type libraries dependency. And the code from DOTNETARX 2.1:

[code]
public static ObjectIdCollection GetSelection(TypedValue[] filter)
{
int num1 = filter.Length;
short[] numArray1 = new short[num1];
object[] objArray1 = new object[num1];
for (int num2 = 0; num2 < num1; num2++)
{
numArray1[num2] = filter[num2].TypeCode;
objArray1[num2] = filter[num2].Value;
}
AcadDocument document1 = (AcadDocument) Application.DocumentManager.MdiActiveDocument.AcadDocument;
AcadSelectionSet set1 = document1.get_SelectionSets().Add("temp");
set1.SelectOnScreen(numArray1, objArray1);
ObjectIdCollection collection1 = new ObjectIdCollection();
for (int num3 = 0; num3 < set1.get_Count(); num3++)
{
collection1.Add(DBObject.FromAcadObject(set1.Item(num3)));
}
set1.Delete();
return collection1;
}[/code]

clearly uses AutoCAD 2006 type libraries for AcadDocument and AcadSelectionSet objects.

To Everyone,
Also, please note that the COM calls don't support the options that the ARX calls do, like allowDuplicates, or everythingInAperture, etc...

Again, I write this to see if anyone has a "Managed ARX" workaround or knows if and when Autodesk plans to fix this.
Or do we wait until AutoCAD 2007? :-(
*Tony Tanzillo
Message 9 of 11 (424 Views)

Re: Selection Set with relational filter

08-04-2005 09:23 PM in reply to: cgay
There's no argument here. The issue I had with
tang's reply was that it implies that you need his
library to solve the problem, when in fact, his code
library uses ActiveX to solve the problem, which
you can do yourself.

If he made the source for his library available, so
others can see how the problem can be solved with
ActiveX, then I wouldn't have an issue.

Yes, Autodesk is aware of the problem.

Yes, the ActiveX workaround does not support all
options supported by acedSSGet().

Also, the code you show from DOTNETARX is not
the optimal solution. The optimal solution would
be to just call the ActiveX SelectXxxxx() method
to acquire the selection from the user, and then
use the SelectPrevious() method of the Editor
class to obtain the same selection as a managed
SelectionSet (rather than having to iterate through
the ActiveX selection set and add each object's id
to a collection, etc. which is unnecessary).

Regarding filtering in general, you should not worry
too much about this, because the filtering mechanism
used in ObjectARX, LISP, and ActiveX is considered
obsolute, and limited in terms of filtering criteria
(for example, you can't filter against xdata/xrecords
or something like that).

The preferred way to acquire a filtered selecton set
from the user, is by using the SelectionAdded event
of the managed Editor class.

That mechanism allows you to filter not only your
own calls to acedSSGet(), but any call to same, by
any application including AutoCAD.

With that event, you can examine each object that
will be added to the selection set under construction,
and if you want, prevent it from being added, based
on any criteria (you can for example, open the entity
and access its xdata or something in its extension
dictionary, and use that or any other data as filtering
criteria - something that cannot be done using the
old style SSGET filter list).

So, I do not see this as a major issue, and that's
mainly because I have for some time been using the
Selection.Added event for filtering (along with its
native AcEdSSGetFilter ObjectARX counterpart), and
find that it is much more powerful and flexible than
the 'old way' of doing things (acedSSGet filter lists).

--
http://www.caddzone.com

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

wrote in message news:4920114@discussion.autodesk.com...
My intention was not to start an argument; it was just to alert Autodesk to the fact that there is a problem, and to point to the location where it came from. Also, I was hoping to get some feedback from some of you folks to ascertain whether or not their is a workaround that does NOT require referencing the AutoCAD 2006 Type libraries, and the AutoCAD 2006 Common Type Libraries.

Tony,
Yes, I see that the current workaround is to use COM. Do you have any info if Autodesk even knows about this issue, and if so, when do they plan to fix it?

tangferry,
I do realize that I can use DOTNETARX for this, but again I don't want the AutoCAD Type libraries dependency. And the code from DOTNETARX 2.1:
[code]
public static ObjectIdCollection GetSelection(TypedValue[] filter)
{
int num1 = filter.Length;
short[] numArray1 = new short[num1];
object[] objArray1 = new object[num1];
for (int num2 = 0; num2 < num1; num2++)
{
numArray1[num2] = filter[num2].TypeCode;
objArray1[num2] = filter[num2].Value;
}
AcadDocument document1 = (AcadDocument) Application.DocumentManager.MdiActiveDocument.AcadDocument;
AcadSelectionSet set1 = document1.get_SelectionSets().Add("temp");
set1.SelectOnScreen(numArray1, objArray1);
ObjectIdCollection collection1 = new ObjectIdCollection();
for (int num3 = 0; num3 < set1.get_Count(); num3++)
{
collection1.Add(DBObject.FromAcadObject(set1.Item(num3)));
}
set1.Delete();
return collection1;
}[/code]

clearly uses AutoCAD 2006 type libraries for AcadDocument and AcadSelectionSet objects.

To Everyone,
Also, please note that the COM calls don't support the options that the ARX calls do, like allowDuplicates, or everythingInAperture, etc...

Again, I write this to see if anyone has a "Managed ARX" workaround or knows if and when Autodesk plans to fix this.
Or do we wait until AutoCAD 2007? :-(
Distinguished Contributor
cgay
Posts: 125
Registered: ‎08-02-2005
Message 10 of 11 (424 Views)

Re: Selection Set with relational filter

08-08-2005 05:50 AM in reply to: cgay
Tony,

Thanks for the reply. I hadn't even thought about using the SelectionAdded event. A very good suggestion indeed. Also, you mentioned that filtering may become obsolete? Is this true? The reason I ask is because if it were true, Autodesk may want to mark the Editor class as "Inheritable". Right now it is marked as "NotInheritable" and that makes it a pain to extend is behavior. But it is still better than having to rely on COM libraries and the Interop that is generated.

Do you have any samples for using this event?

Thanks,
C
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.