Hi,
To learn something, you should make your own tests.
[CommandMethod("TEST")]
public void Test()
{
var doc = Application.DocumentManager.MdiActiveDocument;
var db = doc.Database;
var ed = doc.Editor;
var opts = new PromptEntityOptions("\nSelect polyline (2d or 3d): ");
opts.SetRejectMessage("\nSelected object is not a polyline.");
opts.AddAllowedClass(typeof(Polyline), true);
opts.AddAllowedClass(typeof(Polyline3d), true);
var result = ed.GetEntity(opts);
if (result.Status != PromptStatus.OK)
return;
var thisEntityId = result.ObjectId;
result = ed.GetEntity(opts);
if (result.Status != PromptStatus.OK)
return;
var otherEntityId = result.ObjectId;
using (var tr = db.TransactionManager.StartTransaction())
{
var thisEntity = (Entity)tr.GetObject(thisEntityId, OpenMode.ForRead);
var otherEntity = (Entity)tr.GetObject(otherEntityId, OpenMode.ForRead);
var intersPts = new Point3dCollection();
var plane = new Plane(); // new Plane(Point3d.Origin, Vector3d.ZAxis);
thisEntity.IntersectWith(otherEntity, Intersect.OnBothOperands, plane, intersPts, IntPtr.Zero, IntPtr.Zero);
ed.WriteMessage("\nUsing new Plane()");
foreach (Point3d pt in intersPts)
{
ed.WriteMessage("\n{0}", pt);
}
if (thisEntity is Polyline)
{
intersPts.Clear();
plane = ((Polyline)thisEntity).GetPlane();
thisEntity.IntersectWith(otherEntity, Intersect.OnBothOperands, plane, intersPts, IntPtr.Zero, IntPtr.Zero);
ed.WriteMessage("\nUsing thisEntity.GetPlane())");
foreach (Point3d pt in intersPts)
{
ed.WriteMessage("\n{0}", pt);
}
}
if (otherEntity is Polyline)
{
intersPts.Clear();
plane = ((Polyline)otherEntity).GetPlane();
thisEntity.IntersectWith(otherEntity, Intersect.OnBothOperands, plane, intersPts, IntPtr.Zero, IntPtr.Zero);
ed.WriteMessage("\nUsing otherEntity.GetPlane()");
foreach (Point3d pt in intersPts)
{
ed.WriteMessage("\n{0}", pt);
}
}
tr.Commit();
}
Application.DisplayTextScreen = true;
}