ivde 发表于 2014-5-20 19:47
GripStretchPoints
你好,ivde
我用的是AutoCAD 2010, 好像没有这个 GripStretchPoints,倒是有个GetGripPoint(), 但我不知道如何使用啊。这是我现在的代码,请指教:
- //从屏幕中选择填充和文字
- public bool Select(List<Point3d> hatchPointLst,List<DBText> nameLst)
- {
- Document doc = Application.DocumentManager.MdiActiveDocument;
- Database db = doc.Database;
- Editor ed = doc.Editor;
-
- using (Transaction trans = db.TransactionManager.StartTransaction())
- {
- try
- {
- //定义过滤器
- SelectionFilter flt = new SelectionFilter(new TypedValue[] { new TypedValue(0, "TEXT,HATCH") });
- PromptSelectionOptions optSel = new PromptSelectionOptions();
- optSel.MessageForAdding = "\n请选择观察点分布图";
- PromptSelectionResult resSel = ed.GetSelection(optSel, flt);
- if (resSel.Status != PromptStatus.OK)
- return false;
- SelectionSet selSet = resSel.Value;
- ObjectId[] ids = selSet.GetObjectIds();
-
- foreach (ObjectId sSetEntId in ids)
- {
- Entity ent = (Entity)trans.GetObject(sSetEntId, OpenMode.ForRead);
- if (ent.GetType().Name == "Hatch")
- {
- Hatch myHatch = (Hatch) trans.GetObject(sSetEntId, OpenMode.ForRead);
- //myHatch.GetGripPoints();
- } //End of the if (ent.GetType().Name == "Hatch")
- else if (ent.GetType().Name == "DBText")
- {
- DBText myText = (DBText)trans.GetObject(sSetEntId, OpenMode.ForRead);
- nameLst.Add(myText);
- }
- }
- }
- catch (System.Exception ex)
- {
- ed.WriteMessage(ex.Message + "\n" + ex.StackTrace);
- return false;
- }
- trans.Commit();
- //如果执行到这里,表示一切顺利,可以返回true
- return true;
- }
- }
|