Jump to content

Recommended Posts

Posted

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

Posted

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

Posted

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

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