[CommandMethod("TestLoftObjekt", CommandFlags.Modal)] public static void TestLoftObjekt() { Editor editor = AcadApp.DocumentManager.MdiActiveDocument.Editor; Database db = AcadApp.DocumentManager.MdiActiveDocument.Database; TransMan transMgr = db.TransactionManager; using (Transaction trans = db.TransactionManager.StartTransaction()) { PromptEntityOptions prOpt = new PromptEntityOptions("\nPick circle"); prOpt.SetRejectMessage("\nSelect a circle."); prOpt.AddAllowedClass(typeof(Circle), false); PromptEntityResult pr = editor.GetEntity(prOpt); if (pr.Status != PromptStatus.OK) { trans.Abort(); return; } Circle Circle1 = (Circle)trans.GetObject(pr.ObjectId, OpenMode.ForWrite); pr = editor.GetEntity(prOpt); if (pr.Status != PromptStatus.OK) { trans.Abort(); return; } Circle Circle2 = (Circle)trans.GetObject(pr.ObjectId, OpenMode.ForWrite); Vector3d MoveVec = Circle2.Center - Circle1.Center; MoveVec *= 3; Matrix3d MoveC = Matrix3d.Displacement(MoveVec); Circle2.TransformBy(MoveC); CircularArc3d cirArc1 = new CircularArc3d(Circle1.Center, Circle1.Normal, Circle1.Radius); CircularArc3d cirArc2 = new CircularArc3d(Circle2.Center, Circle2.Normal, Circle2.Radius); int numPoints = 5; Point3d[] sps1 = cirArc1.GetSamplePoints(numPoints); Point3d[] sps2 = cirArc2.GetSamplePoints(numPoints); LoftedSurface loftedSurface = new LoftedSurface(); LoftOptions LO = new LoftOptions(); Entity[] crossSections = { Circle1, Circle2 }; Entity[] guideCurves = new Entity[numPoints-1]; for (int i = 0; i < numPoints-1; i++) guideCurves.SetValue(new Line(sps1[i], sps2[i]), i); loftedSurface.CreateLoftedSurface(crossSections, guideCurves, null, LO); BlockTableRecord btr = (BlockTableRecord)trans.GetObject(Circle1.OwnerId, OpenMode.ForWrite, false); ObjectId obj = btr.AppendEntity(loftedSurface); trans.AddNewlyCreatedDBObject(loftedSurface, true); trans.Commit(); } }