请教过滤器 的问题 c#
《auto cad vba & vb.net 开发基础与实例教程》 第二版中的问题Point3d pt1 = new Point3d(0, 0, 0);
Point3d pt2 = new Point3d(100, 100, 0);
TypedValueList values = new TypedValueList();
values.Add(typeof(Circle));
//实际上调用了
//public void Add(Type entityType) {base.Add(new TypedValue(0, RXClass.GetClass(entityType).DxfName)); }
values.Add(DxfCode.Operator, ">,>,*");
values.Add(DxfCode.XCoordinate, pt1);
values.Add(DxfCode.Operator, "<,<,*");
values.Add(DxfCode.XCoordinate, pt2);
SelectionFilter filter = new SelectionFilter(values);
书上说上面这段代码是,选择了 圆心在 pt1 pt2 构成的矩形内的圆。其中DxfCode.XCoordinate(DXF组码为10),用于指定圆的圆心。
问题:
values.Add(DxfCode.Operator, ">,>,*");
values.Add(DxfCode.XCoordinate, pt1);
猜测这两句是想说:x坐标> pt1.x, y坐标>pt1.y, z坐标任意。
但是,DxfCode.XCoordinate 应该是仅仅指 X 坐标啊。。。。并没有说Y的事,Z的事。
好像 DxfCode.YCoordinate 组码是 20 ,DxfCode.ZCoordinate 组码是 30
//程序集 acdbmgd.dll, v2.0.50727
namespace Autodesk.AutoCAD.DatabaseServices
{
public struct TypedValue
{
public TypedValue(int typeCode);
public TypedValue(int typeCode, object value);
}
}
附:
作者自己建立的 TypedValueList类。
/// <summary>
/// TypedValue列表类,简化选择集过滤器的构造
/// </summary>
public class TypedValueList : List<TypedValue>
{
/// <summary>
/// 接受可变参数的构造函数
/// </summary>
/// <param name="args">TypedValue对象</param>
public TypedValueList(params TypedValue[] args)
{
AddRange(args);
}
/// <summary>
/// 添加DXF组码及对应的类型
/// </summary>
/// <param name="typecode">DXF组码</param>
/// <param name="value">类型</param>
public void Add(int typecode, object value)
{
base.Add(new TypedValue(typecode, value));
}
/// <summary>
/// 添加DXF组码
/// </summary>
/// <param name="typecode">DXF组码</param>
public void Add(int typecode)
{
base.Add(new TypedValue(typecode));
}
/// <summary>
/// 添加DXF组码及对应的类型
/// </summary>
/// <param name="typecode">DXF组码</param>
/// <param name="value">类型</param>
public void Add(DxfCode typecode, object value)
{
base.Add(new TypedValue((int)typecode, value));
}
/// <summary>
/// 添加DXF组码
/// </summary>
/// <param name="typecode">DXF组码</param>
public void Add(DxfCode typecode)
{
base.Add(new TypedValue((int)typecode));
}
/// <summary>
/// 添加图元类型,DXF组码缺省为0
/// </summary>
/// <param name="entityType">图元类型</param>
public void Add(Type entityType)
{
base.Add(new TypedValue(0, RXClass.GetClass(entityType).DxfName));
}
/// <summary>
/// TypedValueList隐式转换为SelectionFilter
/// </summary>
/// <param name="src">要转换的TypedValueList对象</param>
/// <returns>返回对应的SelectionFilter类对象</returns>
public static implicit operator SelectionFilter(TypedValueList src)
{
return src != null ? new SelectionFilter(src) : null;
}
/// <summary>
/// TypedValueList隐式转换为ResultBuffer
/// </summary>
/// <param name="src">要转换的TypedValueList对象</param>
/// <returns>返回对应的ResultBuffer对象</returns>
public static implicit operator ResultBuffer(TypedValueList src)
{
return src != null ? new ResultBuffer(src) : null;
}
/// <summary>
/// TypedValueList隐式转换为TypedValue数组
/// </summary>
/// <param name="src">要转换的TypedValueList对象</param>
/// <returns>返回对应的TypedValue数组</returns>
public static implicit operator TypedValue[](TypedValueList src)
{
return src != null ? src.ToArray() : null;
}
/// <summary>
/// TypedValue数组隐式转换为TypedValueList
/// </summary>
/// <param name="src">要转换的TypedValue数组</param>
/// <returns>返回对应的TypedValueList</returns>
public static implicit operator TypedValueList(TypedValue[] src)
{
return src != null ? new TypedValueList(src) : null;
}
/// <summary>
/// SelectionFilter隐式转换为TypedValueList
/// </summary>
/// <param name="src">要转换的SelectionFilter</param>
/// <returns>返回对应的TypedValueList</returns>
public static implicit operator TypedValueList(SelectionFilter src)
{
return src != null ? new TypedValueList(src.GetFilter()) : null;
}
/// <summary>
/// ResultBuffer隐式转换为TypedValueList
/// </summary>
/// <param name="src">要转换的ResultBuffer</param>
/// <returns>返回对应的TypedValueList</returns>
public static implicit operator TypedValueList(ResultBuffer src)
{
return src != null ? new TypedValueList(src.AsArray()) : null;
}
}
http://bbs.mjtd.com/xwb/images/bgimg/icon_logo.png 该贴已经同步到 cadnetkaifa的微博 我举得<<>>是范围的意思,即是矩形对角点p1 p2范围,猜测的
页:
[1]