public void CreateKeyLine()
        {
            bool B = true;

            while (B)
            {
                //#region PRE
                //SelectionSet acSSet = SelectLines();

                //if (acSSet == null)
                //{
                //    B = false;
                //    return;
                //}
                //#endregion

                //#region 폴리라인 선택
                //var selectedPolyLines = new List<Polyline>();
                //var acPolylines = new List<Polyline>();

                //using (Transaction T = AC.DB.TransactionManager.StartTransaction())
                //{
                //    var Lines = from id in acSSet.GetObjectIds()
                //                let acEnt = T.GetObject(id, OpenMode.ForWrite) as Entity
                //                where acEnt is Polyline
                //                let acLine = acEnt as Polyline
                //                select acLine;

                //    if (!Lines.Any())
                //        return;

                //    selectedPolyLines.AddRange(Lines.ToArray());
                //}
                //#endregion

                var Polylines   = select.Objects <Polyline>();
                var acPolylines = new List <Polyline>();

                #region 폴리라인 정리
                Polylines.ForEach(pl =>
                {
                    #region 폴리라인에서 커브 담기
                    var curves = new List <Curve3d>();

                    for (int i = 0; i < pl.NumberOfVertices; i++)
                    {
                        try
                        {
                            var l = pl.GetLineSegmentAt(i).Length;

                            if (l >= Min && l <= Max)
                            {
                                curves.Add(pl.GetLineSegmentAt(i));
                            }
                        }
                        catch (System.Exception)
                        {
                        }
                    }
                    #endregion

                    #region 폴리라인 장축 중심을 읻는 선
                    if (curves.Count == 2)
                    {
                        var cv1 = curves[0];
                        var cv2 = curves[1];

                        var p1 = CADUtil.GetCenterPoint3d(cv1);
                        var p2 = CADUtil.GetCenterPoint3d(cv2);

                        var vec = CADUtil.GetVector(p1, p2);

                        var X = (vec * extend).X;
                        var Y = (vec * extend).Y;

                        var sp = CADUtil.MoveP(p1, -X, -Y, 0);
                        var ep = CADUtil.MoveP(p2, X, Y, 0);

                        var acPolyline = CADUtil.CreatePolyline(sp, ep);

                        acPolylines.Add(acPolyline);
                    }
                    #endregion
                });
                #endregion

                using (DocumentLock DL = AC.Doc.LockDocument())
                {
                    #region 검토 & 연속된 선 연결
                    // 제거할 선들
                    var deletePolylines = new List <Polyline>();

                    acPolylines.ForEach(pl1 =>
                    {
                        var contiPolylines = new List <Polyline>();

                        // 평행하고 같은 선상에 있는 선들
                        var paralPolylines = from pl2 in acPolylines
                                             where !deletePolylines.Contains(pl2)
                                             let line1                         = pl1.GetLineSegmentAt(0)
                                                                     let line2 = pl2.GetLineSegmentAt(0)
                                                                                 where line1.IsParallelTo(line2, new Tolerance(1, 1))
                                                                                 where IsAlmostEqual(line1, line2)
                                                                                 select pl2;

                        // 평행하고 같은 선상에 있는 선들 개수
                        int N = paralPolylines.Count();

                        var paralNearPolylines                                                             = from pl2 in paralPolylines
                                                                         let line1                         = pl1.GetLineSegmentAt(0)
                                                                                                 let line2 = pl2.GetLineSegmentAt(0)
                                                                                                             where CADUtil.getNearDistance(line1, line2) < distance
                                                                                                             select pl2;

                        if (paralNearPolylines.Any())
                        {
                            contiPolylines.AddRange(paralNearPolylines);

                            for (int j = 0; j < N; j++)
                            {
                                contiPolylines.ToList().ForEach(a =>
                                {
                                    var srtPolylines = from pl2 in acPolylines
                                                       where !contiPolylines.Contains(pl2)
                                                       let line1                         = a.GetLineSegmentAt(0)
                                                                               let line2 = pl2.GetLineSegmentAt(0)
                                                                                           where line1.IsParallelTo(line2, new Tolerance(1, 1))
                                                                                           where IsAlmostEqual(line1, line2)
                                                                                           where CADUtil.getNearDistance(line1, line2) < 2 * extend + distance
                                                                                           select pl2;

                                    if (srtPolylines.Any())
                                    {
                                        contiPolylines.AddRange(srtPolylines);
                                    }
                                });
                            }
                        }

                        if (contiPolylines.Any())
                        {
                            var Ps = CADUtil.getFurPoints(contiPolylines.ToList());

                            var acPolyline = CADUtil.CreatePolyline(Ps[0], Ps[1]);

                            deletePolylines.AddRange(contiPolylines);
                        }
                    });

                    #endregion

                    #region 제거
                    using (OpenCloseTransaction T = AC.DB.TransactionManager.StartOpenCloseTransaction())
                    {
                        deletePolylines.ForEach(a =>
                        {
                            var entity = T.GetObject(a.Id, OpenMode.ForWrite) as Entity;

                            if (!entity.IsErased)
                            {
                                entity.Erase(true);
                            }
                        });

                        T.Commit();
                    }
                    #endregion
                }
            }

            AC.Editor.WriteMessage("\n키라인 입력완료 ");
            AC.Editor.PostCommandPrompt();
        }