리습 문의입니다. 윈도우 7 32비트에서는 되는데 윈도우 8 64비트에서 ‘잘못된 인수 유형: VLA-OBJECT nil ‘ 오류가 뜹니다. 수정좀 부탁드려도 될까여?
(setvar “cmdecho” 0)
;(setq Ptext “<To도로토적표_090519>”)
;(HEADER Ptext)
;—————————————————————————–
(defun c:RTZ()
;(SNIPE Ptext)
(ROAD_SIZE)
(princ)
)
;—————————————————————————–
(defun c:RTU()
; (SNIPE Ptext)
(ROAD_VALUE_UPDATE)
(princ)
)
;—————–table size know
(defun ROAD_SIZE(/ ent1 p1 p2 p1_y p2_y delta_y)
(princ “n>>>chain txt sample select!”)
(setq ent1 (ssget))
(setq p1 (getpoint “n>>>sample Table left up point :”))
(setq p2 (getcorner p1 “n>>>sample Table right down point :”))
(setq p1_x (car p1))
(setq p1_y (cadr p1))
(setq p2_x (car p2))
(setq p2_y (cadr p2))
(setq delta_x (abs (- p1_x p2_x)))
(setq delta_y (abs (- p1_y p2_y)))
(setq limit_kk (* delta_y 0.14))
(from_txt_correct_xy ent1 p1 p2)
(princ “n”)
(princ “>>>Table size calculate !”)
(princ)
);end of defun
;————————————————————————-
(defun ROAD_VALUE_UPDATE( / ent2 nn1 list_n repeat_n
chain_num chain_coord_x chain_coord_y
ent3 left_txt_db right_txt_db
window_p1 window_p2
find_txt_db
right_txt_db left_txt_db bcnt)
(make_layer)
(setvar “cmdecho” 0)
(setvar “osmode” 0)
(vl-load-com)
(setq bcnt 0)
(setq ksj_index 0)
(setq ksj_emp_chain_n 0)
(setq limit_y limit_kk); 토적표 숫자값중 제외 한계값
(setq find_txt_db ‘())
(setq left_value_db ‘())
(setq right_value_db ‘())
;—————–capture point calculate
(princ “n>>>DAS의 물량박스1로 세팅되어있음”)
(princ “n>>>Please open write Excel file!~ Are you ready?”)
(princ “n>>>도로 table select!”)
(setq ent2 (ssget))
(the_find_and_that_coord ent2 “NO.”)
;—————–excel activate
(the_excel_open_activate)
;—————–one and one window point calculate
(that_total_searching “총계” 7)
(setq total_y (+ 5 that_y))
(setq nn1 0)
(setq list_n (length find_txt_db))
(setq repeat_n (/ list_n 4))
(repeat repeat_n
(progn
(setq chain_num (nth nn1 find_txt_db))
(setq chain_coord_x (nth (+ nn1 1) find_txt_db))
(setq chain_coord_y (nth (+ nn1 2) find_txt_db))
(cal_window_point chain_coord_x chain_coord_y)
;—————–recapture and number searching and 분류 and db make
(setq ent3 (ssget “C” window_p1 window_p2))
(number_fillter_and_left_right_save ent3)
(setq nn1 (+ nn1 4))
(sort_and_save left_txt_db)
(setq left_value_db ksj_data)
(sort_and_save right_txt_db)
(setq right_value_db ksj_data)
;—————–excel 해당체인 위치 searching
(that_chain_searching chain_num 7); road
(if (= that_y nil)
(progn
(setq that_chin_y (+ total_y ksj_emp_chain_n))
(cell_adress_return 1 that_chin_y)
(excel_cell_write range_00 chain_num)
(cell_colour_change range_00 6)
);end of progn
(setq that_chin_y that_y)
);end of if
;—————–excel 해당체인에 write
(road_left_value_input that_chin_y)
(road_right_value_input that_chin_y)
); end of progn
);enf of repeat
(princ “n>>>All value update complete!n”)
(setvar “osmode” 33)
(vlax-release-object *excel*)
(vlax-release-object *sheets*)
(vlax-release-object *worksheet*)
;(massage)
(now_layer)
(princ)
); end of defun
;———————————————————————————————correct value calculate and save
(defun from_txt_correct_xy (ent_tx lu_p rd_p
/ endt_name ent_p ent_coord ent_coord_x ent_coord_y
lu_p_x lu_p_y rd_p_x rd_p_y)
(setq ent_name (ssname ent_tx 0))
(setq ent_p (entget ent_name))
(setq ent_coord (cdr(assoc 10 ent_p)))
(setq ent_coord_x (car ent_coord))
(setq ent_coord_y (cadr ent_coord))
(setq lu_p_x (car lu_p))
(setq lu_p_y (cadr lu_p))
(setq rd_p_x (car rd_p))
(setq rd_p_y (cadr rd_p))
(setq lu_correct_x (abs (- ent_coord_x lu_p_x)))
(setq lu_correct_x (+ lu_correct_x (* delta_x 0.01)))
(setq lu_correct_y (abs (- ent_coord_y lu_p_y)))
(setq lu_correct_y (+ lu_correct_y (* delta_y 0.01)))
(setq rd_correct_x (abs (- ent_coord_x rd_p_x)))
(setq rd_correct_x (+ rd_correct_x (* delta_x 0.01)))
(setq rd_correct_y (abs (- ent_coord_y rd_p_y)))
(setq rd_correct_y (+ rd_correct_y (* delta_y 0.01)))
(setq correct_value_db (list lu_correct_x lu_correct_y rd_correct_x rd_correct_y))
); end of defun
;————————————————————————————————-chain txt searching and relative data db make
(defun the_find_and_that_coord(ent find_txt /
n1 n2 n3 ent_name ent_p ent_type
txt txt_coord kkk)
(setq n1 (sslength ent))
(setq n2 0)
(while (/= n1 n2)
(progn
(setq ent_name (ssname ent n2))
(setq ent_p (entget ent_name))
(setq ent_type (cdr(assoc 0 ent_p)))
(if (= ent_type “TEXT”)
(progn
(setq txt (cdr (assoc 1 ent_p)))
(setq txt_head (substr txt 1 3))
(if (= txt_head find_txt)
(progn
(command “change” ent_name “” “p” “c” “2” “”)
(setq txt_coord (cdr (assoc 10 ent_p)))
(setq kkk (cons txt txt_coord))
(setq find_txt_db (append find_txt_db kkk))
(setq ksj_index (+ ksj_index 1))
)
); end of if
)
); end of if
(setq n2 (+ n2 1))
)
);end of while
); end of defun
;———————————————————————————–capture point calculate
(defun cal_window_point(x y / window_p1_x window_p1_y window_p2_x window_p2_y)
(setq window_p1_x (- x lu_correct_x))
(setq window_p1_y (+ y lu_correct_y))
(setq window_p1 (list window_p1_x window_p1_y))
(setq window_p2_x (+ x rd_correct_x))
(setq window_p2_y (- y rd_correct_y))
(setq window_p2 (list window_p2_x window_p2_y))
(command “rectangle” window_p1 window_p2)
);end of defun
;————————————————————————–number searching and left number db and right number db make
(defun number_fillter_and_left_right_save(ent / xx1 xx2 ent_name ent_p ent_type txt value txt_coord_x
txt_coord_y left_txt right_txt txt_coord_y0 dist_y )
(setq left_txt_db ‘())
(setq right_txt_db ‘())
(setq xx1 (sslength ent))
(setq xx2 0)
(while (/= xx1 xx2)
(progn
(setq appear_time (rem xx2 30)) ; 10이 커질수록 slow
(if (= appear_time 0)
(processing1 “Processing”)
)
(setq ent_name (ssname ent xx2))
(setq ent_p (entget ent_name))
(setq ent_type (cdr(assoc 0 ent_p)))
(if (= ent_type “TEXT”)
(progn
(setq txt (cdr (assoc 1 ent_p)))
(setq value (distof txt 2))
(setq txt_coord_y0 (cadr (cdr (assoc 10 ent_p))))
(setq dist_y (abs (- chain_coord_y txt_coord_y0)))
(if (and (/= value nil) (< limit_y dist_y))
(progn
(setq txt_coord_x (car (cdr (assoc 10 ent_p))))
(setq txt_coord_y (cadr (cdr (assoc 10 ent_p))))
(if (< txt_coord_x chain_coord_x)
(progn
(setq left_txt (list ent_name value txt_coord_x txt_coord_y))
(setq left_txt_db (append left_txt left_txt_db))
(command “change” ent_name “” “p” “c” “84” “”)
)
(progn
(setq right_txt (list ent_name value txt_coord_x txt_coord_y))
(setq right_txt_db (append right_txt right_txt_db))
(command “change” ent_name “” “p” “c” “152” “”)
);end of progn
);end of if – 좌우 분리
);end of progn
);end of if – 유효 숫자만
);end of progn
);end of if – txt 만
(setq xx2 (+ xx2 1))
);end of progn
);end of while
);end of defun
;————————————————————————–left txt db sort and save
(defun sort_and_save(the_list / the_value_db aa list_nn repeat_nn left_coord_y the_list_coord_y_db
the_list_coord_y_db_sort
bb sort_list_nn yyy sss other_n the_value_n the_value)
(setq the_value_db ‘())
(setq the_list_coord_y_db ‘())
(setq aa 3)
(setq list_nn (length the_list))
(setq repeat_nn (/ list_nn 4))
(repeat repeat_nn
(progn
(setq coord_y (nth aa the_list))
(setq coord_y (list coord_y))
(setq the_list_coord_y_db (append the_list_coord_y_db coord_y))
(setq aa (+ aa 4))
); end of progn
); end of repeat
(setq the_list_coord_y_db_sort (vl-sort the_list_coord_y_db ‘>))
(setq bb 0)
(setq sort_list_nn (length the_list_coord_y_db_sort))
(repeat sort_list_nn
(progn
(setq yyy (nth bb the_list_coord_y_db_sort))
(setq position_yyy (vl-position yyy the_list))
(setq the_value_n (- position_yyy 2))
(setq the_value (nth the_value_n the_list))
(setq the_value (list the_value))
(setq the_value_db (append the_value_db the_value))
(setq bb (+ bb 1))
); end of progn
);end of repeat
(setq ksj_data the_value_db)
); end of defun
;——————————————————————————the_excel_activate
;(defun the_excel_open_activate(sheetname / )
(defun the_excel_open_activate( / )
(if (null msxc-xl24HourClock)
(vlax-import-type-library
:tlb-filename “C:/Program Files/Microsoft Office/OFFICE12/XL5EN32.OLB”
:methods-prefix “msxm-“
:properties-prefix “msxp-“
:constants-prefix “msxc-” )
)
(setq *excel* (vlax-get-or-create-object “Excel.Application.12”)); 2003은 11 2007은 12
(setq *sheets* (vlax-get-property *excel* ‘ActiveWorkbook))
(setq *worksheet* (vlax-get-property *sheets* ‘ActiveSheet))
;(msxm-activate *worksheet*)
)
;——————————————————-cell_adress_trans calcu
(defun cell_adress_return(x y / y_tx)
(cond
((= x 1) (setq Alpabet “A”))
((= x 2) (setq Alpabet “B”))
((= x 3) (setq Alpabet “C”))
((= x 4) (setq Alpabet “D”))
((= x 5) (setq Alpabet “E”))
((= x 6) (setq Alpabet “F”))
((= x 7) (setq Alpabet “G”))
((= x 8) (setq Alpabet “H”))
((= x 9) (setq Alpabet “I”))
((= x 10) (setq Alpabet “J”))
((= x 11) (setq Alpabet “K”))
((= x 12) (setq Alpabet “L”))
((= x 15) (setq Alpabet “O”))
((= x 17) (setq Alpabet “Q”))
((= x 19) (setq Alpabet “S”))
((= x 22) (setq Alpabet “V”))
((= x 25) (setq Alpabet “Y”))
((= x 28) (setq Alpabet “AB”))
((= x 29) (setq Alpabet “AC”))
((= x 31) (setq Alpabet “AE”))
((= x 32) (setq Alpabet “AF”))
((= x 34) (setq Alpabet “AH”))
((= x 35) (setq Alpabet “AI”))
((= x 37) (setq Alpabet “AK”))
((= x 40) (setq Alpabet “AN”))
((= x 43) (setq Alpabet “AQ”))
((= x 45) (setq Alpabet “AS”))
((= x 47) (setq Alpabet “AU”))
((= x 51) (setq Alpabet “AY”))
((= x 53) (setq Alpabet “BA”))
((= x 55) (setq Alpabet “BC”))
((= x 57) (setq Alpabet “BE”))
((= x 59) (setq Alpabet “BG”))
)
(setq y_tx (itoa y))
(setq cell_adress (strcat Alpabet y_tx))
(setq range_00 (vlax-get-property *worksheet* ‘Range cell_adress))
)
;————————————————excel_cell_read
(defun excel_cell_read(cell_obj / cell_obj_value0)
(setq cell_obj_value0 (vlax-get-property cell_obj ‘Value))
(setq cell_obj_value1 (vlax-variant-value cell_obj_value0))
); end of defun
;————————————————excel_cell_write
(defun excel_cell_write(cell_obj that_value / )
(vlax-put-property cell_obj ‘value2 that_value)
); end of defun
;————————————————that chain searching and cell address y save
(defun that_chain_searching(that_chain_name start_y / search_y search_txt excel_txt)
(setq search_txt that_chain_name)
(setq search_y start_y)
(while (and (/= search_txt excel_txt) (/= total_y search_y))
(progn
(cell_adress_return 1 search_y )
(excel_cell_read range_00)
(setq excel_txt cell_obj_value1)
(setq search_y (+ search_y 1))
)
); end of while
(if (= search_y total_y)
(progn
(setq anounce_txt (strcat search_txt “을 찾을 수 없습니다”))
(alert anounce_txt)
(setq that_y nil)
(setq ksj_emp_chain_n (+ ksj_emp_chain_n 1))
)
(setq that_y (- search_y 1))
); end of if
); end of defun
;————————————————that chain searching and cell address y save
(defun that_total_searching(that_chain_name start_y / search_y search_txt excel_txt)
(setq search_txt that_chain_name)
(setq search_y start_y)
(while (/= search_txt excel_txt)
(progn
(cell_adress_return 1 search_y )
(excel_cell_read range_00)
(setq excel_txt cell_obj_value1)
(setq search_y (+ search_y 1))
)
); end of while
(setq that_y (- search_y 1))
); end of if
;————————————————road left value input
(defun road_left_value_input(yyy / value )
(cell_adress_return 1 yyy)
(cell_colour_change range_00 6)
(setq value (nth 0 left_value_db))
(cell_adress_return 34 yyy)
(excel_cell_write range_00 value)
(cell_colour_change range_00 50)
(setq value (nth 1 left_value_db))
(cell_adress_return 37 yyy)
(excel_cell_write range_00 value)
(cell_colour_change range_00 50)
(setq value (nth 2 left_value_db))
(cell_adress_return 31 yyy)
(excel_cell_write range_00 value)
(cell_colour_change range_00 50)
(setq value (nth 3 left_value_db))
(cell_adress_return 51 yyy)
(excel_cell_write range_00 value)
(cell_colour_change range_00 50)
(setq value (nth 4 left_value_db))
(cell_adress_return 53 yyy)
(excel_cell_write range_00 value)
(cell_colour_change range_00 50)
(setq value (nth 5 left_value_db))
(cell_adress_return 55 yyy)
(excel_cell_write range_00 value)
(cell_colour_change range_00 50)
(setq value (nth 6 left_value_db))
(cell_adress_return 57 yyy)
(excel_cell_write range_00 value)
(cell_colour_change range_00 50)
(setq value (nth 7 left_value_db))
(cell_adress_return 59 yyy)
(excel_cell_write range_00 value)
(cell_colour_change range_00 50)
(setq value (nth 8 left_value_db))
(cell_adress_return 40 yyy)
(excel_cell_write range_00 value)
(cell_colour_change range_00 50)
(setq value (nth 9 left_value_db))
(cell_adress_return 43 yyy)
(excel_cell_write range_00 value)
(cell_colour_change range_00 50)
); end of defun
;————————————————road right value input
(defun road_right_value_input(yyy / value )
(cell_adress_return 1 yyy)
(cell_colour_change range_00 6)
(setq value (nth 0 right_value_db))
(cell_adress_return 3 yyy)
(excel_cell_write range_00 value)
(cell_colour_change range_00 37)
(setq value (nth 1 right_value_db))
(cell_adress_return 6 yyy)
(excel_cell_write range_00 value)
(cell_colour_change range_00 37)
(setq value (nth 2 right_value_db))
(cell_adress_return 9 yyy)
(excel_cell_write range_00 value)
(cell_colour_change range_00 37)
(setq value (nth 3 right_value_db))
(cell_adress_return 12 yyy)
(excel_cell_write range_00 value)
(cell_colour_change range_00 37)
(setq value (nth 4 right_value_db))
(cell_adress_return 28 yyy)
(excel_cell_write range_00 value)
(cell_colour_change range_00 37)
(setq value (nth 5 right_value_db))
(cell_adress_return 17 yyy)
(excel_cell_write range_00 value)
(cell_colour_change range_00 37)
(setq value (nth 6 right_value_db))
(cell_adress_return 19 yyy)
(excel_cell_write range_00 value)
(cell_colour_change range_00 37)
(setq value (nth 7 right_value_db))
(cell_adress_return 22 yyy)
(excel_cell_write range_00 value)
(cell_colour_change range_00 37)
(setq value (nth 8 right_value_db))
(cell_adress_return 25 yyy)
(excel_cell_write range_00 value)
(cell_colour_change range_00 37)
(setq value (nth 9 right_value_db))
(cell_adress_return 15 yyy)
(excel_cell_write range_00 value)
(cell_colour_change range_00 37)
); end of defun
;————————————————cell colour change
(defun cell_colour_change(cell_obj colourindex / cell_obj_interior cell_obj_interior_c cell_obj_interior_c_v)
(setq cell_obj_interior (vlax-get-property cell_obj ‘interior))
(setq cell_obj_interior_c (vlax-get-property cell_obj_interior ‘ColorIndex))
(setq cell_obj_interior_c_v (vlax-variant-value cell_obj_interior_c))
(setq cell_obj_interior_c_v (vlax-make-variant colourindex))
(vlax-put-property cell_obj_interior ‘ColorIndex cell_obj_interior_c_v)
);end of defun
;——————————————————————————————————
(defun processing1 (prmpt /)
(Princ
(Nth bcnt ‘(“rProcessing ▶▷▷▷▷▷▷▷▷▷▷▷▷▷▷▷▷▷▷▷”
“rProcessing ▶▶▷▷▷▷▷▷▷▷▷▷▷▷▷▷▷▷▷▷”
“rProcessing ▶▶▶▷▷▷▷▷▷▷▷▷▷▷▷▷▷▷▷▷”
“rProcessing ▶▶▶▶▷▷▷▷▷▷▷▷▷▷▷▷▷▷▷▷”
“rProcessing ▶▶▶▶▶▷▷▷▷▷▷▷▷▷▷▷▷▷▷▷”
“rProcessing ▶▶▶▶▶▶▷▷▷▷▷▷▷▷▷▷▷▷▷▷”
“rProcessing ▶▶▶▶▶▶▶▷▷▷▷▷▷▷▷▷▷▷▷▷”
“rProcessing ▶▶▶▶▶▶▶▶▷▷▷▷▷▷▷▷▷▷▷▷”
“rProcessing ▶▶▶▶▶▶▶▶▶▷▷▷▷▷▷▷▷▷▷▷”
“rProcessing ▶▶▶▶▶▶▶▶▶▶▷▷▷▷▷▷▷▷▷▷”
“rProcessing ▶▶▶▶▶▶▶▶▶▶▶▷▷▷▷▷▷▷▷▷”
“rProcessing ▶▶▶▶▶▶▶▶▶▶▶▶▷▷▷▷▷▷▷▷”
“rProcessing ▶▶▶▶▶▶▶▶▶▶▶▶▶▷▷▷▷▷▷▷”
“rProcessing ▶▶▶▶▶▶▶▶▶▶▶▶▶▶▷▷▷▷▷▷”
“rProcessing ▶▶▶▶▶▶▶▶▶▶▶▶▶▶▶▷▷▷▷▷”
“rProcessing ▶▶▶▶▶▶▶▶▶▶▶▶▶▶▶▶▷▷▷▷”
“rProcessing ▶▶▶▶▶▶▶▶▶▶▶▶▶▶▶▶▶▷▷▷”
“rProcessing ▶▶▶▶▶▶▶▶▶▶▶▶▶▶▶▶▶▶▷▷”
“rProcessing ▶▶▶▶▶▶▶▶▶▶▶▶▶▶▶▶▶▶▶▷”
“rProcessing ▶▶▶▶▶▶▶▶▶▶▶▶▶▶▶▶▶▶▶▶”
“rProcessing ▷▷▷▷▷▷▷▷▷▷▷▷▷▷▷▷▷▷▷▷”
)
)
)
(setq bcnt (Rem (1+ bcnt) 21))
)
;—————————————————————————————————————sun function(3):layer make
(defun make_layer()
(setq layer_name_bit (rtos (getvar “cdate”) 2 0))
(setq layer_name (strcat “zzz_ksj(” layer_name_bit “)”))
(command “-layer” “m” layer_name “c” “1” “” “”)
(princ)
)
;—————————————————————————————————————sun function(4):layer change
(defun now_layer()
(command “-layer” “s” now_layer_name “”)
(princ)
)
;—————————————————————————–SERIAL_CHECK
(defun SERIAL_CHECK()
(setq curr_date (getvar “cdate”))
(setq ymd (rtos curr_date 2 0))
(setq year (atoi (substr ymd 1 4)))
(setq month (atoi (substr ymd 5 2)))
(setq date (atoi (substr ymd 7 2)))
(setq output_serial (+ year (expt month 2) (* 2 year date) 7777 ))
(setq tmpop (open “c:/WINKSJ.SYS” “r”))
(if (= tmpop nil)
(setq serial_opt 0)
(progn
(setq tmpserial (atoi (read-line tmpop)))
(setq tmpop (close tmpop))
(if (= output_serial tmpserial)
(setq serial_opt 1)
(setq serial_opt 0)
)
)
)
)
;—————————————————————————-MASSAGE
;;;(defun MASSAGE()
;;; (princ “n>>>>>>>>>>> 2018 YES 평창!, YES JESUS!! <<<<<<<<<<n”)
;;; (princ)
;;; )
;—————————————————————————–END