Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Lisp that counts the # of 5" rad Circles found in a drawing

0 views
Skip to first unread message

shish

unread,
Jan 21, 2002, 10:19:41 AM1/21/02
to
I am trying to make a lisp that cound the about of circles found in a
drawing with a certain radius (variable). Can someone help me get started
on such a lisp. Thanks.


git

unread,
Jan 21, 2002, 10:55:08 AM1/21/02
to
On Mon, 21 Jan 2002 10:19:41 -0500, "shish" <shish_does...@hotmail.com>
wrote:

>I am trying to make a lisp that cound the about of circles found in a
>drawing with a certain radius (variable). Can someone help me get started
>on such a lisp. Thanks.

nope ... but if it's not intended to form part of a longer lisp program ... you
can simply use the filter and list commands to count them ...

colinfindlay

Dave Jones

unread,
Jan 21, 2002, 10:57:23 AM1/21/02
to
It's already done for you...just use a FILTER
--
Dave
"shish" <shish_does...@hotmail.com> wrote in message
news:arW28.693$6D1....@newscontent-01.sprint.ca...

Tom Berger

unread,
Jan 21, 2002, 11:00:45 AM1/21/02
to
shish schrieb:

>
> I am trying to make a lisp that cound the about of circles found in a
> drawing with a certain radius (variable). Can someone help me get started
> on such a lisp. Thanks.

(ssget "X" '((0 . "CIRCLE") (40 . 5))) ;;; (DXF code for radius is 40,
isn't it?)

Tom Berger


--
ArchTools: Software-Werkzeuge für die Architektur
ArchDIM - architekturgerechte Bemaßung für AutoCAD (TM)
ArchAREA - Flächenermittlung und Raumbuch nach DIN 277
Info und Demo unter http://www.archtools.de

shish

unread,
Jan 21, 2002, 11:18:18 AM1/21/02
to
Thanks that almost what I wanted. This will help me get started.
Now I just have to figure out how to this with a variable radius, that would
be inputted by the user.


"Tom Berger" <ber...@archtools.de> wrote in message
news:3C4C3B2D...@archtools.de...

shish

unread,
Jan 21, 2002, 11:37:05 AM1/21/02
to
Filer command works good but too slow, for what I am doing.

I need a list for a repetitive task that I often do. I need to make a
lisp that will allow me to pick a variable radius.
"Dave Jones" <da...@ddptrinidad.com> wrote in message
news:u4oeodn...@corp.supernews.com...

Paul Turvill

unread,
Jan 21, 2002, 11:52:58 AM1/21/02
to
(setq rad (getdist "\Radius to find: ")
ss (ssget "X" (list '(0 . "CIRCLE")(cons 40 rad)))
)
___

"shish" <shish_does...@hotmail.com> wrote in message

news:ciX28.704$6D1....@newscontent-01.sprint.ca...

Tom Berger

unread,
Jan 21, 2002, 11:50:37 AM1/21/02
to
shish schrieb:

>
> Thanks that almost what I wanted. This will help me get started.
> Now I just have to figure out how to this with a variable radius, that would
> be inputted by the user.

(setq radius 5.0)


(ssget "X" (list
'(0 . "CIRCLE")

(cons 40 radius)
))

You can even filter for radiusses greater than A and smaller than B with
special boolean filter-dxf-codes. Your online help will tell you more
...

Paul Turvill

unread,
Jan 21, 2002, 12:02:27 PM1/21/02
to
(defun C:RADCT (/ rad ss count)
(setq rad (getdist "\nRadius to count: ")
ss (ssget "X" (list '(0 . "CIRCLE")(cons 40 rad)))
count (sslength ss)
)
(alert (strcat (itoa count) " " (rtos rad) " radius circles found."))
(princ)
)
___

"shish" <shish_does...@hotmail.com> wrote in message

news:TzX28.711$6D1....@newscontent-01.sprint.ca...

shish

unread,
Jan 21, 2002, 12:24:05 PM1/21/02
to
Would it be a lot harder to make this lisp select these circles in a
selected area of a drawing.

"Tom Berger" <ber...@archtools.de> wrote in message

news:3C4C46DD...@archtools.de...

Tom Berger

unread,
Jan 21, 2002, 12:42:55 PM1/21/02
to
shish schrieb:

> Would it be a lot harder to make this lisp select these circles in a
> selected area of a drawing.

Simply remove "X" from the code. Then you get the famous "select
objects: " prompt which allows you to select via window, crossing,
previous etc ...

shish

unread,
Jan 21, 2002, 12:46:11 PM1/21/02
to

"Tom Berger" <ber...@archtools.de> wrote in message

news:3C4C531F...@archtools.de...

shish

unread,
Jan 21, 2002, 1:05:56 PM1/21/02
to
Why does this lisp work great with (ssget "X" )
but if I try to use crossing (ssget "C") it gives me an error?


(defun C:ttff (/ )
(while (not (setq frst (entsel "\nPick a First circle: "))))
(setq radc (cdr (assoc 40 (entget (entlast)))))
(setq ss (ssget "C" (list '(0 . "CIRCLE")(cons 40 radc)))
count (sslength ss)
)(setq diac (* 2 radc))
(alert (strcat (itoa count) " Circles found @ " (rtos diac) "Dia"))
(princ)
)


"Paul Turvill" <nos...@turvill.com> wrote in message
news:u4ohrob...@corp.supernews.com...

Tom Berger

unread,
Jan 21, 2002, 1:48:11 PM1/21/02
to
shish schrieb:

>
> Why does this lisp work great with (ssget "X" )
> but if I try to use crossing (ssget "C") it gives me an error?

SSGET is missing the coordinates of your crossing window.

Try: (ssget "c" pt1 pt2 '((0 . "CIRCLE")))

Aaron Lance

unread,
Jan 24, 2002, 12:36:56 PM1/24/02
to
"shish" <shish_does...@hotmail.com> wrote in message
news:cTY28.723$6D1....@newscontent-01.sprint.ca...

If you specify the Crossing "C", you have to specify the corner points of
the crossing window. If you want the user to pick them, then just leave it
out.

You also need to use the circle you picked in your code, not the last one
drawn. You should also localize variables, and check your input.

Here's some updated code:

(defun C:ttff ( / frst radc ss diac)


(while (not (setq frst (entsel "\nPick a First circle: "))))

(if frst
(setq radc (cdr (assoc 40 (car frst)))) ; USE THE RAD OF THE SELECTED
CIRCLE
(setq ss (ssget (list '(0 . "CIRCLE")(cons 40 radc)))
count (sslength ss)
)
(setq diac (* 2.0 radc))
(alert (strcat (itoa count) " Circles found at " (rtos diac) "
Dia"))
) )
(princ)
)


There are a few other errors, for example, it will crash if someone picks a
line or block. I'll leave those as an exercise for the student...

- Aaron

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 80,000 Newsgroups - 16 Different Servers! =-----

0 new messages