示例#1
0
        //화면상에 점을찍을때 나타나는 마우스커서모양 지정
        public KcsStat_point2D_req PointState(string cursortype, string defmode)
        {
            KcsPoint2D          startpoint  = new KcsPoint2D(0.0d, 0.0d);
            KcsPoint2D          point       = new KcsPoint2D();
            KcsHighlightSet     highlighter = new KcsHighlightSet();
            KcsStat_point2D_req status      = new KcsStat_point2D_req();

            status.DefMode = defmode;
            KcsHighlightSet highlight = new KcsHighlightSet();
            KcsCursorType   Curtype   = new KcsCursorType();

            if (cursortype == "CrossHair")
            {
                Curtype.SetCrossHair();
            }
            else if (cursortype == "RubberBand")
            {
                Curtype.SetRubberBand(startpoint);
            }
            else if (cursortype == "RubberRectangle")
            {
                Curtype.SetRubberRectangle(startpoint);
            }
            else if (cursortype == "RubberCircle")
            {
                Curtype.SetRubberCircle(startpoint);
            }
            else if (cursortype == "DragCursor")
            {
                Curtype.SetDragCursor(highlighter, startpoint);
            }

            status.Cursor = Curtype;
            return(status);
        }
示例#2
0
        public void SelectbyBox(int sel = 3, int cut = 1)
        {
            try
            {
                handler = new List <KcsElementHandle>();
                int resp = kcs_ui.PointPlanarReq("첫번째 코너를 찍으세요", p1);
                if (resp == kcs_util.Reject() || resp == 253 || resp == 254)
                {
                    return;
                }
                KcsCursorType       cursor = new KcsCursorType();
                KcsStat_point2D_req stat   = new KcsStat_point2D_req();
                stat.Cursor = cursor;
                cursor.SetRubberRectangle(p1);

                int resp2 = kcs_ui.PointPlanarReq("두번째 코너를 찍으세요", p2, stat);
                if (resp2 == kcs_util.Reject() || resp2 == 253 || resp == 254)
                {
                    return;
                }
                kcs_draft.HighlightOff(0);
                KcsRectangle2D     rect   = new KcsRectangle2D(p1, p2);
                KcsCaptureRegion2D region = new KcsCaptureRegion2D();
                region.SetInside();
                region.SetRectangle(rect);
                region.Cut = cut;
                KcsElementHandle[] capturehandles = this.DetermineCapture(sel);
                kcs_draft.ElementHighlight(capturehandles);
                kcs_ui.MessageNoConfirm("캡쳐된 Element 갯수는: " + capturehandles.Count().ToString());
                handler = capturehandles.ToList();
                kcs_draft.HighlightOff(0);
            }
            catch (Exception ee)
            {
                kcs_ui.MessageConfirm("캡쳐된 Element가 없습니다.");
            }
        }
示例#3
0
        public List <KcsPoint2D> selectByIndicate(int sel, string defmode = "ModeCursor")
        {
            List <KcsPoint2D> points = new List <KcsPoint2D>();

            kcs_draft.HighlightOff(0);

            //--TB와 다르게 MarElementHandle OBJ는 핸들값을 handlePML()메소드를 통해서 handle을 비교해야 다른것을 알수 있다
            //--그래서 !handleNums라는 Handle값을 가지는 Array를 통해서 비교로직을 추가로 구현하였다.
            //--그러나 Highlight를 위해서는 그냥 marelementhandle의 Array를 던져주면 동작한다.
            KcsStat_point2D_req status = PointState("CrossHair", defmode);

            while (true)
            {
                try
                {
                    p1 = new KcsPoint2D();
                    int      resp  = kcs_ui.PointPlanarReq("Indicate Geomery", p1, status);
                    KcsModel model = new KcsModel();

                    if (resp == kcs_util.OperationComplete())
                    {
                        break;
                    }
                    if (resp == kcs_util.Ok())
                    {
                        KcsElementHandle temp_handle = DetermineIdentify(sel);


                        if (handler.Where(h => h.handle == temp_handle.handle).Count() != 0)
                        {
                            handler.RemoveAll(h => h.handle == temp_handle.handle);
                            kcs_draft.HighlightOff(0);
                            kcs_draft.ElementHighlight(handler.ToArray());
                        }
                        else
                        {
                            points.Add(p1);
                            handler.Add(temp_handle);
                            kcs_draft.ElementHighlight(temp_handle);
                        }
                    }
                    else if (resp == kcs_util.Reject())
                    {
                        handler = new List <KcsElementHandle>();
                        points  = new List <KcsPoint2D>();
                        break;
                    }
                }
                catch (Exception)
                {
                    kcs_ui.MessageNoConfirm("오류");
                }
            }
            if (handler.Count == 0)
            {
                kcs_ui.MessageConfirm("선택된 모델이 없습니다. 종료합니다.");
            }
            kcs_draft.HighlightOff(0);
            return(points);



            //3D포인트 테스트 한 부분
            //p1 = new KcsPoint2D();
            //kcs_ui.PointPlanarReq("Indicate Geomery", p1, status);

            //KcsPoint3D p3 = new KcsPoint3D();
            ////                kcs_ui.PointReq()
            ////int resp = kcs_ui.PointPlanarReq("Indicate Geometry", p1);
            //int resp = kcs_ui.PointReq("Indicate Geometry", p3);
            //KcsElementHandle vh = kcs_draft.ViewIdentify("PLAN");
            //p1 = kcs_draft.PointTransform(vh, p3);
            //if (resp == kcs_util.Ok())
            //{
            //    KcsElementHandle handle = this.DetermineIdentify(sel);

            //    handler.Add(handle);
            //}
        }