mossieramm Posted July 15, 2009 Posted July 15, 2009 Hi, I have an excel file which looks like this example: x y length angle 208919.46 378003.48 0.0482 13.8851 I found out how to draw a line with this information. Add these columns in Excel. line208919.46,378003.48@0.0482 then paste in the command line. But what I really want is an arrow on the x,y which is scaled and angled accordingly. I've tried substituting the line command with -insert c:\arrow.dwg but Cad needs an enter (space doesn't work) to continue. How do you give a Cad enter in Excel ??? Any help would be greatly appreciated. David. Quote
GE13579 Posted July 15, 2009 Posted July 15, 2009 Hi David, You need to be in the VBA area with this kind of question- I'll ask a mod if they can move it for you... Gary Quote
mossieramm Posted July 15, 2009 Author Posted July 15, 2009 ok, I wasn't sure where to put place my question Quote
Commandobill Posted July 15, 2009 Posted July 15, 2009 You dont need to have a space. I would just do "saveas" on the excel document and save it as a text file (tab delimited) and have it be "filename.scr" then in autocad type "script" load the file and it should work like a champ. Quote
mossieramm Posted July 15, 2009 Author Posted July 15, 2009 A saveas in Excel doesn't work. But if I copy the cells to Wordpad and then do a saveas, then it works like a charm with a bit of tweaking. Only thing is, the file has roughly 5000 rows, so it takes about 15 min for the script to run. Thanks for the help. David. Quote
Lee Mac Posted July 15, 2009 Posted July 15, 2009 A saveas in Excel doesn't work. But if I copy the cells to Wordpad and then do a saveas, then it works like a charm with a bit of tweaking. Only thing is, the file has roughly 5000 rows, so it takes about 15 min for the script to run. Thanks for the help. David. If you have a txt file with the information you quoted above, "x y length angle", then a simple LISP would make this task a 2 min procedure Quote
flowerrobot Posted July 16, 2009 Posted July 16, 2009 How do you give a Cad enter in Excel ??? go the the cell below it, eg 'A1' = stuff the before enter 'A2' = the things after enter can be done as much as possible Quote
mossieramm Posted July 16, 2009 Author Posted July 16, 2009 If you have a txt file with the information you quoted above, "x y length angle", then a simple LISP would make this task a 2 min procedure Of course one would have to know how to do this ?? I do have a Saveas in Excel, just not the option to save as a text (tab delimited). Quote
Lee Mac Posted July 16, 2009 Posted July 16, 2009 not sure if something like this would work: (defun c:txt2blk (/ file nl lst) (vl-load-com) (if (and (or (tblsearch "BLOCK" "arrow") (findfile "arrow.dwg")) (setq file (getfiled "Select Text File" (if *load *load "") "txt" )) (progn (setq *load file file (open file "r")) (while (setq nl (read-line file)) (setq lst (cons (StrBrk nl 9) lst))) (close file) (foreach x lst (command "_.-insert" "arrow" "_non" (mapcar 'distof (list (car x) (cadr x))) "1" "1" (distof (last x)))))) (princ)) (defun StrBrk (str chrc / pos lst) (while (setq pos (vl-string-position chrc str)) (setq lst (cons (substr str 1 pos) lst) str (substr str (+ pos 2)))) (reverse (cons str lst))) I have only taken into account the x,y and the angle as I am not of the orignal length of the arrow, to know how much to scale it by. This assumes a text file with the data TAB delimited. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.