Wwx95 Posted June 24, 2016 Share Posted June 24, 2016 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. Quote Link to comment Share on other sites More sharing options...
BKT Posted June 25, 2016 Share Posted June 25, 2016 Change your prompt code to: (prompt (strcat "\nThere are total " (itoa count) " vertices in this object")) Quote Link to comment Share on other sites More sharing options...
Grrr Posted June 25, 2016 Share Posted June 25, 2016 Alternatively: (princ "\nThere are total ") (print (itoa count)) (princ " vertices in this object.") But I usually use BKT's example. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 25, 2016 Share Posted June 25, 2016 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) ) Quote Link to comment Share on other sites More sharing options...
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.