.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Can't find intersections.

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
932189886
246 Views, 5 Replies

Can't find intersections.

I can't get the intersections in the graph, anything else of the same type is fine.I don't know if this is a bug or if there is something wrong with my code. Please help me find out what the problem is. the code is simple :

Point3dCollection intersections = new Point3dCollection();

var plane = new Plane();

curve1.IntersectWith(curve2, Intersect.OnBothOperands,plane, intersections, IntPtr.Zero, IntPtr.Zero);

5 REPLIES 5
Message 2 of 6
kdub_nz
in reply to: 932189886

I assume you're getting an error message ??

 

Where do you define the Plane parameters ??

 

It's better if you post a small self contained method to save your peers having to guess.

Regards,


// Called Kerry in my other life.

Everything will work just as you expect it to, unless your expectations are incorrect.

class keyThumper<T> : Lazy<T>;      another  Swamper

Message 3 of 6
_gile
in reply to: 932189886

Hi,

It works for me with your drawing.

Testing command:

        [CommandMethod("INT")]
        public static void Int()
        {
            var doc = Application.DocumentManager.MdiActiveDocument;
            var db = doc.Database;
            var ed = doc.Editor;

            var peo = new PromptEntityOptions("\nSelect curve 1: ");
            peo.SetRejectMessage("\nSelected object is not a Curve.");
            peo.AddAllowedClass(typeof(Curve), false);
            var per = ed.GetEntity(peo);
            if (per.Status != PromptStatus.OK) return;
            var id1 = per.ObjectId;

            peo.Message = "\nSelect curve 2: ";
            per = ed.GetEntity(peo);
            if (per.Status != PromptStatus.OK) return;
            var id2 = per.ObjectId;

            using (var tr = db.TransactionManager.StartTransaction())
            {
                var points = new Point3dCollection();
                var plane = new Plane();
                var curve1 = (Entity)tr.GetObject(id1, OpenMode.ForRead);
                var curve2 = (Entity)tr.GetObject(id2, OpenMode.ForRead);
                curve1.IntersectWith(curve2, Intersect.OnBothOperands, plane, points, IntPtr.Zero, IntPtr.Zero);
                if (0 < points.Count)
                {
                    var curSpace = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);
                    foreach (Point3d pt in points)
                    {
                        var dbPoint = new DBPoint(pt);
                        curSpace.AppendEntity(dbPoint);
                        tr.AddNewlyCreatedDBObject(dbPoint, true);
                    }
                }
                else
                {
                    ed.WriteMessage("\nNone intersection.");
                }
                tr.Commit();
            }
        }


Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 4 of 6
_gile
in reply to: kdub_nz

Hi Kerry,


@kdub_nz  a écrit :

Where do you define the Plane parameters ??


The default ctor: new plane() uses the default values: Point3d.Origin and Vector3d.ZAxis.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 5 of 6
932189886
in reply to: _gile

THK U.I TEST YOUR CODE,BUT STILL NONE.I'M USING ACAD2016.
Message 6 of 6
kdub_nz
in reply to: 932189886

happenstance  ?
default is :

Normal : {(0,0,1)}

PointOnPlane : Y = 0, X = 0

 

🙂

 

added: Gilles beat me 🙂


// Called Kerry in my other life.

Everything will work just as you expect it to, unless your expectations are incorrect.

class keyThumper<T> : Lazy<T>;      another  Swamper

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report