Message 1 of 3
Not applicable
10-23-2016
07:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
use SelectCrossingPolygon trigger the error.
my code:
Point3dCollection lst = new Point3dCollection();
PromptPointOptions ppo = new PromptPointOptions("select center point");
PromptPointResult ppr = ed.GetPoint(ppo);
if (ppr.Status != PromptStatus.OK) return;
Point3d pt = ppr.Value;
Point3d pt1 = new Point3d(pt.X - 1000, pt.Y - 1000, pt.Z),
pt2 = new Point3d(pt.X + 1000, pt.Y - 1000, pt.Z),
pt3 = new Point3d(pt.X + 1000, pt.Y + 1000, pt.Z),
pt4 = new Point3d(pt.X - 1000, pt.Y + 1000, pt.Z);
TypedValue[] tv = new TypedValue[4];
PromptEntityOptions peo = new PromptEntityOptions("select dbtext");
PromptEntityResult per = ed.GetEntity(peo);
if (per.Status != PromptStatus.OK) return;
string dimLayer = "";
using (Transaction tr = doc.TransactionManager.StartTransaction())
{
Entity ent = tr.GetObject(per.ObjectId, OpenMode.ForRead) as Entity;
dimLayer = ent.Layer;
tr.Commit();
}
tv.SetValue(new TypedValue((int)DxfCode.Operator, "<and"), 0);
tv.SetValue(new TypedValue((int)DxfCode.Start, "TEXT"), 1);
tv.SetValue(new TypedValue((int)DxfCode.LayerName, dimLayer), 2);
tv.SetValue(new TypedValue((int)DxfCode.Operator, "and>"), 3);
SelectionFilter filter = new SelectionFilter(tv);
PromptSelectionResult res;
res = ed.SelectCrossingPolygon(lst, filter);
ed.WriteMessage("LayerName:" + dimLayer);
if (res.Status != PromptStatus.OK) return;
ed.WriteMessage(res.Status.ToString());
ObjectId[] ids = res.Value.GetObjectIds();
string result = "";
using (Transaction tr = doc.TransactionManager.StartTransaction())
{
foreach (ObjectId id in ids)
{
DBObject obj = tr.GetObject(id, OpenMode.ForRead);
DBText text = obj as DBText;
result +=","+ text.TextString;
}
result = result.Trim(',');
tr.Commit();
}
ed.WriteMessage(result);
SSGET is the Lisp code.My code is not Lisp, why it raises the error?
Solved! Go to Solution.

