Chuyển đến nội dung
Diễn đàn CADViet

vndesperados

Thành viên
  • Số lượng nội dung

    503
  • Đã tham gia

  • Lần ghé thăm cuối

  • Ngày trúng

    7

Cộng đồng

254 (khá)

1 Người theo dõi

About vndesperados

  • Cấp bậc
    biết lệnh xref

Phương pháp liên hệ

  • Địa chỉ Trang web:
    http://vokiencuong.com
  • ICQ
    0
  • Yahoo
    vkcuong_23@yahoo.com

Thông tin hồ sơ

  • Giới tính
    Male
  • Sở thích
    Câu cá.

Khách truy cập Tiểu sử gần đây

11.077 chế độ xem tiểu sử
  1. vndesperados

    Chưong trình ghi diện tích - Gởi BabyArc

    http://www.cadviet.com/upfiles/Dientich_1.zip Các bác GET về dùng với lệnh DSA Nội dung như sau: Cho phép ghi diện tích bằng cách PICK điểm hay SELECT OBJECT Cập nhật lại diện tích nếu có sự thay đổi của đối tương (scale hoặcc rezise, không phải là xóa đi rồi vẽ lại cái mới) Cập nhật lại diên tích nếu có sự thay đổi cách thể hiện (VD như từ hecta sang m2) Còn dưới đây là source code DIENTICH.LISP ;Chuong trinh tinh va ghi dien tich cho phep cap nhat lai dien tich khi thay thay doi doi tuong ;Author Vo Kien Cuong (DEFUN DIENTICH(/ DCL_ID_DIENTICH dt) (setq DCL_ID_DIENTICH (load_dialog "DIENTICH.DCL")) (if (not(new_dialog "DIENTICH" DCL_ID_DIENTICH)) (exit)) (action_tile "BACK_key" "(CHANGE_SLIDE 0)") (action_tile "NEXT_key" "(CHANGE_SLIDE 1)") (action_tile "OPT_key" "(OPTION)") (action_tile "info" "(ABOUT)") (action_tile "accept" "(GETVALUE_DT) (done_dialog 1)") (action_tile "TK_key" "(GETVALUE_DT) (done_dialog 2)") (action_tile "UPD_key" "(GETVALUE_DT) (done_dialog 3)") (SETVALUE_DT) (setq RES_DT (start_dialog)) (if (= RES_DT 1) (progn (if (= Is_Obj "1") (setq dt (GETOBJECT)) (setq dt (GETPOINTS)) ) (WRITEDIENTICH dt) (DIENTICH) ) ) (if (= RES_DT 2) (progn (KHOILUONG) (DIENTICH) ) ) (if (= RES_DT 3) (progn (CAPNHAT) (DIENTICH) ) ) (unload_dialog DCL_ID_DIENTICH) ) (DEFUN TINHDIENTICH(dt dv / s) (Command "AREA" "O" dt) (setq s (getvar "AREA")) (If (= dv "1") (setq s (/ s 10000)) ) s ) (DEFUN WRITEDIENTICH(dt / s Pnt blkName) (setq Pnt Nil) (setq s (TINHDIENTICH dt DVDT)) (setq ds (Fix (* s (atof MDDS)))) (if (= DVDS "1") (setq ds (/ ds 1000)) ) (while (Null Pnt) (setq Pnt (Getpoint "Chon diem chen Block ")) ) (setq kh (getString "\nNhap ky hieu: ")) (setq blkName (nth (- i_sld 1) Li_sld)) (if (= Is_Obj "1") (setq handle (ID_HANDLE dt)) (setq handle "vkc") ) (command "-INSERT" blkName "S" TLSC Pnt "0" kh (rtos s 2 2) (itoa ds) handle DVDT DVDS) ) (DEFUN IMAGE_SLIDE(/ sld_name) (setq sld_name (nth (- i_sld 1) Li_sld)) (start_image "IMAGE_key") (fill_image 0 0 (dimx_tile "IMAGE_key") (dimy_tile "IMAGE_key") -15) (slide_image 5 0 (dimx_tile "IMAGE_key") (dimy_tile "IMAGE_key") sld_name) (end_image) ) (DEFUN C:DSA() (setvar "CMDECHO" 0) (terpri) (DT_INIT) (DIENTICH) (setvar "CMDECHO" 1) ) (DEFUN C:SA() (setvar "CMDECHO" 0) (terpri) (DT_INIT) (if (= Is_Obj "1") (setq dt (GETOBJECT)) (setq dt (GETPOINTS)) ) (WRITEDIENTICH dt) (setvar "CMDECHO" 1) ) (DEFUN DT_INIT() (setq Li_sld (List "Blk001" "Blk002" "Blk003" "Blk004")) (if (Null i_sld) (setq i_sld 1) ) (CREALILA) (if (Null Is_Obj) (setq Is_Obj "1") ) (if (Null Is_Pnt) (setq Is_Pnt "0") ) (if (Null IsCuLa_DT) (setq IsCuLa_DT "1") ) (if (Null IsSetLa_DT) (setq IsSetLa_DT "0") ) (if (Null la_DT) (setq la_DT "0") ) (if (Null Is_DVDT) (setq Is_DVDT "0") ) (if (Null Is_DVDS) (setq Is_DVDS "0") ) (setq Li_DT (List "m2" "ha")) (If (Null DVDT) (setq DVDT "1") ) (setq Li_DS (List "1" "1000")) (If (Null DVDS) (setq DVDS "1") ) (If (Null MDDS) (setq MDDS "100") ) (If (Null TLSC) (setq TLSC "1") ) (If (Null IsON) (setq IsON "1") ) (If (Null IsOFF) (setq IsOFF "0") ) ) (DEFUN CHANGE_SLIDE(n) (if (= n 0) (progn (if (= i_sld 1) (setq i_sld 4) (setq i_sld (- i_sld 1)) ) ) ) (if (= n 1) (progn (if (= i_sld 4) (setq i_sld 1) (setq i_sld (+ i_sld 1)) ) ) ) (IMAGE_SLIDE) ) (DEFUN OPTION (/ DCL_ID_DIENTICH_OPT) (setq DCL_ID_DIENTICH_OPT (load_dialog "DIENTICH.DCL")) (if (not (new_dialog "OPTION" DCL_ID_DIENTICH_OPT))(exit)) (action_tile "IsCuLA_DT" "(Is_Chk_La)") (action_tile "IsSetLA_DT" "(Is_Chk_La)") (action_tile "MD_DS" "(CHECKVALUE_MDDS)") (action_tile "TL_DT" "(CHECKVALUE_TLSC)") (action_tile "accept" "(GETOPTVALUE_DT) (done_dialog 1)") (if (= IsSetLa_DT "1") (mode_tile "La_DT" 0) (mode_tile "La_DT" 1) ) (start_list "La_DT") (mapcar 'add_list LiLa) (end_list) (start_list "DV_DT") (mapcar 'add_list Li_DT) (end_list) (start_list "DV_DS") (mapcar 'add_list Li_DS) (end_list) (SETOPTVALUE_DT) (start_dialog) (unload_dialog DCL_ID_DIENTICH_OPT) ) (DEFUN SETVALUE_DT() (IMAGE_SLIDE) (set_tile "DT_OBJ" Is_Obj) (set_tile "DT_PNT" Is_Pnt) ) (DEFUN GETVALUE_DT() (setq Is_Obj (get_tile "DT_OBJ")) (setq Is_Pnt (get_tile "DT_PNT")) ) (DEFUN SETOPTVALUE_DT() (set_tile "IsCuLA_DT" IsCuLa_DT) (set_tile "IsSetLA_DT" IsSetLa_DT) (set_tile "La_DT" la_DT) (set_tile "Is_DVDT" Is_DVDT) (set_tile "Is_DVDS" Is_DVDS) (set_tile "DV_DT" DVDT) (set_tile "DV_DS" DVDS) (set_tile "MD_DS" MDDS) (set_tile "TL_DT" TLSC) (set_tile "ON_key" IsON) (set_tile "OFF_key" IsOFF) ) (DEFUN GETOPTVALUE_DT() (setq IsCuLa_DT (get_tile "IsCuLA_DT")) (setq IsSetLa_DT (get_tile "IsSetLA_DT")) (setq la_DT (get_tile "La_DT")) (setq Is_DVDT (get_tile "Is_DVDT")) (setq Is_DVDS (get_tile "Is_DVDS")) (setq DVDT (get_tile "DV_DT")) (setq DVDS (get_tile "DV_DS")) (setq MDDS (get_tile "MD_DS")) (setq TLSC (get_tile "TL_DT")) (setq IsON (get_tile "ON_key")) (setq IsOFF (get_tile "OFF_key")) ) (DEFUN CREALILA (/ NL) (setq LiLa (List)) (setq NL (tblnext "LAYER" T)) (while NL (setq LiLa (append LiLa (list (cdr (assoc 2 NL))))) (setq NL (tblnext "LAYER")) ) (setq LiLa (Acad_strlsort LiLa)) ) (DEFUN Is_Chk_La () (if (= (get_tile "IsSetLA_DT") "1") (mode_tile "La_DT" 0) (mode_tile "La_DT" 1) ) ) (DEFUN CHECKVALUE_MDDS() (setq temp (get_tile "MD_DS")) (If (Not (IsNumeric temp)) (progn (alert "Gia tri nhap vao khong hop le") (set_tile "MD_DS" MDDS) ) ) ) (DEFUN CHECKVALUE_TLSC() (setq temp (get_tile "TL_DT")) (If (Not (IsNumeric temp)) (progn (alert "Gia tri nhap vao khong hop le") (set_tile "TL_DT" TLSC) ) ) ) (DEFUN GETOBJECT(/ ss dt) (setq ss Nil) (while (Null ss) (princ "Chon doi tuong can tinh dien tich") (setq ss (ssget)) ) (setq dt (ssname ss 0)) dt ) (DEFUN GETPOINTS(/ ssLine Pnt1 Pnt2 dt) (setq ssLine (ssAdd)) (setvar "CMDECHO" 0) (princ "\nChon diem tren man hinh de tinh dien tich") (setq Pnt1 (Getpoint "\nChon diem dau tien:")) (while (Not (Null Pnt1)) (setq Pnt2 (Getpoint Pnt1 "\nChon diem tiep theo")) (if (AND (Not (NUll Pnt1)) (Not (NUll Pnt2))) (command "LINE" Pnt1 Pnt2 "") ) (setq dt (entlast)) (setq ssLine (ssAdd dt ssLine)) (setq Pnt1 Pnt2) ) (setq dt (ssname ssLine 0)) (command "PEDIT" dt "Y" "J" ssLine "" "") (setvar "CMDECHO" 1) (setq dt (entlast)) dt ) (DEFUN ABOUT(/ DCL_ID_ABOUT) (setq DCL_ID_ABOUT (load_dialog "DIENTICH.DCL")) (if (not(new_dialog "ABOUT" DCL_ID_ABOUT))(exit)) (start_list "aboutme") (add_list " ") (add_list " VO KIEN CUONG - Bachelor of IT") (add_list " =====================================================") (add_list " Email : vkcuong_23@yahoo.com") (add_list " Mobile: 0983616182 - 0977352125") (add_list " CAD developer (LISP, DCL, VBA for AutoCad, ObjectARX...)") (add_list " ") (end_list) (start_dialog) (unload_dialog DCL_ID_ABOUT) ) (DEFUN KHOILUONG( / ss LiKH LiDT LiDS n i chuoi ss) (setq LiKH Nil) (setq LiDT Nil) (setq LiDS Nil) (setq ss Nil) (princ "Chon nhom Block muon thong ke khoi luong") (setq ss (ssget)) (setq n (sslength ss)) (if (> n 0) (progn (setq i 0) (while (< i n) (setq dt (ssname ss i)) (if (OR (= (TENDOITUONG dt) "Blk001") (= (TENDOITUONG dt) "Blk002") (= (TENDOITUONG dt) "Blk003") (= (TENDOITUONG dt) "Blk004")) (progn (setq LiKH (Append LiKH (List (GetStringTag dt "KH")))) (setq LiDT (Append LiDT (List (GetStringTag dt "DT")))) (setq LiDS (Append LiDS (List (GetStringTag dt "DS")))) ) ) (setq i (1+ i)) ) ) ) (setq n (length LiKH)) (If (> n 0) (progn (setq i 0) (setq DCL_ID_KHOILUONG (load_dialog "DIENTICH.DCL")) (if (not(new_dialog "KHOILUONG" DCL_ID_KHOILUONG)) (exit)) (start_list "li_KL") (add_list (strcat " So Block: " (itoa n))) (add_list " BANG KHOI LUONG") (add_list " -------------------------------------------------------") (while (< i n) (setq chuoi (strcat " " (FIXLENGTH (nth i liKH) 15) (FIXLENGTH (nth i liDT) 15) (FIXLENGTH (nth i liDS) 15))) (add_list chuoi) (setq i (1+ i)) ) (add_list " -------------------------------------------------------") (end_list) (start_dialog) (unload_dialog DCL_ID_ABOUT) ) ) ) (DEFUN ID_HANDLE (obj / idha) (setq idha (CDR (ASSOC 5 (ENTGET obj)))) idha ) (DEFUN X_SCALE (obj / sc) (setq sc (CDR (ASSOC 41 (ENTGET obj)))) sc ) (DEFUN CAPNHAT(/ ss LiHandle LiBlkHandle LiBLK LiKH LiDT LIDS LiDVDT LiDVDS LiTD LiSC dt i j n handle s ds blkName_temp dvdt_temp dvds_temp sc_temp) (setq ss Nil) (setq LiHandle (List)) (setq LiBLK (List)) (setq LiBlkHandle (List)) (setq LiKH (List)) (setq LiDT (List)) (setq LiDS (List)) (setq LiDVDT (List)) (setq LiDVDS (List)) (setq LiTD (List)) (setq LiSC (List)) (princ "Chon doi tuong muon cap nhat") (setq ss (ssget)) (setq n (sslength ss)) (setq i 0) (while (< i n) (setq dt (ssname ss i)) (if (OR (= (TENDOITUONG dt) "Blk001") (= (TENDOITUONG dt) "Blk002") (= (TENDOITUONG dt) "Blk003") (= (TENDOITUONG dt) "Blk004")) (progn (setq handle (GetStringTag dt "ID")) (if (/= handle "vkc") (progn (setq LiHandle (Append LiHandle (List handle))) (setq LiBlkHandle (Append LiBlkHandle (List (ID_HANDLE dt)))) (setq LiBLK (Append LiBLK (List (TENDOITUONG dt)))) (setq LiKH (Append LiKH (List (GetStringTag dt "KH")))) (setq LiDT (Append LiDT (List (GetStringTag dt "DT")))) (setq LiDS (Append LiDS (List (GetStringTag dt "DS")))) (setq LiDVDT (Append LiDVDT (List (GetStringTag dt "DVDT")))) (setq LiDVDS (Append LiDVDS (List (GetStringTag dt "DVDS")))) (setq LiTD (Append LiTD (List (TOADOXY dt)))) (setq LiSC (Append LiSC (List (X_SCALE dt)))) ) ) ) ) (setq i (1+ i)) ) (setq i 0) (while (< i n) (setq dt (ssname ss i)) (setq handle (ID_HANDLE dt)) (setq j (IndexHandle LiHandle handle)) (if (> j -1) (progn (If (= IsON "0") (progn (setq blkName_temp (nth j LiBLK)) (setq dvdt_temp (nth j LIDVDT)) (setq dvds_temp (nth j LIDVDS)) (setq sc_temp (nth j LISC)) ) (progn (setq blkName_temp (nth (- i_sld 1) Li_sld)) (setq dvdt_temp DVDT) (setq dvds_temp DVDS) (setq sc_temp TLSC) ) ) (setq s (TINHDIENTICH dt dvdt_temp)) (setq ds (Fix (* s (atof MDDS)))) (if (= dvds_temp "1") (setq ds (/ ds 1000)) ) (setq kh (nth j LiKH)) (setq Pnt (nth j LiTD)) (command "-INSERT" blkName_temp "S" sc_temp Pnt "0" kh (rtos s 2 2) (itoa ds) handle dvdt_temp dvds_temp) ) ) (setq i (1+ i)) ) (alert (strcat "Co " (itoa (Length liKH)) " doi tuong duoc cap nhat")) (setq i 0) (while (< i n) (setq dt (ssname ss i)) (setq handle (ID_HANDLE dt)) (setq j (IndexHandle LiBlkHandle handle)) (if (> j -1) (command "ERASE" dt "") ) (setq i (1+ i)) ) ) (DEFUN IndexHandle(Li handle / i id) (setq id -1) (setq i 0) (While (< i (length Li)) (if (= handle (nth i Li)) (progn (setq id i) (setq i (length Li)) ) ) (setq i (1+ i)) ) id ) (DEFUN TOADOXY (obj / td) (setq td (cdr (assoc 10 (entget obj)))) td ) DIENTICH.DCL //Form chuong trinh tinh Dien tich //Author Vo Kien Cuong DIENTICH:dialog { spacer_1; label="CHUONG TRINH TINH DIEN TICH"; :boxed_column { label="Chon hinh anh block muon hien thi"; :row { :button { label="<<"; key="BACK_key"; } :image_button { key="IMAGE_key"; width=14; height=7; color=dialog_background; } :button { label=">>"; key="NEXT_key"; } } } :row { :boxed_column { label="Cach tinh dien tich"; :radio_button { label="Chon doi tuong"; key="DT_OBJ"; } :radio_button { label="Chon diem"; key="DT_PNT"; } } :column { :button { label="Cai dat"; key="OPT_key"; } :button { label="Cap nhat"; key="UPD_key"; } :button { label="Khoi luong"; key="TK_key"; } } } spacer_0; :row { ok_cancel; spacer_1; spacer_1; spacer_1; :button { label="Author"; key="info"; } } } OPTION:dialog { spacer_1; label="Cac thong so cho block dien tich"; :boxed_radio_column{ label="Cai dat Layer"; :radio_button{ label="Su dung Layer hien huu"; key="IsCuLA_DT"; } :radio_button{ label="Cai dat Layer"; key="IsSetLA_DT"; } :popup_list{ key="La_DT"; } } :boxed_column { label="Hien thi"; :popup_list{ label="Don vi dien tich"; key="DV_DT"; edit_width=8; } :toggle { label="Hien thi don vi dien tich"; key="Is_DVDT"; is_enabled=false; } :popup_list{ label="Don vi dan so"; key="DV_DS"; edit_width=8; } :toggle { label="Hien thi don vi dan so"; key="Is_DVDS"; is_enabled=false; } :edit_box{ label="Mat do dan so (N/DVDT):"; key="MD_DS"; edit_width=9; } :edit_box{ label="He so Scale Block:"; key="TL_DT"; edit_width=9; } } :boxed_column { label="Cap nhat block"; :radio_button { label="Giu nguyen thong so"; key="OFF_key"; } :radio_button { label="Thay doi thong so"; key="ON_key"; } } spacer_1; ok_cancel; }
×