Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

excel Data Sheet fill up From CAD

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
shil143
994 Views, 7 Replies

excel Data Sheet fill up From CAD

i have to fill up excel data sheet ( refer attached) based on CAD drawing. any one help with easy lisp

7 REPLIES 7
Message 2 of 8
john.vellek
in reply to: shil143

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.

Capture.PNG

 

 

Please select the Accept as Solution button if my post solves your issue or answers your question.


John Vellek


Join the Autodesk Customer Council - Interact with developers, provide feedback on current and future software releases, and beta test the latest software!

Autodesk Knowledge Network | Autodesk Account | Product Feedback
Message 3 of 8
shil143
in reply to: john.vellek

Yes, But i have only center coordinate in Attributes, i need all for corners as well.

Message 4 of 8
shil143
in reply to: john.vellek

i need to update coordinate based on excel cell just click in AutoCAD 

Message 5 of 8
shil143
in reply to: shil143

Untitled.png

 

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.... 

Message 6 of 8
CADaSchtroumpf
in reply to: shil143

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)
))
Message 7 of 8
shil143
in reply to: CADaSchtroumpf

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" 

Message 8 of 8
CADaSchtroumpf
in reply to: shil143

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.

Post to forums  

Technology Administrators


Autodesk Design & Make Report