Code Red > .NET

acedSSGet wrapper

(1/3) > >>

Draftek:

--- Code: ---// Selects entity passing through point (5,5).
acedSSGet(NULL, pt2, NULL, NULL, ssname);

--- End code ---

I'm racking my brain trying to figure out how to do this with .net. I have a point3D and I want to select the entity that passes through it.

Any ideas?

TonyT:

--- Quote from: Draftek on October 09, 2008, 03:43:41 PM ---
--- Code: ---// Selects entity passing through point (5,5).
acedSSGet(NULL, pt2, NULL, NULL, ssname);

--- End code ---

I'm racking my brain trying to figure out how to do this with .net. I have a point3D and I want to select the entity that passes through it.

Any ideas?

--- End quote ---

This may be release-dependent i think, but have you tried the Editor's
GetNestedEntity() method, setting the NonInteractivePickPoint and
UseNonInteractivePickPoint properties?

Bryco:
If that doesn't work try this

--- Code: ---       static public bool CursorSelectionSet(ref SelectionSet ss,Point3d p)
        {

            Document doc=cad.DocumentManager.MdiActiveDocument;
            Editor ed=doc.Editor;
            Point3dCollection pts = CursorPts(p,ed);
            PromptSelectionOptions sso = new PromptSelectionOptions();
            sso.AllowDuplicates = false;
            PromptSelectionResult psr = ed.SelectCrossingWindow(pts[0], pts[1]);
            if (psr.Status != PromptStatus.OK) return false;
            ss = psr.Value;
            return true;
        }


        static public bool CursorSelectionSet(ref SelectionSet ss, Point3d p,SelectionFilter sf)
        {
            Document doc = cad.DocumentManager.MdiActiveDocument;
            Editor ed = doc.Editor;
            Point3dCollection pts = CursorPts(p, ed);
            PromptSelectionOptions sso = new PromptSelectionOptions();
            sso.AllowDuplicates = false;
            PromptSelectionResult psr = ed.SelectCrossingWindow(pts[0], pts[1], sf);
            if (psr.Status != PromptStatus.OK) return false;
            ss = psr.Value;
            return true;

        }

        static private Point3dCollection CursorPts(Point3d p,Editor ed)
        {
            double sc = Screensize().Y;
            double ht = Viewsize();
            double d = (Pickbox() / sc) * ht;
            Matrix3d ucs = ed.CurrentUserCoordinateSystem;
            Point3d u = p.TransformBy(ucs.Inverse());
            Point3d p1 = new Point3d(u.X - d, u.Y - d, u.Z).TransformBy(ucs);
            Point3d p2 = new Point3d(u.X + d, u.Y + d, u.Z).TransformBy(ucs);
            Point3dCollection pts = new Point3dCollection();
            pts.Add (p1); pts.Add(p2);
            return pts;
        }


        static public int Pickbox()
        {
            //("pickbox")=pixels
            return (int)(Int16)(cad.GetSystemVariable("Pickbox"));
        }

        static public Point2d Screensize()
        {
            //Screensize stores current viewport in pixels (x,y)
            return (Point2d)cad.GetSystemVariable("Screensize");
        }


        static public double Viewsize()
        {
            //("viewsize")=Stores the height
            //of the view in the current viewport. Expressed in drawing units
            return (double)cad.GetSystemVariable("viewsize");
        }

--- End code ---
call it with
            SelectionSet ss = null;
            TypedValue[] filterList = { new TypedValue(0, "INSERT") };
            SelectionFilter sf = new SelectionFilter(filterList);
            if (SSets.SSets.CursorSelectionSet(ref ss, pickedpoint, sf))
            {
                //yada yada

            }


It's not too elegant but it is related to how a pickbox works

Draftek:
Thanks guys,

I'll try them out - Tony's first and yours, Bryco and let you know.

I'm off today, the weather is good so I'm going to give the Harley a workout in Northwest Arkansas.....

See you Monday.

jmaeding:
I was about to post a question on how to select items in an xref, using a window like the trim command does.
It treats everything as active, so individual lines and things get selected from xrefs, not whole xref.
I have routines to select xref stuff from nentsel calls in lisp, but crossing windows grab the whole xref.

So I am wondering if the .net API has a selection technique that allows xref stuff to be selected.
thanks

Navigation

[0] Message Index

[#] Next page

Go to full version