get points around circle

get points around circle

rpajounia
Advocate Advocate
1,167 Views
4 Replies
Message 1 of 5

get points around circle

rpajounia
Advocate
Advocate

is there a way i can get all the points around the circle for example  p1 and p2 are 1 distance apart and then p2 and p3 will be 1 distance apart

0 Likes
Accepted solutions (1)
1,168 Views
4 Replies
Replies (4)
Message 2 of 5

-didier-
Advisor
Advisor

Bonjour @rpajounia 

 

Here is a very simple solution with an LSP file.

You have to click the circle, the point on the circle to define the start of the distance and the desired distance.

A small circle will be drawn at the given distance from the starting point counterclockwise.

This is a very simple first version to understand your request, I can work to improve it...

The point for the start of distance must be on the circle, I have not done a snag test

Amicalement

(defun c:disc ( / dis ent pt pt2)
    (setq ent (car (entsel"\nCircle ?\n")))
    (setq pt (getpoint "\nStart point for distance ?\n"))
    (setq dis (getreal "\nDistance for desired point\n"))
    (setq pt2 (vlax-curve-getpointatdist ent
              (+ dis (vlax-curve-getdistatpoint ent pt))))
    (command "_circle" pt2 0.1)
    )

 

 

Éternel débutant.. my site for learning : Programmer dans AutoCAD

DA

EESignature

0 Likes
Message 3 of 5

Kent1Cooper
Consultant
Consultant

By "get all the points" do you mean you want to save the coordinate lists of all the locations, or do you want to put Point objects along the Circle at regular spacings?  If the latter, MEASURE will do that for you.

Kent Cooper, AIA
0 Likes
Message 4 of 5

calderg1000
Mentor
Mentor
Accepted solution

Regards @rpajounia 

Try this code, it inserts circles from a starting point in a constant measure for all the sections. With the option to choose the clockwise or counterclockwise insertion direction.

(defun c:test (/ s sn l r ds n i dsp opc f p)
  (setq s  (ssget "_+.:E:S" '((0 . "circle")))
        sn (vlax-ename->vla-object (ssname s 0))
        l  (vlax-get sn 'circumference)
        r  (vlax-get sn 'radius)
  )
  (setq ds (getreal "\nEnter distance to measure:")
        n  (fix (/ l ds))
        i  1
  )
  (setq dsp (vlax-curve-getdistatpoint sn (getpoint "\nPick Point Start:")))
  (initget "W C")
  (setq opc (getkword "\nClockwise/Counter-clock wise: [W/C] <W>:"))
  (if (= opc "W")
    (setq f '-)
    (setq f '+)
  )
  (repeat n
    (setq p (vlax-curve-getpointatdist sn (apply f (list dsp (* i ds)))))
    (entmake
      (list '(0 . "circle")
            (cons 10 p)
            (cons 40 (/ r 100.))
      )
    )
    (setq i (1+ i))
  )
  )

,  


Carlos Calderon G
EESignature
>Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

0 Likes
Message 5 of 5

rpajounia
Advocate
Advocate

perfect thank you soo much

0 Likes