CAD software discussion forum > CAD Tutorial & Tips > [Tips] select Enities with filter in C#

[Tips] select Enities with filter in C#

Rank: 5Rank: 5

Arphone

posts: 26

Registered: 2012-6-25

Message 1 of 1

 [Tips] select Enities with filter in C#
18-04-2013 03:57 . pm | View his/her posts only
If you have a VBA program which uses selection sets, and you want to transfer your program to C# (or VB.net), you may have a problem with filter. For example, the VBA code is:

Dim gpCode(0) As Integer
Dim dataValue(0) As Variant
gpCode(0) = 0
dataValue(0) = "Circle"

Dim groupCode As Variant, dataCode As Variant
groupCode = gpCode
dataCode = dataValue

ssetObj.Select mode, corner1, corner2, groupCode, dataCode

and the C# code should be:

short[] gpCode = new short[1];
Object[] dataValue = new Object[1];
gpCode[0] = 0;
dataValue[0] = "Circle";

ss.Select(ZcSelect.zcSelectionSetAll, Type.Missing, Type.Missing, gpCode, dataValue);

The key point is that type of gpCode should be short bu not int, and you don't need to put the 2 arrays into objects.


Try ZWCAD+ free for 30 days:
http://www.zwsoft.com/zwcad+/
See also