Create Loft by c#
Dear Expert,
I want make loft in C# please help me to have sample code for this.
In dev reference do not include sample code for learn.
Thanks
0
Comments
-
Anyone can help me for this isssue?
Thanks
0 -
Hello.
These links could be useful:
https://adndevblog.typepad.com/autocad/2012/06/how-to-use-createloftedsolid.html
0 -
I hope it helps:
Document doc = Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
using (Transaction tr = db.TransactionManager.StartTransaction())
{
BlockTable blkTbl = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead);
BlockTableRecord btr = (BlockTableRecord)tr.GetObject(blkTbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite); LoftOptions lpt = new LoftOptions();
Solid3d cone02 = new Solid3d();
Circle circCone03 = new Circle();
circCone03.Radius = 7.5;
circCone03.Center = new Point3d(0, 0, 33);
Point3dCollection pColl = new Point3dCollection { new Point3d(-17, 7.5, 50), new Point3d(17, 7.5, 50), new Point3d(17, -7.5, 50), new Point3d(-17, -7.5, 50) };
Polyline3d newPolyline3d = new Polyline3d(Poly3dType.SimplePoly, pColl, true);
newPolyline3d.Closed = true;
Line centerCone2 = new Line(new Point3d(0, 0, 33), new Point3d(0, 0, 50));
Entity[] entCone2 = new Entity[] { circCone03, newPolyline3d };
cone02.CreateLoftedSolid(entCone2, null, centerCone2, lpt);
btr.AppendEntity(cone02);
tr.AddNewlyCreatedDBObject(cone02, true);
tr.Commit(); }0