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);
Solved! Go to Solution.
Solved by kdub_nz. Go to Solution.
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
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();
}
}
Can't find what you're looking for? Ask the community or share your knowledge.