Beispiel #1
0
        void SbCreateBound_Click(object sender, EventArgs e)
        {
            ReadData();

            CreateBoundary Command = new CreateBoundary();

            Command.Create_Boundaries_Util(double.Parse(AllowDistance));
        }
Beispiel #2
0
        // 버튼 > 테스트
        private void simpleButton1_Click_1(object sender, EventArgs e)
        {
            CreateBoundary Command = new CreateBoundary();

            Command.Create_Boundaries();


            #region 초기 테스트
            //var acSSet = Util.Select.MultiObjs();

            //var acEnts = Util.Get.Entity(acSSet, typeof(Polyline));

            //var acLines = new List<LineSegment3d>();

            //var acTempLines = new List<Line>();

            //acEnts.ForEach(acEnt =>
            //{
            //    var acEntsTemp = acEnts.Where(x => x != acEnt);
            //    var acPoly = acEnt as Polyline;

            //    for (int i = 0; i < acPoly.NumberOfVertices; i++)
            //    {
            //        try
            //        {
            //            var acLine = acPoly.GetLineSegmentAt(i);

            //            if (!acLines.Contains(acLine))
            //            {
            //                acLines.Add(acLine);
            //            }

            //            var Di = acLine.Direction;
            //            var D = 300;

            //            var sp = acLine.StartPoint;
            //            var ep = acLine.EndPoint;
            //            var SP = Util.P.Move(acLine.StartPoint, -Di * D);
            //            var EP = Util.P.Move(acLine.EndPoint, Di * D);

            //            LineSegment3d LS1 = new LineSegment3d(sp, SP);
            //            LineSegment3d LS2 = new LineSegment3d(ep, EP);

            //            var IP1 = CAD.IntersectedLine(acEntsTemp.ToList(), LS1, sp, 500);
            //            var IP2 = CAD.IntersectedLine(acEntsTemp.ToList(), LS2, ep, 500);

            //            if (IP1 != new Point3d())
            //            {
            //                //if (sp.DistanceTo(IP1) < 500)
            //                //{
            //                //}
            //                var L1 = CAD.CreateLine(sp, IP1, ColorIndex.DarkGray);
            //                acTempLines.Add(L1);

            //                if (!acLines.Contains(LS1)) acLines.Add(LS1);
            //            }
            //            if (IP2 != new Point3d())
            //            {
            //                //if (ep.DistanceTo(IP2) < 500)
            //                //{
            //                //}
            //                var L2 = CAD.CreateLine(ep, IP2, ColorIndex.DarkGray);
            //                acTempLines.Add(L2);

            //                if (!acLines.Contains(LS2)) acLines.Add(LS2);
            //            }
            //        }
            //        catch
            //        {
            //        }
            //    }
            //});

            //var P_X = (from a in acLines
            //           let p = a.StartPoint
            //           orderby p.X
            //           select p.X);

            //var P_Y = (from a in acLines
            //           let p = a.StartPoint
            //           orderby p.Y
            //           select p.Y);


            //var _Points = (from a in acLines
            //               let p = a.StartPoint
            //               orderby p.X, p.Y
            //               select p);

            //var _acLines = (from a in acLines
            //                let p = a.StartPoint
            //                orderby p.X, p.Y
            //                select a);

            //var Min_P = new Point3d(P_X.First() - 1000, P_Y.First() - 1000, 0);
            //var Max_P = new Point3d(P_X.Last() + 1000, P_Y.Last() + 1000, 0);

            //var Box = CAD.CreateRectangle(Min_P, Max_P);

            //var P1 = Util.P.Move(Min_P, 100, 100);

            //var objColl = acDocEd.TraceBoundary(P1, true);

            //var acObjs = from a in objColl.Cast<Entity>().ToList()
            //             select a;

            //if (acObjs.Any())
            //{
            //    using (Transaction T = acDb.TransactionManager.StartTransaction())
            //    {
            //        var BT = T.GetObject(acDb.BlockTableId, OpenMode.ForRead) as BlockTable;
            //        var BTR = T.GetObject(BT[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;

            //        acObjs.ToList().ForEach(a =>
            //        {
            //            var acPoly = a as Polyline;

            //            if (Math.Abs(acPoly.Area - Box.Area) > 1)
            //            {
            //                BTR.AppendEntity(acPoly);
            //                T.AddNewlyCreatedDBObject(acPoly, true);
            //            }
            //        });

            //        T.Commit();
            //    }
            //}

            ////using (Transaction T = acDb.TransactionManager.StartTransaction())
            ////{

            ////    object[] dataArray = new object[1];

            ////    var P = Util.P.Move(Min_P, 100, 100);
            ////    var str = P.X + "," + P.Y;
            ////    dataArray[0] = "-boundary " + str + "  ";

            ////    B = true;

            ////    //acDoc.SendStringToExecute(dataArray[0].ToString(), true, true, false);
            ////    //acDoc.SendStringToExecute(dataArray[0].ToString(), true, false, false);

            ////    //acDocEd.Command("boundary", " ", P, " ");

            ////    T.Commit();
            ////}


            ////MessageBox.Show(Box.Id.ObjectClass.DxfName);

            //CAD.Erase(Box.Id);

            //acTempLines.ForEach(a => CAD.Erase(a.Id));

            #endregion
        }