goldy2000 Posted June 2, 2009 Posted June 2, 2009 Hello everyone!! I need a LISp that imports X,Y,Z,and CODE or some other attributes from txt or xls/csv file, and puts it to new layer separately like this: POINT with coodrinates (X;Y;Z) should be layer TOCKA (*croatian language*) HEIHGT (Z coord) should be layer VISINA NUMBER OF POINT should be layer BROJ TOCKE CODE should be layer KOD and if some other attributes exist than can become layer OSTALO I saw a lot of lisps that do part of this but didnt find any to puts it in different layers, so if anybody knows how to do it...This would be good for geodesy and many geodesiests in the world, because this is my job also....THX in advance.. Quote
wannabe Posted June 2, 2009 Posted June 2, 2009 I've got one that will read coordinates and populate the drawing with blocks of your choosing. It will also populate the attributes of the block in the order they appear in your excel/text file. Example: X coord y coord attribute1 attribute 2 Do you want me to send it or is it not compatible with your designs? Quote
goldy2000 Posted June 2, 2009 Author Posted June 2, 2009 I have something similiar, it puts every coord in its axis, you can send it so I can try it, thx man!! Quote
Lee Mac Posted June 2, 2009 Posted June 2, 2009 This can be done - Just a few things to ask though: Are the POINT NUMBER, Z COORD and CODE all attributes? Or are some just text? Also, if they are all attributes, are they contained in a block that you have? Quote
goldy2000 Posted June 2, 2009 Author Posted June 2, 2009 new LAYER: POINT --> TOCKA (these are croatian words) Z HEIGHT--> VISINA CODE --> KOD POINT NUMBER--> BROJ TOCKE Yep, these 3 are the only atrributes. example: Point number Y X Z code 1 100.00 20.11 2.45 road POINT(TOCKA) is Y,X,Z coord and in dwg file is only dot. CODE(KOD) is text but it is situated at point position POINT NUMBER(BROJ TOCKE) is similiar like CODE HEIGHT Z is text that shows number, in this case 2.45, and situated near POINT position They aren't block, they are only text and point(dot in this case)...little clearly?? My english is not so great so I can't explain the best as I would do it Quote
goldy2000 Posted June 2, 2009 Author Posted June 2, 2009 Can I send you some example dwg file?? Quote
Lee Mac Posted June 2, 2009 Posted June 2, 2009 new LAYER: POINT --> TOCKA (these are croatian words) Z HEIGHT--> VISINA CODE --> KOD POINT NUMBER--> BROJ TOCKE Yep, these 3 are the only atrributes. example: Point number Y X Z code 1 100.00 20.11 2.45 road POINT(TOCKA) is Y,X,Z coord and in dwg file is only dot. CODE(KOD) is text but it is situated at point position POINT NUMBER(BROJ TOCKE) is similiar like CODE HEIGHT Z is text that shows number, in this case 2.45, and situated near POINT position They aren't block, they are only text and point(dot in this case)...little clearly?? My english is not so great so I can't explain the best as I would do it Ah, ok - I understand, Quote
goran Posted June 2, 2009 Posted June 2, 2009 I have something interesting for you (txt, csv, xls - trebam tvoj mail). Not lsp but dvb. Quote
goldy2000 Posted June 2, 2009 Author Posted June 2, 2009 dmikicic1981@yahoo.com dvb?? something like lisp command?? I read something about dvb..but..never mind I'll figure it out, Goran from Croatia?? Quote
Lee Mac Posted June 2, 2009 Posted June 2, 2009 Try this Goldy (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 ;(vlp file) (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 2)))) (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 Hellloo Lee Mac, it writes me this in command line when start lisp(when pick .txt file): ; error: no function definition: VLP Hmmm, maybe it is complicated, dont waste your time man Quote
Lee Mac Posted June 3, 2009 Posted June 3, 2009 Sorry dude, thats just my sub-function that I include for testing (forgot to take it out) - code updated, please try it again Quote
Lee Mac Posted June 3, 2009 Posted June 3, 2009 Hmmm, maybe it is complicated, dont waste your time man Nothing is too complicated If you can imagine it Quote
goldy2000 Posted June 3, 2009 Author Posted June 3, 2009 Heyy, ok I will try, can you send me lisp? or insert here? Quote
Lee Mac Posted June 3, 2009 Posted June 3, 2009 Heyy, ok I will try, can you send me lisp? or insert here? I have updated the previous code that I posted Quote
goldy2000 Posted June 3, 2009 Author Posted June 3, 2009 ; error: bad argument type: numberp: nil It says this... Maybe is in .txt file problem? It looks like this: VAR_1 6500000.000 5410000.000 122.00 STRANG ... _2 ...............................................TEREN ... ... Quote
Lee Mac Posted June 3, 2009 Posted June 3, 2009 It seems to work for me Does the file selection dialog appear? Quote
goldy2000 Posted June 3, 2009 Author Posted June 3, 2009 No, dialog doesn't appear, maybe is problem in .txt file, is your file like mine?? Dialog when selecting txt file appears but after selecting file it shows me this ; error: bad argument type: numberp: nil Quote
Lee Mac Posted June 3, 2009 Posted June 3, 2009 I just copied the text that you just posted and saved it in a Notepad file to test it... - didn't have a problem with it Quote
goldy2000 Posted June 3, 2009 Author 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?? 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.