几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   ObjectARX(VB.NET/C#) (http://www.dimcax.com/hust/forumdisplay.php?f=176)
-   -   【转帖】[转帖]用.net实现autocad实体的多重选择 (http://www.dimcax.com/hust/showthread.php?t=9228)

yang686526 2009-04-20 05:19 PM

【转帖】[转帖]用.net实现autocad实体的多重选择
 
[转帖]用.net实现autocad实体的多重选择
www.dimcax.com
[转帖]用.net实现autocad实体的多重选择
转帖自,其中过滤curve类型的实体,用到了dxfcode.subclass。在使用.net开发autocad时,获取的选择集可以用selectionfilter对象进行过滤,这样用户就可以只选择对自己操作有用的实体了。关于这个selectionfilter选择过滤器,偶以前只知道用dxfcode.start组码来过滤单种类形的实体(如直线、圆、圆弧等)。今天在才鸟兄的指点下,找到了几个多重选择cad实体的方法,现总结如下:
只过滤直线实体
promptselectionoptions curoption = new promptselectionoptions(); curoption.singleonly = false; curoption.allowduplicates = false; curoption.messageforadding = "请选择曲线:"; typedvalue[] fillist = new typedvalue[]{ new typedvalue((int)dxfcode.start,"line") };//只过滤直线 selectionfilter filter = new selectionfilter(fillist); promptselectionresult ssr = ed.getselection(curoption, filter);

同时过滤直线、圆和圆弧
promptselectionoptions curoption = new promptselectionoptions(); curoption.singleonly = false; curoption.allowduplicates = false; curoption.messageforadding = "请选择曲线:"; typedvalue[] fillist = new typedvalue[]{ new typedvalue((int)dxfcode.start,"line,arc,circle") };//同时过滤直线、圆和圆弧 selectionfilter filter = new selectionfilter(fillist); promptselectionresult ssr = ed.getselection(curoption, filter);
过滤所有曲线
promptselectionoptions curoption = new promptselectionoptions(); curoption.singleonly = false; curoption.allowduplicates = false; curoption.messageforadding = "请选择曲线:"; typedvalue[] fillist = new typedvalue[]{ new typedvalue((int)dxfcode.subclass,"curve") };//过滤所有曲线 selectionfilter filter = new selectionfilter(fillist); promptselectionresult ssr = ed.getselection(curoption, filter);
过滤0层上的所有曲线
promptselectionoptions curoption = new promptselectionoptions(); curoption.singleonly = false; curoption.allowduplicates = false; curoption.messageforadding = "请选择曲线:"; typedvalue[] fillist = new typedvalue[]{ new typedvalue((int)dxfcode.subclass,"curve"), new typedvalue((int)dxfcode.layername,"0") };//过滤0层上的所有曲线 selectionfilter filter = new selectionfilter(fillist); promptselectionresult ssr = ed.getselection(curoption, filter);
又学到了好多东西,谢谢老大
书山有路勤为径,学海无涯苦作舟!
这是c#的吗
原帖由 profawkes 于 这是c#的吗
是c#的
c#最适合开发autocad,因为它拥有vb容易的特点,却具有vc++的强大功能。
上面的内容确实很新颖。但再复杂点的过滤表又该如何实现呢?比如要实现0层上的文字和带有属性的块的筛选,其过滤表又该如何构成呢?


所有的时间均为北京时间。 现在的时间是 06:20 AM.