明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3487|回复: 6

利用选择集对polyline进行过滤

[复制链接]
发表于 2006-5-16 14:13 | 显示全部楼层 |阅读模式
利用选择集对polyline进行过滤时,为什么选不到。而对比如LINE,CIRCLE均可实现??
发表于 2007-8-12 21:58 | 显示全部楼层

这个问题我这个菜鸟也遇到了,高手们帮帮忙解决下:     

       Database db = HostApplicationServices.WorkingDatabase;
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
            Transaction trans = db.TransactionManager.StartTransaction();

            TypedValue[] filList = new TypedValue[1];
            filList[0] = new TypedValue((int)DxfCode.Start, "PolyLine");
            SelectionFilter filter = new SelectionFilter(filList);

            PromptSelectionOptions Opts = new PromptSelectionOptions();
            PromptSelectionResult res = ed.GetSelection(Opts,filter);

发表于 2007-8-13 08:50 | 显示全部楼层

曲线救国,这个法子好像可以:

             Database db = HostApplicationServices.WorkingDatabase;
             Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
             Transaction trans = db.TransactionManager.StartTransaction();

             PromptSelectionOptions Opts = new PromptSelectionOptions();
             PromptSelectionResult res = ed.GetSelection(Opts);
             Polyline plineSelected = new Polyline();

             if (res.Status != PromptStatus.OK)
             {
                ed.WriteMessage("您所选的不是PLINE线实体!");
                trans.Commit();
                trans.Dispose();
                return;
             }

             Autodesk.AutoCAD.EditorInput.SelectionSet SS = res.Value;

             ObjectId plid = SS.GetObjectIds()[0];//获取所选Pline线的ID
             Entity ent = (Entity)trans.GetObject(plid, OpenMode.ForRead, false);

             if (ent.GetType() == typeof(Polyline))
             {
                 plineSelected = (Polyline)ent;
             }
             double dtemp = plineSelected.StartPoint.X;
            
             trans.Commit();
             trans.Dispose();

发表于 2007-8-13 22:48 | 显示全部楼层
new TypedValue((int)DxfCode.Start, "LWPolyLine");
发表于 2007-8-14 16:38 | 显示全部楼层

new TypedValue(0, "LWPolyLine");

楼上正解

发表于 2007-8-21 11:40 | 显示全部楼层

那二维多线段呢????

还有其他的实体呢??

斑竹知道吗???

求救啊!!!!!!!!!!!!

谢谢。

发表于 2007-8-22 14:23 | 显示全部楼层

知道了

"polyline"

但怎么读取二维多线段Polyline2d的顶点???

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-6-23 09:35 , Processed in 0.142710 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表