Autocad 2012:Application ERROR: SSGET "pt" expects 1 or 2 points

Autocad 2012:Application ERROR: SSGET "pt" expects 1 or 2 points

Anonymous
Not applicable
885 Views
2 Replies
Message 1 of 3

Autocad 2012:Application ERROR: SSGET "pt" expects 1 or 2 points

Anonymous
Not applicable

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?

0 Likes
Accepted solutions (1)
886 Views
2 Replies
Replies (2)
Message 2 of 3

Alexander.Rivilis
Mentor
Mentor
Accepted solution

@风过水无痕 wrote:

use SelectCrossingPolygon trigger the error.


SSGET is the Lisp code.My code is not Lisp, why it raises the  error?


Because Editor.SelectCrossingPolygon is wrapper for acedSSGet (ObjectARX analog of (ssget) in AutoLisp)

 


@风过水无痕 wrote:

use SelectCrossingPolygon trigger the error.



You pass lst parameter to SelectCrossingPolygon, but lst is a empty collection

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

0 Likes
Message 3 of 3

Anonymous
Not applicable
thank you very much,@Alexander Rivilis .I had forget to add point to lst.
0 Likes