Juergen Posted September 18, 2017 Posted September 18, 2017 Hi forum Users, I tried to rewrite the LISP-Code- "radct". (defun C:RADCT (/ rad ss count) (setq rad (getdist "\nRadius to count: ") ss (ssget (list '(0 . "CIRCLE")(cons 40 rad))) count (sslength ss) ) (alert (itoa count)) (princ) ) My condition: I have a rectangle in it are circles (diameter=9.5 mm.) I want count them an write the result as text into the drawing. The code above do this, but the result is shown in a msg box. Please Help me. Thanks a lot. Juergen Quote
BIGAL Posted September 18, 2017 Posted September 18, 2017 A slight improvement on the original code (defun C:RADCT (/ rad ss count obj) (setq obj (vlax-ename->vla-object (car (entsel "\nSelect circle to count: ")))) (if (= (vla-get-objectname obj) "AcDbCircle") (progn (setq rad (vla-get-radius obj)) (setq ss (ssget (list '(0 . "CIRCLE")(cons 40 rad)))) (if (/= (setq count (sslength ss)) 0) (alert (strcat "There are " (itoa count) " items matching")) (alert "no circles match") ) ) ) (command "Text" (getpoint) "" (itoa count)) (princ) ) Quote
Juergen Posted September 18, 2017 Author Posted September 18, 2017 Hi BIGAL, it works. Perfect. THX Quote
SLW210 Posted September 18, 2017 Posted September 18, 2017 Please read the Code Posting Guidelines and edit your Code to be included in Code Tags.[NOPARSE] Your Code Here[/NOPARSE] = Your Code Here Quote
Juergen Posted September 19, 2017 Author Posted September 19, 2017 Hi forum Users, I tried to rewrite the LISP-Code- "radct". (defun C:RADCT (/ rad ss count) (setq rad (getdist "\nRadius to count: ") ss (ssget (list '(0 . "CIRCLE")(cons 40 rad))) count (sslength ss) ) (alert (itoa count)) (princ) ) My condition: I have a rectangle in it are circles (diameter=9.5 mm.) I want count them an write the result as text into the drawing. The code above do this, but the result is shown in a msg box. Please Help me. Thanks a lot. Juergen Quote
BIGAL Posted September 19, 2017 Posted September 19, 2017 (command "Text" (getpoint) "" (itoa count)) 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.