public static void CreateHelix(List<helix> helixes)
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
//using (DocumentLock docLock = doc.LockDocument())
//{
using (var trans = doc.TransactionManager.StartTransaction())
{
BlockTable blockTable = trans.GetObject(doc.Database.BlockTableId, OpenMode.ForRead) as BlockTable;
BlockTableRecord space = trans.GetObject(blockTable[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
foreach (var helix1 in helixes)
{
Helix acHelix = new Helix();
acHelix.SetDatabaseDefaults();
acHelix.Constrain = ConstrainType.Turns;//设置这个注意
acHelix.StartPoint = Point3d.Origin;
acHelix.BaseRadius = helix1.baseRadius;
acHelix.TopRadius = helix1.topRadius;
acHelix.Height = helix1.height;
acHelix.TurnHeight = helix1.turnHeight;
acHelix.Turns = helix1.turns;
acHelix.Twist = false;
acHelix.CreateHelix();
space.AppendEntity(acHelix);
trans.AddNewlyCreatedDBObject(acHelix, true);
}
trans.Commit();
}
//}
}