Message 1 of 8
How to use TypedValue?

Not applicable
10-24-2011
10:09 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to create a dynamic filter, sometimes the value can be "ALL".
But I'm not knowing how to make.
public static ObjectId[] FilterDimension(string LayerName, string Start, string ColorName, string LinetypeName)
{
try
{
Document acDoc = Application.DocumentManager.MdiActiveDocument;
Database acCurDb = acDoc.Database;
Editor editor = acDoc.Editor;
TypedValue[] typedValue = new TypedValue[4];
typedValue.SetValue(new TypedValue((int)DxfCode.Start, (Start != "ALL") ? Start : "*"), 0);
typedValue.SetValue(new TypedValue((int)DxfCode.LayerName, LayerName), 1);
typedValue.SetValue(new TypedValue((int)DxfCode.ColorName, (ColorName != "ALL") ? ColorName : "*"), 2);
typedValue.SetValue(new TypedValue((int)DxfCode.LinetypeName, (LinetypeName != "ALL") ? LinetypeName : "*"), 3);
SelectionFilter selectionFilter = new SelectionFilter(typedValue);
ObjectId[] objectIdList = editor.SelectAll(selectionFilter).Value.GetObjectIds();
return objectIdList;
}
catch (System.Exception)
{
return null;
}
}
Help me, please.
Thank you!