tagkelas Posted June 4, 2009 Posted June 4, 2009 What does this string exactly? (setq lst (cons (StrBrk nl 44) lst))) I notice a difference with the previous rutine 44 or 32? And how can I change it for tab delimited? Quote
Lee Mac Posted June 4, 2009 Posted June 4, 2009 What does this string exactly? (setq lst (cons (StrBrk nl 44) lst))) I notice a difference with the previous rutine 44 or 32? And how can I change it for tab delimited? This calls the sub-function StrBrk which cuts up the string into sections delimited by the character code specified - i.e. 44 = comma; 32 = space. So for TAB: [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] lst [b][color=RED]([/color][/b][b][color=BLUE]cons[/color][/b] [b][color=RED]([/color][/b]StrBrk nl [b][color=#009900]9[/color][/b][b][color=RED])[/color][/b] lst[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED]) [/color][/b] Quote
Lee Mac Posted June 4, 2009 Posted June 4, 2009 Thanks a lot Lee Mac (one more time) No problem Quote
tagkelas Posted June 4, 2009 Posted June 4, 2009 Lee, again this line (setq lst (cons (StrBrk nl 44) lst))) Can we make it a litlle difficult? How can we make this line with "if" function? example strbrk nl 9 (but if do not find "tab") then 44 So in dialog box i can choose either txt or xls file. -------------- Quote
Lee Mac Posted June 4, 2009 Posted June 4, 2009 Lee,again this line (setq lst (cons (StrBrk nl 44) lst))) Can we make it a litlle difficult? How can we make this line with "if" function? example strbrk nl 9 (but if do not find "tab") then 44 So in dialog box i can choose either txt or xls file. -------------- ooo Dialog Boxes... get you Check my LISP above, posted for JimJones #52. I used an IF statement in there Quote
tagkelas Posted June 5, 2009 Posted June 5, 2009 Thanks Lee Mac. I don't have much time right now to check it, but I will.... Quote
oliver Posted June 5, 2009 Posted June 5, 2009 Try this for changes to text height and obliquing (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 (cadr line) (caddr line) (cadddr line)))) (vla-put-layer (vla-AddPoint spc (vlax-3D-point pt)) "TOCKA") (Make_Text pt (last line) 0.0 "KOD" 0 2 0) ; CODE (Make_Text pt (car line) 0.0 "BROJ TOCKE" 0 0 0) ; POINT NUMBER (Make_Text pt (cadddr line) 0.0 "VISINA" 0 3 (* pi (/ 15 180.))))) ; Z VALUE (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 obl) (entmake (list (cons 0 "TEXT") (cons 8 lay) (cons 10 pt) (cons 40 1.6) (cons 1 val) (cons 50 rot) (cons 51 obl) (cons 7 (getvar "TEXTSTYLE")) (cons 71 0) (cons 72 |72) (cons 73 |73) (cons 11 pt)))) Thanks for this code Lee..works as well..now i have a little request regarding this code i just wanna ask you to removed the "Z" value see the attachment.. thank you and more power.. AA1.txt Quote
Lee Mac Posted June 5, 2009 Posted June 5, 2009 Try this Oliver: (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 (cadr line) (caddr line) "0.0"))) (vla-put-layer (vla-AddPoint spc (vlax-3D-point pt)) "TOCKA") (Make_Text pt (car line) 0.0 "BROJ TOCKE" 0 0 0))) ; POINT NUMBER (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 obl) (entmake (list (cons 0 "TEXT") (cons 8 lay) (cons 10 pt) (cons 40 1.6) (cons 1 val) (cons 50 rot) (cons 51 obl) (cons 7 (getvar "TEXTSTYLE")) (cons 71 0) (cons 72 |72) (cons 73 |73) (cons 11 pt)))) Quote
oliver Posted June 5, 2009 Posted June 5, 2009 thanks a lot Lee..its done..but just a little problem..about point style could fix and also the limits. thanks. oliver Quote
Lee Mac Posted June 5, 2009 Posted June 5, 2009 .but just a little problem..about point style could fix and also the limits. I don't understand what you are requesting here? Quote
oliver Posted June 5, 2009 Posted June 5, 2009 original display.. fix with drawing limits original point with this point style sorry for my bad english.. oliver Quote
Lee Mac Posted June 5, 2009 Posted June 5, 2009 That is just your setting of PDMODE I could add the code to the LISP, its just: (setvar "PDMODE" ) This can be added anywhere, and its just as easy for you to change it Quote
minhquang Posted December 2, 2013 Posted December 2, 2013 Dear Lee, I modified your code for my purpose. I worked fine with my previous work such as DPOINT3 DATA SAMPLE.txt But It failed with DPOINT3 DATA SAMPLE 1.txt Colud you possibly help me to rectify? Thanks, Miquan ;Draw point from txt data ;Txt data: Point ID,Point X-coord,Point Y-coord,Point Z-coord,Text ;If you want to use tab for delimite data, replace 44 by 32 in code ;http://www.cadtutor.net/forum/showthread.php?37830-Draw-polyline-from-file-coords-excel (defun c:dp3 (/ doc spc file nl lst pt) (vl-load-com) (setvar "PDMODE" 35) ; Format point number PDMODE paramater (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" "S-Notes") (vla-add (vla-get-layers doc) "S-Notes")) (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 (cadr line) (caddr line) (cadddr line)))) (vla-put-layer (vla-AddPoint spc (vlax-3D-point pt)) "S-Notes") (Make_Text pt (last line) 0.0 "S-25Text-VN" 0 2 0) ; CODE (Make_Text pt (car line) 0.0 "S-Dim" 0 0 0) ; POINT NUMBER (Make_Text pt (cadddr line) 0.0 "S-Hatch" 0 3 (* pi (/ 15 180.))))) ; Z VALUE (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 obl) (entmake (list (cons 0 "TEXT") (cons 8 lay) (cons 10 pt) (cons 40 (getvar "dimtxt")); Height of Text = height of dim text (cons 1 val) (cons 50 rot) (cons 51 obl) (cons 7 (getvar "TEXTSTYLE")) (cons 71 0) (cons 72 |72) (cons 73 |73) (cons 11 pt)))) DPOINT3 DATA SAMPLE.txt DPOINT3 DATA SAMPLE 1.txt Quote
Guest Posted December 2, 2013 Posted December 2, 2013 Try this http://www.hawsedc.com/gnu/pointsin.php Quote
Miltiadis Posted May 4, 2016 Posted May 4, 2016 Hey Lee, i tried your code and its works like a charm. I want to make a few changes to suit me, i tried but im failing everytime im trying. I want to make it simplier like POINT,X,Y Also i can you change the names of the layers back to english? Thnx in advance 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.