.NET

Reply
Moderator
Alexander.Rivilis
Posts: 1,388
Registered: ‎04-09-2008
Message 11 of 16 (200 Views)

Re: Way of getting all objects between two points.

03-12-2013 03:57 PM in reply to: e1028439

e1028439 wrote:
Dear Peter, i modified your code a little bit to use Editor.SelectCrossingWindow, and now it throws a eNotImplementedYet exeption on the following line >vl.IntersectWith()<.

What kind of entity (name of class) was intersected?

I also recommend to use Intersect.OnBothOperands instead of Intersect.ExtendBoth because many kind of entities can not be extended.


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Active Member
e1028439
Posts: 8
Registered: ‎02-22-2013
Message 12 of 16 (190 Views)

Re: Way of getting all objects between two points.

03-12-2013 04:39 PM in reply to: Alexander.Rivilis

it was an InfiniteLine, and i tried all 4 of the possible intersect enum types, all throw the same eNotImplementedYet exception

Valued Mentor
DiningPhilosopher
Posts: 370
Registered: ‎05-06-2012
Message 13 of 16 (172 Views)

Re: Way of getting all objects between two points.

03-12-2013 08:55 PM in reply to: e1028439

The code you're trying to use doesn't work as posted because it passes null to IntersectWith() in the argument that requires a Point3dCollection.

 

That may be what is causing the exception.  Create a new Point3dCollection and call it's Clear() method just before each call to IntersectWith().

 

 

Valued Mentor
DiningPhilosopher
Posts: 370
Registered: ‎05-06-2012
Message 14 of 16 (169 Views)

Re: Way of getting all objects between two points.

03-12-2013 08:58 PM in reply to: e1028439

e1028439 wrote:

it was an InfiniteLine, and i tried all 4 of the possible intersect enum types, all throw the same eNotImplementedYet exception


The base AutoCAD product API has no class called "InfiniteLine".

 

The XLine is an infinite line, so perhaps that's what you meant?

Active Member
e1028439
Posts: 8
Registered: ‎02-22-2013
Message 15 of 16 (162 Views)

Re: Way of getting all objects between two points.

03-12-2013 09:20 PM in reply to: DiningPhilosopher
var doc = Application.DocumentManager.MdiActiveDocument;
            var ed = doc.Editor;
            var db = doc.Database;
            var ppo = new PromptPointOptions("\nSelect point: ") { AllowNone = false };
            var pt1 = ed.GetPoint(ppo).Value;
            var pt2 = ed.GetPoint(ppo).Value;
            var psr = ed.SelectCrossingWindow(pt1, pt2);
            var vl = new Line(pt1, pt2);
            var oic = new ObjectIdCollection();
            if (psr.Status != PromptStatus.OK)
                return;
            using (var dl = doc.LockDocument())
                using (var tr = db.TransactionManager.StartTransaction())
                {
                    Point3dCollection p3dc;
                    foreach (SelectedObject so in psr.Value)
                    {
                        p3dc = new Point3dCollection();
                        var ent = tr.GetObject(so.ObjectId, OpenMode.ForRead) as Entity;
                        try
                        {
                            vl.IntersectWith(ent, Intersect.OnBothOperands, p3dc, new IntPtr(), new IntPtr());
                            if (ent != null && p3dc.Count > 0)
                                oic.Add(ent.ObjectId);
                        }
                        catch (Exception) { }
                    }
                }
            ed.WriteMessage("\n" + oic.Count);

 thats the code i am currently trying with, and the exception occurs at vl.IntersectWith();

 

Exception details:

Autodesk.AutoCAD.Runtime.Exception: eNotImplementedYet

at Autodesk.AutoCAD.DatabaseServices.Entity.IntersectWith(Entity entityPointer, Intersect intersectType, Point3dCollection points, IntPtr thisGraphicSystemMarker, IntPtr otherGraphicSystemMarker)

at AcadPlugin.MyCommands.MyIntersection() in e:\DEV\AcadPlugin1.0\AcadPlugin1.0\Commands.cs:Zeile 154.}	System.Exception {Autodesk.AutoCAD.Runtime.Exception}

ent = {Autodesk.AutoCAD.DatabaseServices.Solid3d}
so = [Autodesk.AutoCAD.EditorInput.CrossingOrWindowSelectedObject] = {
(((8754286416000),Crossing,6,)
(InfiniteLine,(30825.1342620582,30781.8322475576,4200.53349038419),(-0.577350269189626,-0.577350269189626,-0.577350269189626))
(InfiniteLine,(30315.8322765267,31291.1342330891,4200.53349038419),(-0.577350269189626,-0.5773502691...


 Hope this helps.

Valued Mentor
DiningPhilosopher
Posts: 370
Registered: ‎05-06-2012
Message 16 of 16 (159 Views)

Re: Way of getting all objects between two points.

03-12-2013 10:09 PM in reply to: e1028439

Autodesk hasn't added support for finding intersections with 3D Solid objects and surfaces.

 

To do that, you will need to use the BoundaryRepresentation API, and is far more complicated than what has been described thus far.

 

AutoCAD is 3D CADD mainly in terms of its ability to create 3D objects, but is severely crippled in terms of 3D API functionality, and to a lesser-extent, 3D editing and analytical  functionality. 

 

 

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community