Active Member
8 Posts
1 Kudo
Registered: ‎10-09-2006
Post 1 of 3

Lofting two circles

120 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
331 Posts
12 Kudos
Registered: ‎05-11-2006
Post 2 of 3

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
Post 3 of 3

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 interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!