i have to fill up excel data sheet ( refer attached) based on CAD drawing. any one help with easy lisp
Solved! Go to Solution.
i have to fill up excel data sheet ( refer attached) based on CAD drawing. any one help with easy lisp
Solved! Go to Solution.
Solved by CADaSchtroumpf. Go to Solution.
Hi @shil143
Is there any reason that the tables in the drawing cannot be made into blocks with attributes? Then a simple dataextraction would do what you are asking.
Please select the Accept as Solution button if my post solves your issue or answers your question.
Hi @shil143
Is there any reason that the tables in the drawing cannot be made into blocks with attributes? Then a simple dataextraction would do what you are asking.
Please select the Accept as Solution button if my post solves your issue or answers your question.
Yes, But i have only center coordinate in Attributes, i need all for corners as well.
Yes, But i have only center coordinate in Attributes, i need all for corners as well.
i need to update coordinate based on excel cell just click in AutoCAD
i need to update coordinate based on excel cell just click in AutoCAD
i want update this excel sheet based on AutoCAD DWG....Any one Help with lisp..i have to fill up Coordinate by typing for corners A,B,C,D....
i want update this excel sheet based on AutoCAD DWG....Any one Help with lisp..i have to fill up Coordinate by typing for corners A,B,C,D....
A start to have the corners... continue with this.
((lambda ( / js n dxf_ent pt_ins rot scal_x scal_y scal_z cornerA cornerB cornerC cornerD) (setq js (ssget "_X" '((0 . "INSERT") (2 . "DC-18A")))) (cond (js (repeat (setq n (sslength js)) (setq dxf_ent (entget (ssname js (setq n (1- n)))) pt_ins (cdr (assoc 10 dxf_ent)) rot (cdr (assoc 50 dxf_ent)) scal_x (cdr (assoc 41 dxf_ent)) scal_y (cdr (assoc 42 dxf_ent)) scal_z (cdr (assoc 43 dxf_ent)) cornerA (polar pt_ins (+ (/ (* 5 pi) 4) rot) (sqrt (+ (expt (* -0.75 scal_x) 2) (expt (* -0.75 scal_y) 2)))) cornerB (polar pt_ins (+ (- pi (atan (/ 0.65 0.75))) rot) (sqrt (+ (expt (* -0.75 scal_x) 2) (expt (* 0.65 scal_y) 2)))) cornerC (polar pt_ins (+ (atan (/ 0.65 0.75)) rot) (sqrt (+ (expt (* 0.75 scal_x) 2) (expt (* 0.65 scal_y) 2)))) cornerD (polar pt_ins (+ (/ (* 7 pi) 4) rot) (sqrt (+ (expt (* 0.75 scal_x) 2) (expt (* -0.75 scal_y) 2)))) ) ;this part return result at text screen, modify to export to excel or other (mapcar '(lambda (x i) (print (strcat i "=" (rtos (car x) 2 3) ";" (rtos (cadr x) 2 3)))) (list pt_ins cornerA cornerB cornerC cornerD) '("INSERT" "CornerA" "CornerB" "CornerC" "CornerD")) (print) ; ) ) ) (prin1) ))
A start to have the corners... continue with this.
((lambda ( / js n dxf_ent pt_ins rot scal_x scal_y scal_z cornerA cornerB cornerC cornerD) (setq js (ssget "_X" '((0 . "INSERT") (2 . "DC-18A")))) (cond (js (repeat (setq n (sslength js)) (setq dxf_ent (entget (ssname js (setq n (1- n)))) pt_ins (cdr (assoc 10 dxf_ent)) rot (cdr (assoc 50 dxf_ent)) scal_x (cdr (assoc 41 dxf_ent)) scal_y (cdr (assoc 42 dxf_ent)) scal_z (cdr (assoc 43 dxf_ent)) cornerA (polar pt_ins (+ (/ (* 5 pi) 4) rot) (sqrt (+ (expt (* -0.75 scal_x) 2) (expt (* -0.75 scal_y) 2)))) cornerB (polar pt_ins (+ (- pi (atan (/ 0.65 0.75))) rot) (sqrt (+ (expt (* -0.75 scal_x) 2) (expt (* 0.65 scal_y) 2)))) cornerC (polar pt_ins (+ (atan (/ 0.65 0.75)) rot) (sqrt (+ (expt (* 0.75 scal_x) 2) (expt (* 0.65 scal_y) 2)))) cornerD (polar pt_ins (+ (/ (* 7 pi) 4) rot) (sqrt (+ (expt (* 0.75 scal_x) 2) (expt (* -0.75 scal_y) 2)))) ) ;this part return result at text screen, modify to export to excel or other (mapcar '(lambda (x i) (print (strcat i "=" (rtos (car x) 2 3) ";" (rtos (cadr x) 2 3)))) (list pt_ins cornerA cornerB cornerC cornerD) '("INSERT" "CornerA" "CornerB" "CornerC" "CornerD")) (print) ; ) ) ) (prin1) ))
Thanks For Your Reply.......Please Can You Update.......
Click on the Corners in CAD and Get Result in the Excel ( Above Attached excel format). i am using "Click2XLS.vlx"
Thanks For Your Reply.......Please Can You Update.......
Click on the Corners in CAD and Get Result in the Excel ( Above Attached excel format). i am using "Click2XLS.vlx"
Please, try to continue yourself for completed the cells.
NB: Copy-paste the code in command line for running it
((lambda ( / js xls wks lin n dxf_ent pt_ins rot scal_x scal_y scal_z cornerA cornerB cornerC cornerD) (vl-load-com)
(setq js (ssget "_X" '((0 . "INSERT") (2 . "DC-18A")))) (cond (js (setq xls (vlax-get-or-create-object "Excel.Application")) (or (setq wks (vlax-get xls 'ActiveSheet)) (vlax-invoke (vlax-get xls 'workbooks) 'Add) ) (setq wks (vlax-get xls 'ActiveSheet) lin 1 ) (vlax-put xls 'Visible :vlax-true) (mapcar '(lambda (x y) (vlax-put (vlax-get-property wks 'range (strcat x (itoa lin))) 'value y)) '("A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L") '("VC_ID" "EASTING" "NORTHING" "A_EASTING" "A_NORTHING" "B_EASTING" "B_NORTHING" "C_EASTING" "C_NORTHING" "D_EASTING" "D_NORTHING" "COVER_LVL") ) (setq lin (1+ lin)) (repeat (setq n (sslength js)) (setq dxf_ent (entget (ssname js (setq n (1- n)))) pt_ins (cdr (assoc 10 dxf_ent)) rot (cdr (assoc 50 dxf_ent)) scal_x (cdr (assoc 41 dxf_ent)) scal_y (cdr (assoc 42 dxf_ent)) scal_z (cdr (assoc 43 dxf_ent)) cornerA (polar pt_ins (+ (/ (* 5 pi) 4) rot) (sqrt (+ (expt (* -0.75 scal_x) 2) (expt (* -0.75 scal_y) 2)))) cornerB (polar pt_ins (+ (- pi (atan (/ 0.65 0.75))) rot) (sqrt (+ (expt (* -0.75 scal_x) 2) (expt (* 0.65 scal_y) 2)))) cornerC (polar pt_ins (+ (atan (/ 0.65 0.75)) rot) (sqrt (+ (expt (* 0.75 scal_x) 2) (expt (* 0.65 scal_y) 2)))) cornerD (polar pt_ins (+ (/ (* 7 pi) 4) rot) (sqrt (+ (expt (* 0.75 scal_x) 2) (expt (* -0.75 scal_y) 2)))) ) (mapcar '(lambda (x y) (vlax-put (vlax-get-property wks 'range (strcat x (itoa lin))) 'value y)) '("B" "C" "D" "E" "F" "G" "H" "I" "J" "K") (apply 'append (mapcar '(lambda (e) (list (read (rtos (car e) 2 3)) (read (rtos (cadr e) 2 3)))) (list pt_ins cornerA cornerB cornerC cornerD))) ) (setq lin (1+ lin)) ) (mapcar 'vlax-release-object (list wks xls)) ) ) (prin1) ))
Please, try to continue yourself for completed the cells.
NB: Copy-paste the code in command line for running it
((lambda ( / js xls wks lin n dxf_ent pt_ins rot scal_x scal_y scal_z cornerA cornerB cornerC cornerD) (vl-load-com)
(setq js (ssget "_X" '((0 . "INSERT") (2 . "DC-18A")))) (cond (js (setq xls (vlax-get-or-create-object "Excel.Application")) (or (setq wks (vlax-get xls 'ActiveSheet)) (vlax-invoke (vlax-get xls 'workbooks) 'Add) ) (setq wks (vlax-get xls 'ActiveSheet) lin 1 ) (vlax-put xls 'Visible :vlax-true) (mapcar '(lambda (x y) (vlax-put (vlax-get-property wks 'range (strcat x (itoa lin))) 'value y)) '("A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L") '("VC_ID" "EASTING" "NORTHING" "A_EASTING" "A_NORTHING" "B_EASTING" "B_NORTHING" "C_EASTING" "C_NORTHING" "D_EASTING" "D_NORTHING" "COVER_LVL") ) (setq lin (1+ lin)) (repeat (setq n (sslength js)) (setq dxf_ent (entget (ssname js (setq n (1- n)))) pt_ins (cdr (assoc 10 dxf_ent)) rot (cdr (assoc 50 dxf_ent)) scal_x (cdr (assoc 41 dxf_ent)) scal_y (cdr (assoc 42 dxf_ent)) scal_z (cdr (assoc 43 dxf_ent)) cornerA (polar pt_ins (+ (/ (* 5 pi) 4) rot) (sqrt (+ (expt (* -0.75 scal_x) 2) (expt (* -0.75 scal_y) 2)))) cornerB (polar pt_ins (+ (- pi (atan (/ 0.65 0.75))) rot) (sqrt (+ (expt (* -0.75 scal_x) 2) (expt (* 0.65 scal_y) 2)))) cornerC (polar pt_ins (+ (atan (/ 0.65 0.75)) rot) (sqrt (+ (expt (* 0.75 scal_x) 2) (expt (* 0.65 scal_y) 2)))) cornerD (polar pt_ins (+ (/ (* 7 pi) 4) rot) (sqrt (+ (expt (* 0.75 scal_x) 2) (expt (* -0.75 scal_y) 2)))) ) (mapcar '(lambda (x y) (vlax-put (vlax-get-property wks 'range (strcat x (itoa lin))) 'value y)) '("B" "C" "D" "E" "F" "G" "H" "I" "J" "K") (apply 'append (mapcar '(lambda (e) (list (read (rtos (car e) 2 3)) (read (rtos (cadr e) 2 3)))) (list pt_ins cornerA cornerB cornerC cornerD))) ) (setq lin (1+ lin)) ) (mapcar 'vlax-release-object (list wks xls)) ) ) (prin1) ))
Can't find what you're looking for? Ask the community or share your knowledge.