.NET

.NET

Reply
Moderator
Alexander.Rivilis
Posts: 1,451
Registered: ‎04-09-2008
Message 11 of 16 (240 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: 9
Registered: ‎02-22-2013
Message 12 of 16 (230 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 (212 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 (209 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: 9
Registered: ‎02-22-2013
Message 15 of 16 (202 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 (199 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. 

 

 

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.