ResultBuffer扩展类第二版
本帖最后由 雪山飞狐_lzh 于 2017-12-3 18:27 编辑源码:
这一版的ResulrBuffer扩展类分为三大类分别对应扩展字典/数据、Lisp数据和选择集过滤器
其中
XdataList类对应扩展字典/数据
Lisp*类对应Lisp数据
Op*类对应选择集过滤器
测试代码:
public void Test1()
{
//扩展数据
XdataList lst =
new XdataList
{
{ 1001, "myapp" },
{ 1000, "hello" }
};
//过滤器的三种写法
var fd =
new OpOr
{
!new OpAnd
{
{ 0, "line" },
{ 8, "0" },
},
new OpAnd
{
!new OpEqual(0, "circle"),
{ 8, "2" },
{ 10, new Point3d(10,10,0), ">,>,*" }
},
};
var p = new Point3d(10, 10, 0);
var f =
OpFilter.Bulid(
e =>
!(e.Dxf(0) == "line" & e.Dxf(8) == "0") |
e.Dxf(0) != "circle" & e.Dxf(8) == "2" & e.Dxf(10) >= p
);
var f2 =
OpFilter.Bulid(
e =>
e.Or(
!e.And(e.Dxf(0) == "line", e.Dxf(8) == "0"),
e.And(e.Dxf(0) != "circle", e.Dxf(8) == "2", e.Dxf(10) <= new Point3d(10, 10, 0)))
);
SystemManager.Editor.WriteMessage($"\nXdataList:{lst}\n{fd}\n{f}\n{f2}");
}
public object LispTest(ResultBuffer rb)
{
var rl = LispList.FromBuffer(rb);
return rl.GetValue();
}
public object LispTest2(ResultBuffer rb)
{
var r2 =
new LispList
{
0,
new LispDottedPair{ 12, 13 }
};
return r2.GetValue();
}
结果
命令:
TT1
XdataList:((1001,myapp)(1000,hello))
(-4,<Or)(-4,<Not)(-4,<And)(0,line)(8,0)(-4,And>)(-4,Not>)(-4,<And)(-4,<Not)(0,circle)(-4,Not>)(8,2)(-4,>,>,*)(10,(10,10,0))(-4,And>)(-4,Or>)
(-4,<Or)(-4,<Not)(-4,<And)(0,line)(8,0)(-4,And>)(-4,Not>)(-4,<And)(-4,<Not)(0,circle)(-4,Not>)(8,2)(-4,>,>,*)(10,(10,10,0))(-4,And>)(-4,Or>)
(-4,<Or)(-4,<Not)(-4,<And)(0,line)(8,0)(-4,And>)(-4,Not>)(-4,<And)(-4,<Not)(0,circle)(-4,Not>)(8,2)(-4,<,<,*)(10,(10,10,0))(-4,And>)(-4,Or>)
命令: (mytt2)
(0 (12 . 13))
命令: (mytt '(1 (2 . 3)))
(1 (2 . 3))
学习了,非常感谢!! 飞狐出品,必属精品 厉害,好好拜读下 厉害,好好拜读下
页:
[1]