handOverPoly3d2(this ObjectId idPoly3dOrg, List <Point3d> pnts3d) { Database db = BaseObjs._db; Point3dCollection pnts3dColl = new Point3dCollection(); foreach (Point3d pnt3d in pnts3d) { pnts3dColl.Add(pnt3d); } using (OpenCloseTransaction tr = db.TransactionManager.StartOpenCloseTransaction()) { Polyline3d poly3dOrg = (Polyline3d)tr.GetObject(idPoly3dOrg, OpenMode.ForRead); Debug.Print(poly3dOrg.Handle.ToString()); Polyline3d poly3dNew = new Polyline3d(Poly3dType.SimplePoly, pnts3dColl, false); poly3dNew.SetDatabaseDefaults(); poly3dNew.Layer = poly3dOrg.Layer; poly3dOrg.UpgradeOpen(); poly3dOrg.HandOverTo(poly3dNew, true, true); Debug.Print(poly3dOrg.Handle.ToString()); Debug.Print(poly3dNew.Handle.ToString()); bool x = poly3dOrg.IsDisposed; poly3dOrg.Dispose(); tr.AddNewlyCreatedDBObject(poly3dNew, true); tr.Commit(); } }
handOverPoly3d(this ObjectId idPoly3dOrg, List <Point3d> pnts3d) { Polyline3d poly3dOrg = (Polyline3d)idPoly3dOrg.Open(OpenMode.ForRead); Point3dCollection pnts3dColl = new Point3dCollection(); foreach (Point3d pnt3d in pnts3d) { pnts3dColl.Add(pnt3d); } Polyline3d poly3dNew = new Polyline3d(Poly3dType.SimplePoly, pnts3dColl, false); poly3dNew.SetDatabaseDefaults(); poly3dOrg.UpgradeOpen(); poly3dOrg.HandOverTo(poly3dNew, true, true); poly3dNew.Close(); poly3dOrg.Dispose(); }