Jump to content

ttr method


kalai

Recommended Posts

i have two circles .

i can draw circle using ttr method.

(setq p1'(0 0 0))
(command "circle" p1 5)
(setq p100 '(-10.2706  8.2595 ))
(command "circle" p100 3)

 

now , using these two circles using ttr i need to draw a circle of radius 5 in lisp (not using entsel)

 

help me.

Link to comment
Share on other sites

  • Replies 20
  • Created
  • Last Reply

Top Posters In This Topic

  • kalai

    6

  • Tharwat

    4

  • BlackBox

    4

  • Lee Mac

    3

Top Posters In This Topic

Posted Images

ttr method

 

i.e, i need to draw a circle using two points (tangent to ist circle) (tangent to 2nd circle) and r for radius of circle to draw.

Link to comment
Share on other sites

i should not pick the tangent points .

 

i should get using lisp not in autocad mode

 

OK... Open the developer documentation, and begin to read for yourself how to do programmatically, what I've shown above. :)

Link to comment
Share on other sites

Perhaps ... :D

 

(command "_.circle" (setq p1 '(0. 0. 0.)) 5.)
(setq p2 (polar p1 (+ (/ pi 2.) (/ pi 4.)) 5.))
(command "_.circle" (setq p3 '(-10.2706 8.2595)) 3.)
(setq p4 (polar p3 (+ pi (+ (/ pi 2.))) 3.))
(command "_.circle" "_TTR" p2 p4 5.)

 

Tharwat

Link to comment
Share on other sites

Perhaps a picture of the geometry and known factors will help you write the lisp.

 

You have two circles at known points. If you want to draw another circle tangential to it, then the new circle is the sum of the radii away from the first circle centre point. That is p2 is (5 + 5) away from p1, and is (3 + 5) away from p100. As you know the coordinates of p1 and p100, you can find the coordinates of p2 (and of p2a). There are two circles that can be drawn.

TTRgeometry.jpg

Link to comment
Share on other sites

(command "._circle" "ttr" pause pause pause)

 

(command "_.circle" (setq p1 '(0. 0. 0.)) 5.)
(setq p2 (polar p1 (+ (/ pi 2.) (/ pi 4.)) 5.))
(command "_.circle" (setq p3 '(-10.2706 8.2595)) 3.)
(setq p4 (polar p3 (+ pi (+ (/ pi 2.))) 3.))
(command "_.circle" "_TTR" p2 p4 5.)

 

I would have thought using CAD you guys would be more interested in Geometry?

 

Here's one (more obscure) approach, using a change in coordinates:

 

(defun TTRCircle ( c1 r1 c2 r2 r3 / d1 n1 x1 z1 )
 (cond
   ( (< (+ r3 r3) (- (setq d1 (distance c1 c2)) (+ r1 r2)))
     nil
   )
   ( t
     (setq n1 (mapcar '- c2 c1)
           z1 (/ (- (+ (expt (+ r3 r1) 2) (expt d1 2)) (expt (+ r3 r2) 2)) (* 2. d1))
           x1 (sqrt (- (expt (+ r3 r1) 2) (expt z1 2)))
           c1 (trans c1 0 n1)
     )
     (list
       (trans (list (+ (car c1) x1) (cadr c1) (+ (caddr c1) z1)) n1 0)
       (trans (list (- (car c1) x1) (cadr c1) (+ (caddr c1) z1)) n1 0)
     )
   )
 )
)

Test function:

 

(defun c:test ( / p1 p2 r1 r2 r3 )
 (if
   (and
     (setq p1 (getpoint "\nCentre of First Circle: "))
     (setq r1 (getdist  "\nRadius of First Circle: " p1))
     (setq p2 (getpoint "\nCentre of Second Circle: "))
     (setq r2 (getdist  "\nRadius of Second Circle: " p2))
     (setq r3 (getdist  "\nRadius of Tangent Circle: "))
   )
   (foreach x (TTRCircle (trans p1 1 0) r1 (trans p2 1 0) r2 r3)
     (entmakex
       (list (cons 0 "CIRCLE") (cons 10 x) (cons 40 r3))
     )
   )
 )
 (princ)
)

Link to comment
Share on other sites

i have two circles .

i can draw circle using ttr method.

(setq p1'(0 0 0))
(command "circle" p1 5)
(setq p100 '(-10.2706 8.2595 ))
(command "circle" p100 3)

 

now , using these two circles using ttr i need to draw a circle of radius 5 in lisp (not using entsel)

 

help me.

 

What do you mean by ttr Method ?

 

Could you please explain the idea a little bit more .

 

???

 

(command "._circle" "ttr" pause pause pause)

 

I would have thought using CAD you guys would be more interested in Geometry?

 

Here I thought providing a solution for two requests simultaneously was being efficient... Guess I'll go focus on my interest in geometry some more. :(

Link to comment
Share on other sites

OK... Open the developer documentation, and begin to read for yourself how to do programmatically, what I've shown above. :)

 

Here I thought providing a solution for two requests simultaneously was being efficient... Guess I'll go focus on my interest in geometry some more. :(

 

Whatever. You knew what I was referring to.

 

I *believe* you know that I enjoy trying to help others very much. I was simply too busy to write a full routine for someone else this morning (thank God). *IF* that means that by not doing so, I've committed some sort of forum faux pas, then apologies.

 

After finishing my work load for the week, I was tapped to help another production team complete their submittal which is due Monday, June 20, 2011. That translated into my doing their entire project's drainage networks. I've been working OT since about 6:30 AM, that after working +50 Hrs this week ending last night around 8:00 PM (on a Friday).

 

Clearly you're offended by my reply. I was being sarcastic with you. The intention was not to offend; apologies.

Link to comment
Share on other sites

Sorry, I think you missed the point I was trying to make - I certainly wasn't expecting you to write a full routine. I was merely remarking on the fact that both you and Tharwat opted to offer the solution via a call to the Circle TTR command, as opposed to a Geometric method as suggested by Eldon in an earlier post. But your resulting 'sarcastic' comment riled me a little, hence my response. Anyway - I think we have misunderstood each other, I shall be more careful with my words in future.

Link to comment
Share on other sites

Theres numerous circle arc and line combo's and I support using geometry over autocad commands a quick net search for land surveyors formula soultions will reveal a vast wealth of solutions to common problems like this one.

 

eg parrallel lines s bend rad1 rad2 offset 4 different combo's depending on two or 3 variables given

Link to comment
Share on other sites

tharwat, hope u remember me,

 

it works fine sometimes,

sometimes iget error

".........function cancelled

specify point on object for first tangentof circle:"

 

what could be the reason.

help me,

 

regards

kalai

Link to comment
Share on other sites

tharwat, hope u remember me,

 

it works fine sometimes,

sometimes iget error

".........function cancelled

specify point on object for first tangentof circle:"

 

what could be the reason.

help me,

 

regards

kalai

 

Just use Lee's code in post No.12 because it is the right way to deal with geometry .

Link to comment
Share on other sites

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