Jump to content

How to change Position Markers to Point


vindicate

Recommended Posts

Hi! Can anyone knows or has a code on how to change position markers to point and the text will remain? Thanks in advance. 

image.png

Link to comment
Share on other sites

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 

 

image.png.d6ea6d5238133a8bf1f4159aaf0c8511.png

Edited by BIGAL
Link to comment
Share on other sites

Posted (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 

 

image.png.d6ea6d5238133a8bf1f4159aaf0c8511.png

It is not a block. It is a position marker. Here, I attach a sample for you reference. Thanks a lot

sample.dwg

Edited by vindicate
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

A bit of googling in 2017 Autodesk said can not be changed. Who knows now. Contact Autodesk support.

Link to comment
Share on other sites

Posted (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 by vindicate
Link to comment
Share on other sites

You didn't mention you were trying to use LISP.

 

Is this even related to the original post?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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)

)

 

image.png

image.png

sample.dwg

Link to comment
Share on other sites

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))

 

  • Thanks 1
Link to comment
Share on other sites

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"?

Link to comment
Share on other sites

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

  • Thanks 1
Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...