Jump to content

Recommended Posts

Posted
On 6/20/2016 at 3:12 PM, Maximum GSP said:

 

 

Very nice, but i have one other question too :

 

I wish to place a specified block (with Z automatic attribute) on every selected blocks in my drawing, how can i do that ? I try to change your code, but...

And i have to do that with a separated block (with specified name), not with the attributes of all my blocks, so i can change all "texts" in one step

Hi,

Is there any way of getting the text values in the same layer of the point.

Thanks

  • Replies 26
  • Created
  • Last Reply

Top Posters In This Topic

  • halam

    6

  • Maximum GSP

    6

  • CADWORKER

    3

  • pBe

    2

Top Posters In This Topic

Posted Images

Posted
On 10/18/2012 at 2:22 PM, Lee Mac said:

Thanks pBe :thumbsup:

 

If I were to rewrite the function today, I'd probably use something like:

 

 


(defun c:zpt ( / i p s )
   (if (setq s (ssget '((0 . "POINT"))))
       (repeat (setq i (sslength s))
           (setq p (assoc 10 (entget (ssname s (setq i (1- i))))))
           (entmake
               (list
                  '(000 . "MTEXT")
                  '(100 . "AcDbEntity")
                  '(100 . "AcDbMText")
                   (cons 1 (strcat "Z = " (rtos (cadddr p))))
                   p
                )
            )
       )
   )
   (princ)
)
 

 

How to get the text on same layer of the point, I tried (assoc 8 its not working)

Posted

Try this:

(defun c:zpt (/ el i p s)
  (if (setq s (ssget '((0 . "POINT"))))
    (repeat (setq i (sslength s))
      (setq p (assoc 10 (setq el (entget (ssname s (setq i (1- i)))))))
      (entmake (list '(000 . "MTEXT")
		     '(100 . "AcDbEntity")
		     '(100 . "AcDbMText")
		     (assoc 8 el)
		     (cons 1 (strcat "Z = " (rtos (cadddr p))))
		     p
	       )
      )
    )
  )
  (princ)
)

 

Posted
1 hour ago, ronjonp said:

Try this:


(defun c:zpt (/ el i p s)
  (if (setq s (ssget '((0 . "POINT"))))
    (repeat (setq i (sslength s))
      (setq p (assoc 10 (setq el (entget (ssname s (setq i (1- i)))))))
      (entmake (list '(000 . "MTEXT")
		     '(100 . "AcDbEntity")
		     '(100 . "AcDbMText")
		     (assoc 8 el)
		     (cons 1 (strcat "Z = " (rtos (cadddr p))))
		     p
	       )
      )
    )
  )
  (princ)
)

 

Its perfect; Thanks for the help..

  • 8 months later...
Posted

Can anybody help me alter this lisp so it only displays 2 decimal places instead of 3 please

Posted

Just look for the help to rtos function.

(rtos (cadddr p) 2 2) will give decimal with two places

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