TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: viva on September 18, 2006, 02:10:44 AM

Title: regarding capturing circle
Post by: viva on September 18, 2006, 02:10:44 AM
hi  to all,
               iam having polylines. in the starting point point of the polyline , i had the circle. now i want 2 capture the circle. can anyone help me reagrding this issue
by using these, i had capture the starting point of the polyline.
(setq stp (vlax-curve-getstartpoint (vlax-ename->vla-object rname)))
then
for capturing the circle, i had tried this code, but it is not working,

(setq mdn(ssget "c" stp stp(list(cons 0 "circle"))) )



thanks in advance

regards
vivek
Title: Re: regarding capturing circle
Post by: whdjr on September 18, 2006, 08:23:33 AM
A circle does not have a start and end point.  It has a centerpoint, diameter, radius, circumference,... which will allow you obtain the length if that is what is desired.
Title: Re: regarding capturing circle
Post by: CAB on September 18, 2006, 12:42:57 PM
If the center point of the circle & the start point of the plines are the same this will get them.
Code: [Select]
(setq mdn (ssget "x" (list '(0 . "circle") (append '(10) stp))) )
Title: Re: regarding capturing circle
Post by: CAB on September 18, 2006, 01:05:48 PM
If you need some wiggle room try this: [ignoring the z]
Code: [Select]
(setq wiggle 0.05)
(setq mdn (ssget "x" (list '(0 . "circle")
                            '(-4 . ">,*,*") (list 10 (- (car stp) wiggle) 0 0)
                            '(-4 . "<,*,*") (list 10 (+ (car stp) wiggle) 0 0)
                            '(-4 . "*,>,*") (list 10 0 (- (cadr stp) wiggle) 0)
                            '(-4 . "*,<,*") (list 10 0 (+ (cadr stp) wiggle) 0)
                            ) )
      )

Reads like this:
Code: [Select]
(if (and (> (center x) (- (pt x) wiggle))
         (< (center x) (+ (pt x) wiggle))
         (> (center y) (- (pt y) wiggle))
         (< (center y) (+ (pt y) wiggle))
    )
    ;;  We have a match
 )
Title: Re: regarding capturing circle
Post by: viva on September 19, 2006, 01:56:44 AM
hi whdjr & cab,
                       thanks for ur reply. i got the solution  by using
(ssget "_x"(list(cons 0 "circle")(cons 10 stp)
here stp is the starting poing of polyline

regards
vivek