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

Lofting two circles

116 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 (116 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 (116 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!

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community