thank the people who helped me !
using System;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.Runtime;
namespace CsTemp
{
public class Class1
{
[CommandMethod("Test")]
public void Test()
{
Circle circle1 = new Circle(new Point3d(0, 0, 0), new Vector3d(0, 0, 1), 5);
Line line1 = new Line(new Point3d(5, 0, 0), new Point3d(5, 0, 1));
SweepOptionsBuilder swOptBu = new SweepOptionsBuilder();
swOptBu.TwistAngle = 2 * Math.PI;
SweepOptions swOpt = swOptBu.ToSweepOptions();
SweptSurface swSur = new SweptSurface();
swSur.CreateSweptSurface(line1, circle1, swOpt);
Solid3d solid3dEnt = swSur.Thicken(0.2, true);
AppendEntity(solid3dEnt);
}
private ObjectId AppendEntity(Entity ent)
{
ObjectId entId;
Database db = HostApplicationServices.WorkingDatabase;
using (Transaction trans = db.TransactionManager.StartTransaction())
{
BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId,
OpenMode.ForRead);
BlockTableRecord btr = (BlockTableRecord)trans.GetObject
(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
entId = btr.AppendEntity(ent);
trans.AddNewlyCreatedDBObject(ent, true);
trans.Commit();
}
return entId;
}
}
}