public static bool CheckInCirlce(double x, double y, Circle c)
 {
     double kc = Math.Sqrt((x - c.GetX()) * (x - c.GetX()) + (y - c.GetY()) * (y - c.GetY()));
     if (kc < c.GetRadius())
     { return true; }
     return false;
 }
Exemple #2
0
        public static bool CheckInCirlce(double x, double y, Circle c)
        {
            double kc = Math.Sqrt((x - c.GetX()) * (x - c.GetX()) + (y - c.GetY()) * (y - c.GetY()));

            if (kc < c.GetRadius())
            {
                return(true);
            }
            return(false);
        }
Exemple #3
0
 public LoKhoan(String maHoChieu, Circle c)
 {
     this.iD         = null;
     this.maHoChieu  = maHoChieu;
     this.maBanVe    = BS_HoChieu.HoChieu(maHoChieu).MaBanVe;
     this.maMayKhoan = null;
     this.maLoKhoan  = c.GetID().ToString();
     this.banKinh    = c.GetRadius();
     this.chieuSau   = 0;
     this.huongKhoan = null;
     this.toaDoX     = c.GetX();
     this.toaDoY     = c.GetY();
     this.lt         = 0;
     this.lkk        = 0;
     this.l0         = 0;
     this.lbua       = 0;
 }
 private void VeKhoangCach(Circle c1, Circle c2)
 {
     int hBlockModel = Lcad.PropGetHandle(hDrw, Lcad.LC_PROP_DRW_BLOCK_MODEL);
     Lcad.DrwAddTextStyle(hDrw, "Arial", "Arial");
     Lcad.PropPutStr(hDrw, Lcad.LC_PROP_DRW_TEXTSTYLE, "Arial");
     int newText = 0, newLine = 0;
     newText = Lcad.BlockAddTextWin2(hBlockModel, this.banVeChinh.DeltaX.ToString(), ((c1.GetX() + c2.GetX()) / 2), ((c1.GetY() + c2.GetY()) / 2), Lcad.LC_TA_CENTER, 0.75, 1, 0, 0);
     newLine = Lcad.BlockAddLine(hBlockModel, c1.GetX(), c1.GetY(), c2.GetX(), c2.GetY());            
     Lcad.PropPutStr(newText, Lcad.LC_PROP_ENT_LAYER, "LuoiKichThuoc");
     Lcad.PropPutStr(newLine, Lcad.LC_PROP_ENT_LAYER, "LuoiKichThuoc");
 }
 //vẽ kíp nối giữa 2 lỗ khoan cùng 1 cột
 private void DrawLine_Y(Circle c1, Circle c2)
 {
     //ve
     int hBlockModel = Lcad.PropGetHandle(hDrw, Lcad.LC_PROP_DRW_BLOCK_MODEL);
     int newLine = 0;
     newLine = Lcad.BlockAddLine(hBlockModel, c1.GetX(), c1.GetY(), c2.GetX(), c2.GetY());
     Lcad.PropPutStr(newLine, Lcad.LC_PROP_ENT_LAYER, "KipNo");
 }
 //vẽ kíp nối giữa 2 lỗ khoan cùng 1 hàng
 private void DrawLine_X(Circle c1, Circle c2)
 {
     int gocNghieng = 15;
     double canhHuyen = banVeChinh.DeltaX * 30 / 100;
     double x1, y1, x2, y2, c;  //toa do 2 diem gap khuc
     double a, b;
     //tinh toan
     b = Math.Sin(gocNghieng * (Math.PI / 180)) * canhHuyen;
     a = Math.Sqrt((canhHuyen * canhHuyen) - (b * b));
     //c = banVeChinh.DeltaX - (b * 2);    //sua moi cai dong nay thoi @@
     c = Math.Abs(c1.GetX() - c2.GetX()) - (b * 2);
     if (c1.GetX() > c2.GetX())
     {
         x1 = c1.GetX() - b;
     }
     else
     {
         x1 = c1.GetX() + b;
     }
     y1 = c1.GetY() + a;
     if (c1.GetX() > c2.GetX())
     {
         x2 = x1 - c;
     }
     else
     {
         x2 = x1 + c;
     }
     y2 = y1;
     //ve
     int hBlockModel = Lcad.PropGetHandle(hDrw, Lcad.LC_PROP_DRW_BLOCK_MODEL);
     int newLine1 = 0, newLine2 = 0, newLine3 = 0;
     newLine1 = Lcad.BlockAddLine(hBlockModel, c1.GetX(), c1.GetY(), x1, y1);
     newLine2 = Lcad.BlockAddLine(hBlockModel, x1, y1, x2, y2);
     newLine3 = Lcad.BlockAddLine(hBlockModel, x2, y2, c2.GetX(), c2.GetY());
     Lcad.PropPutStr(newLine1, Lcad.LC_PROP_ENT_LAYER, "KipNo");
     Lcad.PropPutStr(newLine2, Lcad.LC_PROP_ENT_LAYER, "KipNo");
     Lcad.PropPutStr(newLine3, Lcad.LC_PROP_ENT_LAYER, "KipNo");
 }
 //cập nhật ds lỗ khoan theo bản vẽ
 private void UpdateCircleFromAutocad()
 {
     int hBlockModel = Lcad.PropGetHandle(hDrw, Lcad.LC_PROP_DRW_BLOCK_MODEL);
     List<Circle> listCircles = mgCircles.GetListCircles();
     foreach(Circle c in listCircles)
     {
         int hEnt = Lcad.BlockGetFirstEnt(hBlockModel);
         while (hEnt != 0)
         {
             int entID = Lcad.PropGetInt(hEnt, Lcad.LC_PROP_ENT_ID);
             int entType = Lcad.PropGetInt(hEnt, Lcad.LC_PROP_ENT_TYPE);
             if (!Lcad.PropGetBool(hEnt, Lcad.LC_PROP_ENT_DELETED))   //kiểm tra xem ent bị xóa hay không
             {
                 if ((entType == Lcad.LC_ENT_CIRCLE) && (entID == c.GetID()))
                 {
                     Circle newCircle = new Circle(hEnt);
                     c.SetX(newCircle.GetX());
                     c.SetY(newCircle.GetY());
                     break;
                 }
             }
             hEnt = Lcad.BlockGetNextEnt(hBlockModel, hEnt);
         }
     }            
 }
 public LoKhoan(String maHoChieu, Circle c)
 {
     this.iD = null;
     this.maHoChieu = maHoChieu;
     this.maBanVe = BS_HoChieu.HoChieu(maHoChieu).MaBanVe;
     this.maMayKhoan = null;
     this.maLoKhoan = c.GetID().ToString();
     this.banKinh = c.GetRadius();
     this.chieuSau = 0;
     this.huongKhoan = null;
     this.toaDoX = c.GetX();
     this.toaDoY = c.GetY();
     this.lt = 0;
     this.lkk = 0;
     this.l0 = 0;
     this.lbua = 0;
 }