Jump to content

How to print a variable out in a prompt?


Wwx95

Recommended Posts

What I will select is a 3d polyline.

(defun c:coord ( / e r)
       (prompt "\nchoose a onject!")
(setq e (entget (car (entsel))))


(setq r 1)

       (setq count 0)
(while r


   (setq e (entget (entnext (cdr (car e)))))
   

   (if (/= (cdr (assoc 0 e)) "SEQEND")
   

	(progn
	

	  (terpri)
	  

	  (princ (cdr (assoc 10 e)))
	  ;print the co-ordinates
	  (setq count(1+ count))
	)

        (setq r nil)
	

   )

 	)
 (prompt "\nThere are total " );In here how to print "There are total (count ;number) vertexes in this object."  

 (princ)

);defun

(princ)

 

Do I express clear??I want to put the variable "count' in the prompt,for example,I got the count equal to 4,what I want to do is to print on the screen: "There are total 4 vertexes in this object."is that possible?Thanks.

Link to comment
Share on other sites

Have a look at the following mods:

(defun c:3dCoords  (/ i s e)
 (if (and (setq i 0 s (car (entsel "\nPick on 3Dpolyline :")))
          (member '(100 . "AcDb3dPolyline") (entget s))
          )
 (while (/= (cdr (assoc 0 (setq e (entget (setq s (entnext s)))))) "SEQEND")
       (terpri)
       (princ (cdr (assoc 10 e)))
       (setq i (1+ i))
     )      
   )
 (and (< 0 i) (princ (strcat "\nThere are total [ " (itoa i) " ] vertices in this object")))
 (princ)
)

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