Active Member
Posts: 8
Registered: ‎10-09-2006
Message 1 of 3 (118 Views)

Lofting two circles

118 Views, 2 Replies
08-23-2007 12:04 AM
I have problems to make a loft-object with two circles. Maybe anyone can help me to make a loftobject.
Have tried it with this code, but it does not work.

[CommandMethod("TestLoftObjekt", CommandFlags.Modal)]
public static void TestLoftObjekt()
Document doc = Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Editor ed = doc.Editor;
//Selection of a Curve
PromptEntityOptions prOpt = new PromptEntityOptions("\nPick circle");
//CurveOptions.AllowNone = false;
prOpt.SetRejectMessage("\nSelect a circle.");
prOpt.AddAllowedClass(typeof(Circle), false);
PromptEntityResult pr = ed.GetEntity(prOpt);
if (pr.Status == PromptStatus.OK)
ObjectId entid = pr.ObjectId;
using (Transaction myT = db.TransactionManager.StartTransaction())
Entity tmpEnt = (Entity)myT.GetObject(entid, OpenMode.ForWrite);
Circle Circle1 = tmpEnt as Circle;
if (Circle1 != null)
pr = ed.GetEntity(prOpt);
if (pr.Status == PromptStatus.OK)
entid = pr.ObjectId;
tmpEnt = (Entity)myT.GetObject(entid, OpenMode.ForWrite);
Circle Circle2 = tmpEnt as Circle;
if (Circle2 != null)
Vector3d MoveVec = new Vector3d(Circle2.Center.X - Circle1.Center.X, Circle2.Center.Y - Circle1.Center.Y, Circle2.Center.Z - Circle1.Center.Z);
MoveVec *= 3;
Matrix3d MoveC = Matrix3d.Displacement(MoveVec);
Entity[] Circles = { Circle1, Circle2 };
LoftedSurface LS = new LoftedSurface();
LoftOptions LO = new LoftOptions();
LS.CreateLoftedSurface(Circles, null, null, LO);
BlockTableRecord btr = (BlockTableRecord)myT.GetObject(Circle1.OwnerId, OpenMode.ForWrite, false);
ObjectId obj = btr.AppendEntity(LS);
myT.AddNewlyCreatedDBObject(LS, true);
Valued Mentor
Posts: 331
Registered: ‎05-11-2006
Message 2 of 3 (118 Views)

Re: Lofting two circles

08-25-2007 06:15 AM in reply to: Roland_Feletic
I think the problem is you need some guide curves in the second parameter to 'CreateLoftedSurface'. I re-worked your sample a little bit to include this. See the attached file. Also this will not work if the circles are on the same plane.

I drew two circles at elev 0 and moved the seond circle some distance along the Z direction. I tested the routine on these two circles and it worked with no problem.

I hope this will get you in the right direction.

I think the sample sdk application at:

will be very useful for you.
*Roland Feletic
Message 3 of 3 (118 Views)

Re: Lofting two circles

08-27-2007 05:05 AM in reply to: Roland_Feletic
Thank you, Larry.
Managed_SurfaceHelix was also very useful!
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!