cad.net 与lisp函数ssnamex一样的,获取选择集的选择的方式
如题
public class 测试选择集的点选位置和点选方式 { //对应lisp的ssnamex,获取选择的方式和选择的角点 [CommandMethod("tt_getssgetpick", CommandFlags.Modal | CommandFlags.UsePickSet | CommandFlags.Redraw)] public void tt_getssgetpick() { Database db = HostApplicationServices.WorkingDatabase;//当前的数据库 Editor ed = Acap.DocumentManager.MdiActiveDocument.Editor; ed.WriteMessage(Environment.NewLine + "****惊惊连盒-测试选择集的点选位置和点选方式"); var tkids = new List<ObjectId>(); //创建选择集过滤器,只选择块对象 TypedValue[] filList = new TypedValue[] { // new TypedValue((int)DxfCode.Start, "INSERT") }; SelectionFilter filter = new SelectionFilter(filList); //定义选择集选项 var pso = new PromptSelectionOptions { RejectObjectsOnLockedLayers = true, //不选择锁定图层对象 AllowDuplicates = true, //不允许重复选择 }; var ssPsr = ed.GetSelection(pso, filter);//手选 if (ssPsr.Status != PromptStatus.OK) { return; } //获取所有的id //foreach (var item in ssPsr.Value.GetObjectIds()) //{ // Debug.WriteLine(item);//所有的角点信息 //} var va = ssPsr.Value; foreach (var vaItem in va) { if (vaItem is CrossingOrWindowSelectedObject cows)//框选方式 { foreach (var ppd in cows.GetPickPoints()) { Debug.WriteLine(ppd.PointOnLine);//ppd内还有内容 } } else if (vaItem is PickPointSelectedObject pps)//点选方式 { Debug.WriteLine(pps.PickPoint);//pps内还有内容 } } } }
相关推荐
zrtlin 2020-11-09
xuebingnan 2020-11-05
wikiwater 2020-10-27
heheeheh 2020-10-19
Crazyshark 2020-09-15
softwear 2020-08-21
ZGCdemo 2020-08-16
jczwilliam 2020-08-16
littleFatty 2020-08-16
idning 2020-08-03
jinxiutong 2020-07-26
lanzhusiyu 2020-07-19
Skyline 2020-07-04
xiaofanguan 2020-06-25
Aveiox 2020-06-23
kernelstudy 2020-06-16