goldy2000 Posted June 30, 2009 Posted June 30, 2009 Hello people!!! I received LISP from this forum, I need just one extended version of it, that is to put question from what point I want to be numerated, can someone help with that??? And is it possible to add way of numerating, from (-) minus X axis to (+)plus is now, but can it be on other side, from + to - ?? The dialog could be like this: 1. select points 2. start from what point? 3. direction of numerating in X or Y axis (put + if want to go from (-) to (+) or put - if want to go from (+) to (-)) 4. export coordinates to txt/xls file This attached lisp creates Lee Mac couple weeks ago. Or just only to make from what point to start numbering, because think this would be very complicated. ptSort.lsp Quote
Lee Mac Posted June 30, 2009 Posted June 30, 2009 Try this Goldy: (defun c:ptSort (/ dp ss file tmp tmp2) (setq dp 2) ;; <<---<< Decimal Precision (vl-load-com) (or sort:def (setq sort:def "X")) (or dir:def (setq dir:def "+")) (if (and (setq ss (ssget '((0 . "POINT")))) (setq file (getfiled "Select File to Write" "" "txt" 9))) (progn (setq cnt 1.) (initget "X Y") (setq tmp (getkword (strcat "\nSpecify Coord to Sort by [X/Y] <" sort:def "> : "))) (or (not tmp) (setq sort:def tmp)) (initget "+ -") (setq tmp2 (getkword (strcat "\nSpecify Direction to Sort [+/-] <" dir:def "> : "))) (or (not tmp2) (setq dir:def tmp2)) (setq file (open file "w")) (foreach pt (vl-sort (mapcar (function (lambda (x) (cdr (assoc 10 (entget x))))) (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))) (function (lambda (x1 x2) ((if (eq dir:def "+") < >) ((if (eq sort:def "X") car cadr) x1) ((if (eq sort:def "X") car cadr) x2))))) (Make_Text pt (rtos cnt 2 0) 0.0) (write-line (strcat (rtos cnt 2 0) (chr 32) (rtos (car pt) 2 dp) (chr 32) (rtos (cadr pt) 2 dp) (chr 32) (rtos (caddr pt) 2 dp)) file) (setq cnt (1+ cnt))) (close file))) (princ)) (defun Make_Text (pt val rot) (entmake (list (cons 0 "TEXT") (cons 8 "PTSORT") (cons 62 2) (cons 10 pt) (cons 40 (getvar "TEXTSIZE")) (cons 1 val) (cons 50 rot) (cons 7 (getvar "TEXTSTYLE")) (cons 71 0) (cons 72 1) (cons 73 2) (cons 11 pt)))) Quote
goldy2000 Posted June 30, 2009 Author Posted June 30, 2009 Thanks Lee Mac that is what I was needed, can you make only one thing; to make a query from what point to start numbering, is it complicated?? I will put this lisp in ARCHIVE in this forum, hope that will help many people who works LAND SURVEYING... Quote
Lee Mac Posted June 30, 2009 Posted June 30, 2009 Thanks Lee Mac that is what I was needed, can you make only one thing; to make a query from what point to start numbering, is it complicated?? I will put this lisp in ARCHIVE in this forum, hope that will help many people who works LAND SURVEYING... It shouldn't be too complicated. I'll see. Quote
goldy2000 Posted June 30, 2009 Author Posted June 30, 2009 It shouldn't be too complicated. I'll see. Ok, thx for your time!!! Quote
Lee Mac Posted June 30, 2009 Posted June 30, 2009 I have made the original point collection automatic, let me know if you want that changed. (defun c:ptSort (/ dp ss file tmp tmp2) (setq dp 2) ;; <<---<< Decimal Precision (vl-load-com) (or sort:def (setq sort:def "X")) (or dir:def (setq dir:def "+")) (if (and (setq ss (ssget "_X" '((0 . "POINT")))) (setq file (getfiled "Select File to Write" "" "txt" 9)) (setq ent (car (entsel "\nSelect Point to Start From: ")))) (progn (setq cnt 1.) (initget "X Y") (setq tmp (getkword (strcat "\nSpecify Coord to Sort by [X/Y] <" sort:def "> : "))) (or (not tmp) (setq sort:def tmp)) (initget "+ -") (setq tmp2 (getkword (strcat "\nSpecify Direction to Sort [+/-] <" dir:def "> : "))) (or (not tmp2) (setq dir:def tmp2)) (setq file (open file "w")) (foreach pt (vl-remove-if (function (lambda (x) ((if (eq dir:def "+") < >) ((if (eq sort:def "X") car cadr) x) ((if (eq sort:def "X") car cadr) (cdr (assoc 10 (entget ent))))))) (vl-sort (mapcar (function (lambda (x) (cdr (assoc 10 (entget x))))) (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))) (function (lambda (x1 x2) ((if (eq dir:def "+") < >) ((if (eq sort:def "X") car cadr) x1) ((if (eq sort:def "X") car cadr) x2)))))) (Make_Text pt (rtos cnt 2 0) 0.0) (write-line (strcat (rtos cnt 2 0) (chr 32) (rtos (car pt) 2 dp) (chr 32) (rtos (cadr pt) 2 dp) (chr 32) (rtos (caddr pt) 2 dp)) file) (setq cnt (1+ cnt))) (close file))) (princ)) (defun Make_Text (pt val rot) (entmake (list (cons 0 "TEXT") (cons 8 "PTSORT") (cons 62 2) (cons 10 pt) (cons 40 (getvar "TEXTSIZE")) (cons 1 val) (cons 50 rot) (cons 7 (getvar "TEXTSTYLE")) (cons 71 0) (cons 72 1) (cons 73 2) (cons 11 pt)))) Quote
nghiahuu Posted July 1, 2009 Posted July 1, 2009 A question from what block I want to be numerated, can someone help with that??? And is it possible to add way of numerating, from (-) minus X axis to (+)plus is now, but can it be on other side, from + to - ?? The dialog could be like this: 1. select blocks 2. start from what block? 3. direction of numerating in X or Y axis (put + if want to go from (-) to (+) or put - if want to go from (+) to (-)) 4. export coordinates to txt/xls file block.dwg Quote
goldy2000 Posted July 1, 2009 Author Posted July 1, 2009 I have made the original point collection automatic, let me know if you want that changed. Hey man, thx for LISP, but can you change 1. question? In your first lisp was good query, to select objects (points), and after that to ask from what POINT NUMBER to start numbering?? This is example from your first lisp: 1. Select objects 2. Save to txt/xls file (could be just txt, no problem, no matter) 3. Specify Coord to Sort by [X/Y] 4. Specify Direction to Sort [+/-] 5. Starting from what POINT number? This is only example how it should look like if it isn't complicated, you know better how to do that...o:)The first lisp that you sent me was like this, only thing that needs to be repaired is to put question: Starting from what POINT number? Hope to hear from you soon... The problem is like that because my polyline (30km) isn't going in one direction, it goes in every direction, and it is not problem to do numbering piece by piece... Quote
Lee Mac Posted July 1, 2009 Posted July 1, 2009 Hey man, thx for LISP, but can you change 1. question? In your first lisp was good query, to select objects (points), and after that to ask from what POINT NUMBER to start numbering??This is example from your first lisp: 1. Select objects 2. Save to txt/xls file (could be just txt, no problem, no matter) 3. Specify Coord to Sort by [X/Y] 4. Specify Direction to Sort [+/-] 5. Starting from what POINT number? This is only example how it should look like if it isn't complicated, you know better how to do that...o:)The first lisp that you sent me was like this, only thing that needs to be repaired is to put question: Starting from what POINT number? Hope to hear from you soon... The problem is like that because my polyline (30km) isn't going in one direction, it goes in every direction, and it is not problem to do numbering piece by piece... Ahh, I see now - I think I mis-understood you first request, yes, the number can be changed Quote
Lee Mac Posted July 1, 2009 Posted July 1, 2009 Like this? (defun c:ptSort (/ dp ss file tmp tmp2 tmp3) (setq dp 2) ;; <<---<< Decimal Precision (vl-load-com) (or sort:def (setq sort:def "X")) (or dir:def (setq dir:def "+")) (or strt:num (setq strt:num 1.)) (if (and (setq ss (ssget '((0 . "POINT")))) (setq file (getfiled "Select File to Write" "" "txt" 9))) (progn (initget "X Y") (setq tmp (getkword (strcat "\nSpecify Coord to Sort by [X/Y] <" sort:def "> : "))) (or (not tmp) (setq sort:def tmp)) (initget "+ -") (setq tmp2 (getkword (strcat "\nSpecify Direction to Sort [+/-] <" dir:def "> : "))) (or (not tmp2) (setq dir:def tmp2)) (setq tmp3 (getint (strcat "\nSpecify Starting Number <" (rtos strt:num 2 0) "> : "))) (or (not tmp3) (setq strt:num tmp3)) (setq file (open file "w")) (foreach pt (vl-sort (mapcar (function (lambda (x) (cdr (assoc 10 (entget x))))) (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))) (function (lambda (x1 x2) ((if (eq dir:def "+") < >) ((if (eq sort:def "X") car cadr) x1) ((if (eq sort:def "X") car cadr) x2))))) (Make_Text pt (rtos strt:num 2 0) 0.0) (write-line (strcat (rtos strt:num 2 0) (chr 32) (rtos (car pt) 2 dp) (chr 32) (rtos (cadr pt) 2 dp) (chr 32) (rtos (caddr pt) 2 dp)) file) (setq strt:num (+ 1. strt:num))) (close file))) (princ)) (defun Make_Text (pt val rot) (entmake (list (cons 0 "TEXT") (cons 8 "PTSORT") (cons 62 2) (cons 10 pt) (cons 40 (getvar "TEXTSIZE")) (cons 1 val) (cons 50 rot) (cons 7 (getvar "TEXTSTYLE")) (cons 71 0) (cons 72 1) (cons 73 2) (cons 11 pt)))) Quote
goldy2000 Posted July 1, 2009 Author Posted July 1, 2009 Hey man, GOLD MEDAL for you !!!! Works perfectly, directly as I wanted!! THX once more, this goes to ARCHIVE in this forum, hope that will help to others!!!! Quote
Lee Mac Posted July 1, 2009 Posted July 1, 2009 Hey man, GOLD MEDAL for you !!!! Works perfectly, directly as I wanted!! THX once more, this goes to ARCHIVE in this forum, hope that will help to others!!!! Happy to help Goldy Lee Quote
asos2000 Posted February 15, 2014 Posted February 15, 2014 Each subject im seaching for I have to fine LEE MAC fingerprint on it. Thanks LEE 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.