goldy2000 Posted June 10, 2009 Share Posted June 10, 2009 Hy everyone!!! I have a problem, I draw polyline (2D) and need lisp that ''reads'' my pline and extract ''pick points'' with coordinates (X,Y in this case there is no Z coordinate), so these points must extract to new file txt/csv/xls, or just to put points on that polyline... Maybe this question is solved in the past on this forum...but didn't find it...anybody???? Quote Link to comment Share on other sites More sharing options...
ReMark Posted June 10, 2009 Share Posted June 10, 2009 Is this LISP routine what you're looking for? http://cadtips.cadalyst.com/points/export-coordinates Quote Link to comment Share on other sites More sharing options...
VVA Posted June 10, 2009 Share Posted June 10, 2009 Or look this Export of coordinates of the specified points, the chosen objects: points, blocks, polylines, splines in a text file or Excel.Text file — txt, or csv. A rounding off of coordinates according to current adjustments of a command _UNITS (LUPREC system variable) 3 commands Are certain COOR - export of coordinates COORN-export of coordinates with numbering. Numbers of points are drawn by the text on the current layer, the current style, current height (TEXTSIZE) COORT-export of coordinates with numbering where number considers the text nearest to a point Quote Link to comment Share on other sites More sharing options...
goldy2000 Posted June 10, 2009 Author Share Posted June 10, 2009 Or look this Thx for posting that, I already used that lisp, and it helped me...but is there a option when I draw pline, lisp puts dots on insertion places on that pline?? and after that I use COOR lisp and pick up all that coordinates (I need that because i need manually enter Z coord in that particular places)...THX for posting hyperlink.. Quote Link to comment Share on other sites More sharing options...
BlackAlnet Posted June 10, 2009 Share Posted June 10, 2009 Give it a shot. It save on ".csv" format, separated by "," (defun c:plex() (setq el (entget (car (entsel "\n Select the pline to extract: ")))) (setq file (open (getfiled "Output file" "" "csv" 9) "w")) (repeat (setq i (length el)) (if (= (car (setq l1 (nth (setq i (1- i)) el))) 10) (write-line (strcat (rtos (cadr l1)) "," (rtos (caddr l1))) file) ) ) (close file) (princ) ) Late.... =) Quote Link to comment Share on other sites More sharing options...
goldy2000 Posted June 10, 2009 Author Share Posted June 10, 2009 Is this LISP routine what you're looking for? http://cadtips.cadalyst.com/points/export-coordinates Hey man, I tried it, and this lisp only export points (it has only one function), VVA posted what I was looking for, THX for your time:roll: Quote Link to comment Share on other sites More sharing options...
VVA Posted June 10, 2009 Share Posted June 10, 2009 goldy2000 If I have correctly understood, command COORNP is necessary to you Quote Link to comment Share on other sites More sharing options...
goldy2000 Posted June 10, 2009 Author Share Posted June 10, 2009 goldy2000If I have correctly understood, command COORNP is necessary to you Hmmm, sounds good VVA, but can explain little bit more?? COORNP means coordinate numbering (COORN lisp helps here) and what is P meaning?? point?? or doting the exact place of polyline inflection?? hmmm... Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 10, 2009 Share Posted June 10, 2009 Are you looking to just extract the Vertex point of an LWPOLYLINE and write these to Excel? Quote Link to comment Share on other sites More sharing options...
VVA Posted June 11, 2009 Share Posted June 11, 2009 Hmmm, sounds good VVA, but can explain little bit more?? COORNP means coordinate numbering (COORN lisp helps here) and what is P meaning?? point?? or doting the exact place of polyline inflection?? hmmm... CoorNP-Coordinates + Numbers + Points Quote Link to comment Share on other sites More sharing options...
goldy2000 Posted June 12, 2009 Author Share Posted June 12, 2009 Are you looking to just extract the Vertex point of an LWPOLYLINE and write these to Excel? Yep, the lisp that VVA posted is good, but I need one modification, just to put points in drawing on vertex places (points) and point numbers (lisp does it very good)...is it possible?? Quote Link to comment Share on other sites More sharing options...
VVA Posted June 13, 2009 Share Posted June 13, 2009 Try it ;;; PoLyline and spline Mark ;;;http://www.cadtutor.net/forum/showthread.php?p=245705#post245705 (defun C:PLMark (/ ss ptLst Npt Step) (setvar "PDMODE" 35) ;_ Point Mode (defun group-by-num (lst num / ls ret) (if (= (rem (length lst) num) 0) (progn (setq ls nil) (repeat (/ (length lst) num) (repeat num (setq ls (cons (car lst) ls) lst (cdr lst) ) ) (setq ret (append ret (list (reverse ls))) ls nil ) ) ) ) ret ) (defun PLCollect (SelSet / ret) (foreach lw (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex SelSet))) ) (cond ((wcmatch (vla-get-ObjectName lw) "*Polyline") (setq ret (append ret (group-by-num (vlax-get lw 'Coordinates) (if (= (vla-get-ObjectName lw) "AcDbPolyline") 2 3 ) ) ) ) ) ((= (vla-get-ObjectName lw) "AcDbSpline") (setq ret (append ret (group-by-num (vlax-safearray->list (vlax-variant-value (vla-get-controlpoints lw)) ) 3 ) ) ) ) (t nil) ) ) ret ) (defun text-entmake (txt pnt height rotation justification / ent_list) (setq ent_list (list '(0 . "TEXT") '(100 . "AcDbEntity") '(100 . "AcDbText") (list 10 (car pnt) (cadr pnt) 0.0) (cons 1 txt) (cons 40 height) (cons 7 (getvar "TEXTSTYLE")) (if justification (cond ((= justification "C") '(72 . 1) ) ((= justification "R") '(72 . 2) ) ((= justification "A") '(72 . 3) ) ((= justification "M") '(72 . 4) ) ((= justification "F") '(72 . 5) ) (t '(72 . 0) ) ) ;_ end of cond '(72 . 0) ) ;_ end of if (cons 50 rotation) (list 11 (car pnt) (cadr pnt) 0.0) ) ;_ end of list ) ;_ end of setq (setq ent_list (entmakex ent_list)) ) (vl-load-com) (if (not (setq ss (ssget "_I" '((0 . "*POLYLINE,SPLINE"))))) (progn (princ "\nSelect polyline and press Enter ") (setq ss (ssget '((0 . "*POLYLINE,SPLINE")))) ) ) (if ss (setq ptLst (PLCollect ss)) ) (if (and ss (setq ptLst (PLCollect ss))) (progn (setq Npt (getint "\nStart number of points <Don't mark> : ") ) (setq Step 1) (if (numberp Npt) (progn (princ "\nIncrement of number") (if (not (numberp ptcol:Step)) (setq ptcol:Step 1) ) (princ " <")(princ ptcol:Step) (princ ">: ")(setq Step (getint)) (if (null Step)(setq Step ptcol:Step)) (setq ptcol:Step Step Npt (* Npt 1.0) ) ) ) (foreach pt ptLst (if (numberp Npt) (progn (text-entmake (rtos Npt 2 0) ;_ Number (polar pt (* pi 0.25) 1.) ;_Point (getvar "TEXTSIZE") ;_Text Height 0 ;_Angle of rotation nil ;_Left justification ) (setq Npt (+ Npt Step)) ) ) (entmakex (list (cons 0 "POINT") (cons 10 pt))) ) ) ) (princ) ) PS. After use PLMARK it is possible to use COORT for export of numbers and co-ordinates of points Quote Link to comment Share on other sites More sharing options...
goldy2000 Posted June 14, 2009 Author Share Posted June 14, 2009 Thx VVA for the code, that is what I was looking for!! Can you make modification for point numbers to be situated (linked) to dot (point) place?? THX one more time for your cooperation and free time to make this lisp... And I was thinking something, is it possible to make 3D points, so it will have Z coord?? Quote Link to comment Share on other sites More sharing options...
VVA Posted June 14, 2009 Share Posted June 14, 2009 If I have correctly understood, ;;; PoLyline and spline Mark ;;;http://www.cadtutor.net/forum/showthread.php?p=245705#post245705 (defun C:PLMark (/ ss ptLst Npt Step) (setvar "PDMODE" 35) ;_ Point Mode (defun group-by-num (lst num / ls ret) (if (= (rem (length lst) num) 0) (progn (setq ls nil) (repeat (/ (length lst) num) (repeat num (setq ls (cons (car lst) ls) lst (cdr lst) ) ) (setq ret (append ret (list (reverse ls))) ls nil)))) ret) (defun PLCollect (SelSet / ret) (foreach lw (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex SelSet))) ) (cond ((wcmatch (vla-get-ObjectName lw) "*Polyline") (setq ret (append ret (group-by-num (vlax-get lw 'Coordinates) (if (= (vla-get-ObjectName lw) "AcDbPolyline") 2 3))))) ((= (vla-get-ObjectName lw) "AcDbSpline") (setq ret (append ret (group-by-num (vlax-safearray->list (vlax-variant-value (vla-get-controlpoints lw)) ) 3)))) (t nil))) ret ) (defun text-entmake (txt pnt height rotation justification / ent_list) (setq ent_list (list '(0 . "TEXT") '(100 . "AcDbEntity") '(100 . "AcDbText") (list 10 (car pnt) (cadr pnt) 0.0) (cons 1 txt) (cons 40 height) (cons 7 (getvar "TEXTSTYLE")) (if justification (cond ((= justification "C")'(72 . 1)) ((= justification "R")'(72 . 2)) ((= justification "A")'(72 . 3)) ((= justification "M")'(72 . 4)) ((= justification "F")'(72 . 5)) (t '(72 . 0)) ) ;_ end of cond '(72 . 0) ) ;_ end of if (cons 50 rotation) (list 11 (car pnt) (cadr pnt) 0.0) ) ;_ end of list ) ;_ end of setq (setq ent_list (entmakex ent_list))) (vl-load-com) (if (not (setq ss (ssget "_I" '((0 . "*POLYLINE,SPLINE"))))) (progn (princ "\nSelect polyline and press Enter ") (setq ss (ssget '((0 . "*POLYLINE,SPLINE")))) ) ) (if ss (setq ptLst (PLCollect ss))) (if (and ss (setq ptLst (PLCollect ss))) (progn (setq Npt (getint "\nStart number of points <Don't mark> : ")) (setq Step 1) (if (numberp Npt) (progn (princ "\nIncrement of number") (if (not (numberp ptcol:Step)) (setq ptcol:Step 1) ) (princ " <")(princ ptcol:Step)(princ ">: ") (setq Step (getint)) (if (null Step)(setq Step ptcol:Step)) (setq ptcol:Step Step Npt (* Npt 1.0)) ) ) (foreach pt ptLst (if (numberp Npt) (progn (text-entmake (rtos Npt 2 0) ;_ Number [color="Red"]pt ;_was (polar pt (* pi 0.25) 1.) ;_Point[/color] (getvar "TEXTSIZE") ;_Text Height 0 ;_Angle of rotation nil ;_Left justification ) (setq Npt (+ Npt Step)) ) ) (entmakex (list (cons 0 "POINT") (cons 10 pt))) ) ) ) (princ) ) And I was thinking something, is it possible to make 3D points, so it will have Z coord?? Certainly, but where to take co-ordinate Z? Quote Link to comment Share on other sites More sharing options...
goldy2000 Posted June 15, 2009 Author Share Posted June 15, 2009 Yep, sorry, I was looking on 3D pline that I draw.., THX for lisp, hope it will help to others!! Quote Link to comment Share on other sites More sharing options...
vitaminm Posted April 24, 2012 Share Posted April 24, 2012 Mr. Blackalnet yr list plex is good, but it only check for 1 (single) polyline, do you have a list of can check multililine (many lines) and including the 2D polyline too. Thank you! Quote Link to comment Share on other sites More sharing options...
vitaminm Posted April 24, 2012 Share Posted April 24, 2012 Dear Mr. VVA your lisp is jz great for me, but can you give me a lisp with export to Excel with your lines, numubering with x&y coordiante together. Thank you very much! Quote Link to comment Share on other sites More sharing options...
vitaminm Posted April 24, 2012 Share Posted April 24, 2012 Mr. VVA how to make your plmark text smaller? cause i need to manually change it everytime after run your lisp. and can you improve it with differnt line with different colour numbering? Thank you. Quote Link to comment Share on other sites More sharing options...
VVA Posted April 25, 2012 Share Posted April 25, 2012 Dear Mr. VVA your lisp is jz great for me, but can you give me a lisp with export to Excel with your lines, numubering with x&y coordiante together. Thank you very much! Try EcooE rev.6 Mr. VVA how to make your plmark text smaller? cause i need to manually change it everytime after run your lisp. Found (getvar "TEXTSIZE") ;_Text Height or type TEXTSIZE in command line and set the height of the text which you wish ... and can you improve it with differnt line with different colour numbering? I did not understand the meaning of this Quote Link to comment Share on other sites More sharing options...
vitaminm Posted June 9, 2012 Share Posted June 9, 2012 Try EcooE rev.6 Found (getvar "TEXTSIZE") ;_Text Height or type TEXTSIZE in command line and set the height of the text which you wish I did not understand the meaning of this Thank for your reply Mr. VVA, "and can you improve it with differnt line with different colour numbering? " I mean or what I want is, the output of the vertices instead of now all combine together, and i want it to be seperated. I mean that one entity say a polyline have 3 vertice (point (x,x,z) have 4 data without Z, or 6 data with Z). and be seperate by this polyline entity. The next entity say have 2 vertices, then list out the and seperate by this entity and list out vertice data. and next entity list out the entity itself and vertices data, so on .... thank you in advance. Quote Link to comment Share on other sites More sharing options...
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.