//hàm gán ID của 1 Circle
 public void SetKeyOfCircle(int keyvalue)
 {
     //duyệt từng circle trong listCircle
     foreach (var circle in listCircles)
     {
         Lcad.PropPutInt(circle.GetHandle(), Lcad.LC_PROP_ENT_KEY, keyvalue);
     }
 }
Ejemplo n.º 2
0
        private void loadFile_FormMoBanVeDatabase(String idHoChieu)
        {
            this.hoChieuChinh = BS_HoChieu.HoChieu(idHoChieu);
            this.banVeChinh   = BS_BanVe.BanVe(this.hoChieuChinh.MaBanVe);
            List <LoKhoan> danhSachLoKhoan = BS_LoKhoan.DanhSachLoKhoan(idHoChieu);
            List <Circle>  danhSachCircle  = new List <Circle>();

            mgCircles = new ManageCircle();
            //dựng bản vẽ mới
            //this.banVeChinh.HienKhoangCach = false;
            this.Text = "Bản vẽ: [" + this.banVeChinh.TenBanVe + "]";
            Lcad.DrwLoad(hDrw, BS_Template.ChonTemplate(this.banVeChinh.Template).DuongDan, this.Handle, hWnd);
            layerLoMin         = Lcad.DrwAddLayer(hDrw, "LoMin", "cyan", 0, Lcad.LC_LWEIGHT_DEFAULT);
            layerLuoiKichThuoc = Lcad.DrwAddLayer(hDrw, "LuoiKichThuoc", "foreground", 0, Lcad.LC_LWEIGHT_DEFAULT);
            int hBlockModel = Lcad.PropGetHandle(hDrw, Lcad.LC_PROP_DRW_BLOCK_MODEL);

            foreach (LoKhoan value in danhSachLoKhoan)
            {
                int hEntCircle = Lcad.BlockAddCircle(hBlockModel, value.ToaDoX, value.ToaDoY, value.BanKinh, false);
                Lcad.PropPutInt(hEntCircle, Lcad.LC_PROP_ENT_ID, int.Parse(value.MaLoKhoan));
                Lcad.PropPutInt(hEntCircle, Lcad.LC_PROP_ENT_KEY, keyCircle);
                Lcad.PropPutStr(hEntCircle, Lcad.LC_PROP_ENT_LAYER, "LoMin");
                danhSachCircle.Add(new Circle(hEntCircle));
            }
            mgCircles.AddListCircle(danhSachCircle);
            if (banVeChinh.HienKhoangCach)
            {
                Lcad.LayerClear(layerLuoiKichThuoc, hBlockModel);
                DungLuoiKichThuoc();
            }
            //vẽ lại hình
            Lcad.DrwRegenViews(hDrw, 0);
            Lcad.WndExeCommand(hWnd, Lcad.LC_CMD_ZOOM_EXT, 0);
            BS_LiteCAD.ShowNotifyAutoHide(elementHost1, this.banVeChinh.TenBanVe + " - đã mở");
            //mở form dựng lưới lỗ khoan
            if (mgCircles.GetListCircles().Count == 0)
            {
                FormXayDungLoKhoan fm = new FormXayDungLoKhoan();
                fm.MyGetData = new FormXayDungLoKhoan.GetData(loadFile_FormXayDungLoKhoan);
                fm.Show();
            }
        }
Ejemplo n.º 3
0
        //
        private void barButtonItem_HoChieuNoMin_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Lcad.PropPutInt(hDrw, Lcad.LC_PROP_DRW_COLORBACKM, int.Parse("FFFFFF", System.Globalization.NumberStyles.HexNumber));
            Lcad.PropPutInt(hDrw, Lcad.LC_PROP_DRW_COLORFOREM, int.Parse("000000", System.Globalization.NumberStyles.HexNumber));
            Lcad.PropPutStr(layerLoMin, Lcad.LC_PROP_LAYER_COLOR, "blue");
            Lcad.WndExeCommand(hWnd, Lcad.LC_CMD_REGEN, 0);
            Lcad.DrwRegenViews(hDrw, 0);
            Lcad.Initialize();
            int    hView    = Lcad.PropGetHandle(hDrw, Lcad.LC_PROP_DRW_VIEW);
            String fullPath = Path.GetFullPath(Path.Combine((@"" + Application.StartupPath), @"..\..\"));

            Lcad.ViewRasterize(hView, fullPath + "Template\\ViewTemp.bmp", 0, 0, 0, 0, 10);
            Lcad.PropPutInt(hDrw, Lcad.LC_PROP_DRW_COLORBACKM, int.Parse("000000", System.Globalization.NumberStyles.HexNumber));
            Lcad.PropPutInt(hDrw, Lcad.LC_PROP_DRW_COLORFOREM, int.Parse("FFFFFF", System.Globalization.NumberStyles.HexNumber));
            Lcad.PropPutStr(layerLoMin, Lcad.LC_PROP_LAYER_COLOR, "cyan");
            Lcad.WndExeCommand(hWnd, Lcad.LC_CMD_REGEN, 0);
            Lcad.DrwRegenViews(hDrw, 0);
            Lcad.Initialize();
            FormBaoCaoThongKe fm = new FormBaoCaoThongKe(hoChieuChinh);

            fm.Show();
        }
Ejemplo n.º 4
0
        private void MouseDblClkProc_XayDungLuoiLoMin(int hWnd, int Button, int Flags, int Xwin, int Ywin, double Xdrw, double Ydrw)
        {
            int hBlockModel = Lcad.PropGetHandle(hDrw, Lcad.LC_PROP_DRW_BLOCK_MODEL);

            if (mgCircles == null)
            {
                mgCircles = new ManageCircle();
            }
            else
            {
                Lcad.LayerClear(layerLoMin, hBlockModel);
                Lcad.LayerClear(layerLuoiKichThuoc, hBlockModel);
                mgCircles = new ManageCircle();
            }
            int hEntCircle = Lcad.BlockAddCircle(hBlockModel, Xdrw, Ydrw, banKinh, false);

            Lcad.PropPutInt(hEntCircle, Lcad.LC_PROP_ENT_KEY, keyCircle);
            Lcad.PropPutStr(hEntCircle, Lcad.LC_PROP_ENT_LAYER, "LoMin");
            Lcad.BlockUnselect(hBlockModel);
            //tạo danh sách cột đầu tiên
            List <Circle> listCotDau = new List <Circle>();
            Circle        root       = new Circle(hEntCircle);

            listCotDau.Add(root);
            //tạo cột đầu tiên từ điểm gốc (số điểm trong cột ứng với số hàng trừ đi điểm gốc)
            for (int i = 0; i < soHang - 1; i++)
            {
                int newHEnt = Lcad.BlockAddClone(hBlockModel, listCotDau[i].GetHandle());
                Lcad.PropPutInt(newHEnt, Lcad.LC_PROP_ENT_KEY, keyCircle);
                Lcad.BlockSelectEnt(hBlockModel, newHEnt, true);
                Lcad.BlockSelMove(hBlockModel, 0, khoangCachHang, false, true);
                Lcad.BlockUnselect(hBlockModel);
                listCotDau.Add(new Circle(newHEnt));
            }
            mgCircles.AddListCircle(listCotDau);
            //thêm các cột còn lại (ứng với số cột trừ đi cột đầu)
            for (int i = 0; i < soCot - 1; i++)
            {
                List <Circle> listCotGanNhat = new List <Circle>();
                List <Circle> listCotMoi     = new List <Circle>();
                if (khoangCachCot > 0)
                {
                    listCotGanNhat = mgCircles.GetListCirleOfLastColumn();
                }
                else
                {
                    listCotGanNhat = mgCircles.GetListCirleOfFirstColumn();
                }
                foreach (var circle in listCotGanNhat)
                {
                    int newHEnt = Lcad.BlockAddClone(hBlockModel, circle.GetHandle());
                    Lcad.PropPutInt(newHEnt, Lcad.LC_PROP_ENT_KEY, keyCircle);
                    Lcad.BlockSelectEnt(hBlockModel, newHEnt, true);
                    Lcad.BlockSelMove(hBlockModel, khoangCachCot, 0, false, true);
                    Lcad.BlockUnselect(hBlockModel);
                    listCotMoi.Add(new Circle(newHEnt));
                }
                mgCircles.AddListCircle(listCotMoi);
            }
            //hiển thị lưới kích thước
            if (this.banVeChinh.HienKhoangCach)
            {
                DungLuoiKichThuoc();
            }
            //load lại
            //MessageBox.Show("hang" + soHang + "\ncot" + soCot + "\nkc hang" + khoangCachHang + "\nkc cot" + khoangCachCot + "\nX" + Xdrw + "\nY" + Ydrw);
            Lcad.DrwRegenViews(hDrw, 0);
            Lcad.WndExeCommand(hWnd, Lcad.LC_CMD_ZOOM_EXT, 0);
            Lcad.OnEventMouseDblClk(_EventMouseDbclick_LoMin);
            LuuHoChieu(this.hoChieuChinh.MaHoChieu);    //ăn gian...
            BS_LiteCAD.ShowNotifyAutoHide(elementHost1, "Xây dựng lưới lỗ khoan - hoàn thành");
        }