Define Rules for Selection Filters (.NET)

Define Rules for Selection Filters (.NET)

phuochung_dang
Contributor Contributor
2,286 Views
3 Replies
Message 1 of 4

Define Rules for Selection Filters (.NET)

phuochung_dang
Contributor
Contributor
Hi everybody, I am learning AutoCAD .NET. Currently, I want to create a command to select all objects are blocks (only block name is ABC) and polyline, I do not understand about selection filters options and I am trying to define rule for selection filter below but failed. Can anyone help me with this problem. If possible could you please give me a document of Selection Filters. Thanks everyone so much. TypedValue[] tv = new TypedValue[3]; tv.SetValue(new TypedValue((int)DxfCode.Start, "INSERT"), 0); tv.SetValue(new TypedValue((int)DxfCode.BlockName, "ABC"), 1); tv.SetValue(new TypedValue((int)DxfCode.Start, "LWPOLYLINE"), 2);
0 Likes
Accepted solutions (2)
2,287 Views
3 Replies
Replies (3)
Message 2 of 4

GiaBach
Contributor
Contributor
Accepted solution

try this :

            TypedValue[] acTypValAr = new TypedValue[7];
            acTypValAr.SetValue(new TypedValue((int)DxfCode.Operator, "<OR"), 0);
            acTypValAr.SetValue(new TypedValue((int)DxfCode.Operator, "<AND"), 1);
            acTypValAr.SetValue(new TypedValue((int)DxfCode.Start, "INSERT"), 2);
            acTypValAr.SetValue(new TypedValue((int)DxfCode.BlockName, "ABC"), 3);
            acTypValAr.SetValue(new TypedValue((int)DxfCode.Operator, "AND>"), 4);
            acTypValAr.SetValue(new TypedValue((int)DxfCode.Start, "LWPOLYLINE"), 5);
            acTypValAr.SetValue(new TypedValue((int)DxfCode.Operator, "OR>"), 6);
Message 3 of 4

_gile
Consultant
Consultant
Accepted solution

Hi,

 

The most complete documentation abour Selection Set Filters is the AutoLISP one. You should read this page and the related topics:

Transposing code is quite easy, where AutoLISP uses "dotted pairs", .NET uses TypedValue instances.

 

            var filter = new SelectionFilter(new[]
            {
                new TypedValue(-4, "<OR"),          // DxfCode.Operator
                new TypedValue(-4, "<AND"),         // DxfCode.Operator
                new TypedValue(0, "INSERT"),        // DxfCode.Start
                new TypedValue(2, "ABC"),           // DxfCode.BlockName
                new TypedValue(-4, "AND>"),         // DxfCode.Operator
                new TypedValue(0, "LWPOLYLINE"),    // DxfCode.Start
                new TypedValue(-4, "OR>")
            });


Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 4 of 4

phuochung_dang
Contributor
Contributor

Thanks everybody for your help to solve this problem.

0 Likes