kalai Posted June 18, 2011 Share Posted June 18, 2011 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. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 18, 2011 Share Posted June 18, 2011 What do you mean by ttr Method ? Could you please explain the idea a little bit more . Quote Link to comment Share on other sites More sharing options...
kalai Posted June 18, 2011 Author Share Posted June 18, 2011 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. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted June 18, 2011 Share Posted June 18, 2011 ??? (command "._circle" "ttr" pause pause pause) Quote Link to comment Share on other sites More sharing options...
kalai Posted June 18, 2011 Author Share Posted June 18, 2011 i should not pick the tangent points . Quote Link to comment Share on other sites More sharing options...
kalai Posted June 18, 2011 Author Share Posted June 18, 2011 i should get using lisp not in autocad mode Quote Link to comment Share on other sites More sharing options...
BlackBox Posted June 18, 2011 Share Posted June 18, 2011 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. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 18, 2011 Share Posted June 18, 2011 Perhaps ... (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 Quote Link to comment Share on other sites More sharing options...
eldon Posted June 18, 2011 Share Posted June 18, 2011 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. Quote Link to comment Share on other sites More sharing options...
kalai Posted June 18, 2011 Author Share Posted June 18, 2011 Thanks ,it works fine thank you Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 18, 2011 Share Posted June 18, 2011 Thanks ,it works finethank you You're welcome kalai . Tharwat Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 18, 2011 Share Posted June 18, 2011 (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) ) Quote Link to comment Share on other sites More sharing options...
SEANT Posted June 18, 2011 Share Posted June 18, 2011 (edited) Algebraic/Mathematical method for determining centers of tangent circles. TanCircles.zip Edited June 21, 2011 by SEANT Quote Link to comment Share on other sites More sharing options...
BlackBox Posted June 18, 2011 Share Posted June 18, 2011 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. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 18, 2011 Share Posted June 18, 2011 Whatever. You knew what I was referring to. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted June 18, 2011 Share Posted June 18, 2011 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. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 18, 2011 Share Posted June 18, 2011 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. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted June 19, 2011 Share Posted June 19, 2011 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 Quote Link to comment Share on other sites More sharing options...
kalai Posted June 21, 2011 Author Share Posted June 21, 2011 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 Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 21, 2011 Share Posted June 21, 2011 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 . Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.