Dynamic circle tan tan radius

Dynamic circle tan tan radius

dani_cs
Advocate Advocate
1,122 Views
10 Replies
Message 1 of 11

Dynamic circle tan tan radius

dani_cs
Advocate
Advocate

Hello all,

 

Do you know a lisp to make a TTR circle dynamically? I am attaching a gif example (from lee-mac web page) of what I mean with dynamically.

 

Thanks in advance

0 Likes
Accepted solutions (1)
1,123 Views
10 Replies
Replies (10)
Message 2 of 11

Kent1Cooper
Consultant
Consultant

If you're willing to have it work only with straight things-to-be-tangent-to, I can sort of start to imagine a way to go about it.  Is that an acceptable limitation?

Kent Cooper, AIA
0 Likes
Message 3 of 11

john.uhden
Mentor
Mentor

@dani_cs ,

I must be misunderstanding something.

By your little video, you already have a widget to do what you want.  Why do you need another?

John F. Uhden

0 Likes
Message 4 of 11

komondormrex
Mentor
Mentor

autocad subcommand for drawing a circle [tan, tan, radius] would help you understand what op actually wants. 

0 Likes
Message 5 of 11

dani_cs
Advocate
Advocate

Hello @Kent1Cooper 

 

What do you mean with straight things-to-be-tangent-to? I would need to pick the first object (such as lines, plines, circles or acs); then, the second object (same as first) and finally, to choose the radius dynamically (that is the reason of the gif, to show what I mean)

 

Thanks in advance.

0 Likes
Message 6 of 11

dani_cs
Advocate
Advocate

Hello @john.uhden 

 

Sorry for my bad explanation. I would like to be able to do subcommand "Tan Tan Radius" dynamically. I would need to pick the first object (such as lines, plines, circles or acs); then, the second object (same as first) and finally, to choose the radius dynamically

 

The GIF I uploaded is from a web page but it is a different command. I attached it trying to explain what I mean with "dynamically": you can select different radius values in live moving the cursor.

0 Likes
Message 7 of 11

Kent1Cooper
Consultant
Consultant

@dani_cs wrote:

..... What do you mean with straight things-to-be-tangent-to? ....


Only that if the two selected objects that you want your Circle to be tangent to are straight [Lines, Polyline line segments, Xlines, Rays], I have in mind a way that it might be done.  If you need to be able to also select curves [Arcs, Circles, Polyline arc segments], then the way I have in mind won't be possible.  [Regular Circle's TTR option doesn't work with some kinds of curves anyway -- Ellipses, Splines.]  I can imagine there might be a way, but not the way I am thinking of.

EDIT:

Here's what I had in mind, using the CTTD command defined in the attached CircleTTDynamic.lsp file:

CTTD.gif

Note that it bases its position and radius calculations on the raw distance from the intersection [or virtual/apparent intersection] of the selected objects to the cursor location, and always places the Circle in the area roughly between the selection locations.  So in the one between Ray and Xline, the Circle heads back to the right when the cursor gets far to the left, past the virtual intersection.

 

If the two objects are parallel, it draws the one possible Circle, and starts a Move command with the displacement direction locked to parallel to the objects, for placement:

CTTD-parallel.gif

 

But since so much of what it does is based on the angles of the objects and the angle between them, with no such possibility when curves are involved, it can't work with them.

 

[EDIT:  Replaced the file -- the original had a selection prompt holdover from the Bisector routine that was the source of the straight-object-limited selection parts of the code.]

Kent Cooper, AIA
Message 8 of 11

dani_cs
Advocate
Advocate

@Kent1Cooper wrote:

 

 [Regular Circle's TTR option doesn't work with some kinds of curves anyway -- Ellipses, Splines.]  I can imagine there might be a way, but not the way I am thinking of.

 Yes, the regular Circle's TTR option does not work with Ellipses and Splines. That is an acceptable limitation

 


@Kent1Cooper wrote:

 

Only that if the two selected objects that you want your Circle to be tangent to are straight [Lines, Polyline line segments, Xlines, Rays], I have in mind a way that it might be done.  If you need to be able to also select curves [Arcs, Circles, Polyline arc segments], then the way I have in mind won't be possible. 

I would say 80% of objects I need to do tangent to are circles or arcs. So, if it is possible, that feature would save me a lot of time.

 

Anyway, you did an awesome job!!

0 Likes
Message 9 of 11

ВeekeeCZ
Consultant
Consultant
Accepted solution

A bit of cheating and with no ambition for a bulletproof solution. Just good enough, at least for me.

 

(defun c:TTP ( / *error* osm t1 t2 e r)
  
  (defun *error* (errmsg)
    (if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break,end"))
      (princ (strcat "\nError: " errmsg)))
    (if osm (setvar 'OSMODE osm))
    (princ))
  
  (if (and (setq t1 (entsel "\nFirst tangent point: "))
	   (setq t2 (entsel "\nSecond tangent point: "))
	   (setq osm (getvar 'osmode))
	   (setvar 'osmode 0)
	   (setq e (entlast))
	   )
    (command "_circle" "_3p" "_non" (cadr t1) "_non" (cadr t2) pause))
  
  (if (not (equal e (setq e (entlast))))
    (progn
      (setq r (fix (cdr (assoc 40 (entget e)))))
      (entdel e)
      (command "_circle" "_ttr" "_tan" (cadr t1) "_tan" (cadr t2) r)))
  (*error* "end")
  )

 

0 Likes
Message 10 of 11

dani_cs
Advocate
Advocate

Hello @ВeekeeCZ 

 

Thanks for the code. It works really good. How can I see the numeric value of the radius while changing?

furthermore, I can only make natural radius values, is it possible to include digits after the decimal point?

 

Thanks a lot anyway!!!

0 Likes
Message 11 of 11

ВeekeeCZ
Consultant
Consultant

You can't.

Remove the (fix  ) function.

0 Likes