Lee Mac Posted June 3, 2009 Posted June 3, 2009 hmmm...cannot figure what is wrong, just took your lisp and put it in notepad and upload application..totaly strange, I see that you use ACAD 2010, maybe this is a problem?? There is nothing in this LISP that I have written that would be affected by versions that I can think of. Would you be able to attach the notepad file you are using? Thanks, Lee Quote
goldy2000 Posted June 3, 2009 Author Posted June 3, 2009 Here is example file...it can be with comma or space for delimiters AA.TXT Quote
stevesfr Posted June 3, 2009 Posted June 3, 2009 There is nothing in this LISP that I have written that would be affected by versions that I can think of. Would you be able to attach the notepad file you are using? Thanks, Lee Lee, your code doesn't like the spaces in the space delimited file. in the lines of the code below; VAR_6 6478734.443 5021743.861 141.46 STRANG VAR_6001 6478740.330 5021743.133 141.436 STRANG code doesn't like the length of the first field, nor the length of the field before "strang" copy the first line to a separate file, it will run copy the second line to another separate file, it won't run. everyone has to get on the "same page" for field lengths and "spaces" for delimited text input file. hope this doesn't drive you to drinkin' Steve Quote
goldy2000 Posted June 3, 2009 Author Posted June 3, 2009 Hmmm, hope you're right Steve, it would be good if field length for code could be up to 15 letters, and for number of points about up to 10, hope it is solvable... Quote
Lee Mac Posted June 3, 2009 Posted June 3, 2009 My LISP extracts the information from each line by detecting a space between the different terms. You have 3 spaces between each term in the text file - I was unaware of this. I'll see if I can modify the LISP slightly to account for 3 spaces Quote
Lee Mac Posted June 3, 2009 Posted June 3, 2009 If my theory is correct, this should work: (defun c:goldy (/ doc spc file nl lst pt) (vl-load-com) (setq doc (vla-get-ActiveDocument (vlax-get-Acad-Object)) spc (if (zerop (vla-get-activespace doc)) (if (= (vla-get-mspace doc) :vlax-true) ; Vport (vla-get-modelspace doc) (vla-get-paperspace doc)) (vla-get-modelspace doc))) (or (tblsearch "LAYER" "TOCKA") (vla-add (vla-get-layers doc) "TOCKA")) (if (setq file (getfiled "Select Text File" (if *load$file* *load$file* "") "txt" ) (progn (setq *load$file* file file (open file "r")) (while (setq nl (read-line file)) (setq lst (cons (StrBrk nl 32) lst))) (close file) (foreach line lst (setq pt (mapcar 'distof (list (caddr line) (cadr line) (cadddr line)))) (vla-put-layer (vla-AddPoint spc (vlax-3D-point pt)) "TOCKA") (Make_Text pt (last line) 0.0 "KOD" 1 2) (Make_Text pt (car line) 0.0 "BROJ TOCKE" 1 0) (Make_Text pt (cadddr line) 0.0 "VISINA" 1 3))) (princ "\n<!> No File Selected <!>")) (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 4)))) (reverse (cons str lst))) (defun Make_Text (pt val rot lay |72 |73) (entmake (list (cons 0 "TEXT") (cons 8 lay) (cons 10 pt) (cons 40 (getvar "TEXTSIZE")) (cons 1 val) (cons 50 rot) (cons 7 (getvar "TEXTSTYLE")) (cons 71 0) (cons 72 |72) (cons 73 |73) (cons 11 pt)))) Quote
goldy2000 Posted June 3, 2009 Author Posted June 3, 2009 Hey Lee Mac, thx for trying this..You can try better to make lisp that in txt file exist comma better than free spaces Quote
goldy2000 Posted June 3, 2009 Author Posted June 3, 2009 1,6500000.000,6512452.000,132.222,ROAD -->>example Quote
Lee Mac Posted June 3, 2009 Posted June 3, 2009 Did my new code work for you on your attached text file? Quote
goldy2000 Posted June 3, 2009 Author Posted June 3, 2009 No, it says: ; error: bad argument type: FILE nil Quote
goldy2000 Posted June 3, 2009 Author Posted June 3, 2009 Never mind, dont bother with that any more, you already done too much!!! Quote
Lee Mac Posted June 3, 2009 Posted June 3, 2009 Is it working at your CAD?? Yes, it works on my machine. Try saving the file in a different location - not on desktop or in Search path. Quote
goldy2000 Posted June 3, 2009 Author Posted June 3, 2009 Command: _ai_selall Selecting objects...; error: Exception occurred: 0xC0000005 (Access Violation) ; warning: unwind skipped on exception ; error: Exception occurred: 0xC0000005 (Access Violation) This shows me when want to select all in drawing Quote
Lee Mac Posted June 3, 2009 Posted June 3, 2009 Command: _ai_selall Selecting objects...; error: Exception occurred: 0xC0000005 (Access Violation) ; warning: unwind skipped on exception ; error: Exception occurred: 0xC0000005 (Access Violation) This shows me when want to select all in drawing The LISP should not require you to select anything.. . Quote
Lee Mac Posted June 3, 2009 Posted June 3, 2009 hey it works!!! Great! - is it working how you want it to? Or are there modifications that need doing? Quote
goldy2000 Posted June 3, 2009 Author Posted June 3, 2009 I closed everything and started new job and it worked, THX MAN, can you fix it so text would be on left alignment, and to switch places X and Y (X axis in geodesy is Y in CAD, and inversly) Quote
goldy2000 Posted June 3, 2009 Author Posted June 3, 2009 txt file would be the same as I send you, but in CAD to do it inversly 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.