vindicate Posted March 19 Posted March 19 Hi! Can anyone knows or has a code on how to change position markers to point and the text will remain? Thanks in advance. Quote
BIGAL Posted March 19 Posted March 19 (edited) Need a dwg to see what they are, looks like Blocks not Points. Just look at properties top line. If its a block maybe be able to use Bedit to change point style, there are numbers for each style. PDMODE Edited March 19 by BIGAL Quote
vindicate Posted March 19 Author Posted March 19 (edited) 27 minutes ago, BIGAL said: Need a dwg to see what they are, looks like Blocks not Points. Just look at properties top line. If its a block maybe be able to use Bedit to change point style, there are numbers for each style. PDMODE It is not a block. It is a position marker. Here, I attach a sample for you reference. Thanks a lot sample.dwg Edited March 19 by vindicate Quote
SLW210 Posted March 19 Posted March 19 How are you making the marker a point? AFAIK, you can only scale the size, all you have to do to keep the Text the same size is scale it up accordingly. Quote
BIGAL Posted March 20 Posted March 20 A bit of googling in 2017 Autodesk said can not be changed. Who knows now. Contact Autodesk support. Quote
vindicate Posted March 20 Author Posted March 20 (edited) I think of getting the position x and y of each of the position markers and export it to csv. I used the code that was given to me before on extracting the coordinates from the position markers but I'm stuck in the "error: bad argument type: numberp: (274.153 159.462 0.0)". Can anyone help me with the code? (defun C:22 ( / doc fil sel lst hdr y ) (vl-load-com) (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) (cond ((null (setq fil (getfiled "Save CSV:" (if (= 1 (getvar 'dwgtitled)) (strcat (getvar 'dwgprefix) (vl-filename-base (getvar 'dwgname)) ) (strcat "C:\\" (vl-filename-base (getvar 'dwgname))) ) "csv" 1 ) ) ) (princ "\n*Cancel*") ) ((null (ssget '((0 . "POSITIONMARKER"))))(princ "\nInvalid Selection.")) ( t (vlax-for x (setq sel (vla-get-ActiveSelectionSet doc)) (setq lst (cons (list (vlax-get x 'Position)) lst)) ) (setq lst (mapcar '(lambda ( x ) (list (rtos (car x)))) lst)) (setq hdr (cons (list "<X>") hdr)) (LM:WriteCSV (setq lst (append hdr lst)) fil) (princ "\nPlease Wait, Opening CSV File in Excel...") (startapp "Explorer" fil) (vla-delete sel) ) ) (princ) ) sample.dwg Edited March 20 by vindicate Quote
SLW210 Posted March 20 Posted March 20 You didn't mention you were trying to use LISP. Is this even related to the original post? Quote
vindicate Posted March 20 Author Posted March 20 1 hour ago, SLW210 said: You didn't mention you were trying to use LISP. Is this even related to the original post? Sorry about that. Yes. It came to my mind that if I've got the position x and y of the position markers, I can make a script to import all the points and there I can change the position markers into a point . I only need the position x and y hehe Quote
vindicate Posted March 22 Author Posted March 22 I somehow exported the X and Y of the POSITION MARKER but only one x,y position will appear in the csv file like. Can anyone help me solve this code hihi please please please (defun C:33 ( / doc fil sel lst hdr y ) (vl-load-com) (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) (cond ((null (setq fil (getfiled "Save CSV:" (if (= 1 (getvar 'dwgtitled)) (strcat (getvar 'dwgprefix) (vl-filename-base (getvar 'dwgname)) ) (strcat "C:\\" (vl-filename-base (getvar 'dwgname))) ) "csv" 1 ) ) ) (princ "\n*Cancel*") ) ((null (ssget '((0 . "POSITIONMARKER"))))(princ "\nInvalid Selection.")) ( t (vlax-for x (setq sel (vla-get-ActiveSelectionSet doc)) (setq lst (cons (list (vla-get-TextString x)(setq y(vlax-get x 'Position))) lst)) ) (setq lst (mapcar '(lambda ( x ) (list (car x) (rtos (car y))(rtos (cadr y)))) lst)) (setq hdr (cons (list "<Text>" "<X>" "<Y>") hdr)) (LM:WriteCSV (setq lst (append hdr lst)) fil) (princ "\nPlease Wait, Opening CSV File in Excel...") (startapp "Explorer" fil) (vla-delete sel) ) ) (princ) ) sample.dwg Quote
Tsuky Posted March 22 Posted March 22 The line (setq lst (mapcar '(lambda ( x ) (list (car x) (rtos (car y))(rtos (cadr y)))) lst)) must be (setq lst (mapcar '(lambda ( x ) (list (car x) (rtos (caadr x))(rtos (cadadr x)))) lst)) 1 Quote
vindicate Posted March 22 Author Posted March 22 3 minutes ago, Tsuky said: The line (setq lst (mapcar '(lambda ( x ) (list (car x) (rtos (car y))(rtos (cadr y)))) lst)) must be (setq lst (mapcar '(lambda ( x ) (list (car x) (rtos (caadr x))(rtos (cadadr x)))) lst)) WOW! Thank you! May I know what's the difference between "car" "caadr" "cadr" and "cadadr"? Quote
Tsuky Posted March 22 Posted March 22 56 minutes ago, vindicate said: WOW! Thank you! May I know what's the difference between "car" "caadr" "cadr" and "cadadr"? Your list is (setq lst '( ("1NPT" (274.153 159.462 0.0)) ("2NPT" (289.385 162.882 0.0)) ("SP" (296.889 154.795 0.0)) ("4NPT" (270.005 143.501 0.0)) ("8NPT" (293.189 146.368 0.0)) ("9NPT" (312.465 145.292 0.0)) ("5NPT" (282.932 131.402 0.0)) ("12NPT" (272.478 120.102 0.0)) ("11NPT" (255.807 122.674 0.0)) ("10NPT" (236.431 127.388 0.0)) ("3NPT" (244.494 141.269 0.0)) ) ) When you use (mapcar '(lambda (x) ..... ) lst) x becomes each element in the list So for example for the first element x becomes ("1NPT" (274.153 159.462 0.0)) which returns for (car x), we obtain "1NPT" which is the 1st element of the list. with (cdr x) we obtain the list minus the 1st element i.e.((274.153 159.462 0.0)) car and cdr are the basis for list manipulation in lisp. with (car (cdr x)) that we can write (cadr x) we will obtain (274.153 159.462 0.0) with (car (car (cdr x))) that we can write (caadr x) we will therefore obtain 274.153 with (cdr (car (cdr x))) that we can write (cdadr x) we obtain (159.462 0.0) with (car (cdr (car (cdr x)))) that we can write (cadadr x) we obtain 159.462 The writing nesting level can only be done on 4 levels If for example you also wanted the z of the point you would have to do: (car (cdr (cdr (car (cdr x))))) that it would be necessary to write (car (cddadr x)) to obtain 0.0 1 Quote
vindicate Posted March 22 Author Posted March 22 58 minutes ago, Tsuky said: Your list is (setq lst '( ("1NPT" (274.153 159.462 0.0)) ("2NPT" (289.385 162.882 0.0)) ("SP" (296.889 154.795 0.0)) ("4NPT" (270.005 143.501 0.0)) ("8NPT" (293.189 146.368 0.0)) ("9NPT" (312.465 145.292 0.0)) ("5NPT" (282.932 131.402 0.0)) ("12NPT" (272.478 120.102 0.0)) ("11NPT" (255.807 122.674 0.0)) ("10NPT" (236.431 127.388 0.0)) ("3NPT" (244.494 141.269 0.0)) ) ) When you use (mapcar '(lambda (x) ..... ) lst) x becomes each element in the list So for example for the first element x becomes ("1NPT" (274.153 159.462 0.0)) which returns for (car x), we obtain "1NPT" which is the 1st element of the list. with (cdr x) we obtain the list minus the 1st element i.e.((274.153 159.462 0.0)) car and cdr are the basis for list manipulation in lisp. with (car (cdr x)) that we can write (cadr x) we will obtain (274.153 159.462 0.0) with (car (car (cdr x))) that we can write (caadr x) we will therefore obtain 274.153 with (cdr (car (cdr x))) that we can write (cdadr x) we obtain (159.462 0.0) with (car (cdr (car (cdr x)))) that we can write (cadadr x) we obtain 159.462 The writing nesting level can only be done on 4 levels If for example you also wanted the z of the point you would have to do: (car (cdr (cdr (car (cdr x))))) that it would be necessary to write (car (cddadr x)) to obtain 0.0 I see. Thanks! 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.