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

opencad how to draw lines with values from excel

1 REPLY 1
Reply
Message 1 of 2
haozhenxiao
198 Views, 1 Reply

opencad how to draw lines with values from excel

I am new to opencad, I got a task to draw hundreds of dash lines, each dash line is contracuted with two points, and the values of the points are saved in an excel file like below, Each row represents a point, and two ajacent points construct a line, I have a lot of such values, how should I acheive drawing the lines. Thank you very much for your help.:

 

1075    7755
1075    7541
1075    7340
1075    7114
1075    6936
1075    6738




1 REPLY 1
Message 2 of 2
gcsjlewis
in reply to: haozhenxiao

See if this gets your started:

 

I do not know how well versed you are in lisp, if you need more help let me know:

 

 

(setq counter 2);; start at 2, usually 1 is a header

(repeat 100;; random count
     (setq first_x (strcat "A" (itoa counter)))
     (setq first_y (strcat "B" (itoa counter)))

     (setq second_x (strcat "A"(1+ (itoa counter))))
     (setq second_y (strcat "B"(1+  (itoa counter))))
(setq start_point (list
     (vlax-variant-value (vlax-get-property (vlax-get-property xl "RANGE" first_x) "text"))
       (vlax-variant-value (vlax-get-property (vlax-get-property xl "RANGE" first_y) "text"))

); start_point

(setq end_point (list

     (vlax-variant-value (vlax-get-property (vlax-get-property xl "RANGE" second_x) "text"))
       (vlax-variant-value (vlax-get-property (vlax-get-property xl "RANGE" second_y) "text"))

); end_point

 

(setq counter (+ counter 2))(princ)

); end repeat

 

This should return a list of the first point and the second point:

 

So assuming you are using cell "A2" & "B2"for first point and "A3" & "B3" for the next it should look like:

 

 

start_point (1075 7755)

end_point  (1075 7541)

 

hope this gets you started.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost