Author Topic: Help : 2 centered compound curve lisp ---  (Read 3339 times)

0 Members and 1 Guest are viewing this topic.

venkat241

  • Guest
Help : 2 centered compound curve lisp ---
« on: February 06, 2013, 06:51:39 AM »
Dear All,

Please help in writing a lisp program for 2 centered compound curve. Ref. image attached.

Input by selecting first tangent AI and 2nd tangent BI and giving R1 and R2 values.

Output Arcs T1t and tT2.

Advanced Thanks & Regards

M V Rao

 :-P


irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Help : 2 centered compound curve lisp ---
« Reply #1 on: February 06, 2013, 07:52:11 AM »
Do you want someone to write it for you or do you want some help on trying to do so yourself?

Tip: The trick is to use trigonometry and/or pythagoras or to draw construction lines using the polar function and finding their intersections.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

Gasty

  • Newt
  • Posts: 90
Re: Help : 2 centered compound curve lisp ---
« Reply #2 on: February 06, 2013, 08:36:11 AM »
Hi,

You don't need to solve any Pythagoras:

0.- Put the origin at "O"
1.- Get the slope of each tangent line, say m1, m2
2.- The slope of the radius line for each tangent will be -1/m1; -1/m2, so you get the angles Delta1 y Delta2
3.- The point "t" will be at (0, R2)
4.- The point T2 will be at (R2*cos(Delta2),R2*Sin(Delta2))
5.- The same for T1 (need some sign change)
6.- Translate the result to real origin


Gaston Nunez


ribarm

  • Gator
  • Posts: 3225
  • Marko Ribar, architect
Re: Help : 2 centered compound curve lisp ---
« Reply #3 on: February 06, 2013, 10:11:49 AM »
See if this can help you :

Code - Auto/Visual Lisp: [Select]
  1. (defun c:2CCT ( / osm apex ap an1 an2 ra ch tmp rad1 rad2 tp1 tp2 p cen1 cen2 pci11 pci12 pci13 pci21 pci22 pci23 )
  2.   (setq osm (getvar 'osmode))
  3.   (setvar 'osmode 0)
  4.   (setq apex (getpoint "\nPick apex point of midtangent : "))
  5.   (setq ap (getpoint apex "\nPick point through witch passes midtangent : "))
  6.   (setq an1 (polar apex (+ (angle apex ap) (/ pi 2.0)) 1.0))
  7.   (setq an2 (polar apex (+ (angle apex ap) (/ pi 2.0)) -1.0))
  8.   (vl-cmdf "_.xline" apex ap "")
  9.   (vl-cmdf "_.ray" apex an1 "")
  10.   (setq ra (entlast))
  11.   (while
  12.     (progn
  13.       (setq ch (getstring "\nPress [ENTER] to cycle for other side ray choice or [any other key and enter] to keep defined ray : "))
  14.       (if (eq ch "")
  15.         (progn
  16.           (entdel (entlast))
  17.           (vl-cmdf "_.ray" apex an2 "")
  18.           (setq ra (entlast))
  19.           (setq tmp an1 an1 an2 an2 tmp)
  20.         )
  21.         nil
  22.       )
  23.     )
  24.   )
  25.   (setvar 'osmode 512)
  26.   (setq rad1 (getdist "\nPick first circle radius : "))
  27.   (setq rad2 (getdist "\nPick second circle radius : "))
  28.   (setq tp1 (getpoint "\nPick point for first tangent definition that lies on RAY : "))
  29.   (setq tp2 (getpoint "\nPick point for second tangent definition that lies on RAY : "))
  30.   (setvar 'osmode 0)
  31.   (setq p (getpoint "\nPick side of RAY witch belongs to first tangent : "))
  32.   (setq cen1 (polar apex (angle apex an2) rad1))
  33.   (setq cen2 (polar apex (angle apex an2) rad2))
  34.   (vl-cmdf "_.circle" cen1 rad1)
  35.   (vl-cmdf "_.circle" cen2 rad2)
  36.   (vl-cmdf "_.zoom" "e")
  37.   (setq pci11 (polar cen1 (angle apex ap) rad1))
  38.   (setq pci12 (polar cen1 (angle ap apex) rad1))
  39.   (setq pci13 (polar cen1 (angle apex an2) rad1))
  40.   (setq pci21 (polar cen2 (angle apex ap) rad2))
  41.   (setq pci22 (polar cen2 (angle ap apex) rad2))
  42.   (setq pci23 (polar cen2 (angle apex an2) rad2))
  43.   (if (< (distance pci11 p) (distance pci12 p))
  44.     (progn
  45.       (vl-cmdf "_.line" tp1 "_tan" pci11 "")
  46.       (setq ta1 (entlast))
  47.       (vl-cmdf "_.trim" ra ta1 "" pci12 "")
  48.       (vl-cmdf "_.trim" ta1 "" pci13 "")
  49.       (vl-cmdf "_.line" tp2 "_tan" pci22 "")
  50.       (setq ta2 (entlast))
  51.       (vl-cmdf "_.trim" ra ta2 "" pci21 "")
  52.       (vl-cmdf "_.trim" ta2 "" pci23 "")
  53.     )
  54.     (progn
  55.       (vl-cmdf "_.line" tp1 "_tan" pci12 "")
  56.       (setq ta1 (entlast))
  57.       (vl-cmdf "_.trim" ra ta1 "" pci11 "")
  58.       (vl-cmdf "_.trim" ta1 "" pci13 "")
  59.       (vl-cmdf "_.line" tp2 "_tan" pci21 "")
  60.       (setq ta2 (entlast))
  61.       (vl-cmdf "_.trim" ra ta2 "" pci22 "")
  62.       (vl-cmdf "_.trim" ta2 "" pci23 "")
  63.     )
  64.   )
  65.   (vl-cmdf "_.zoom" "e")
  66.   (setvar 'osmode osm)
  67.   (princ)
  68. )
  69.  

M.R.
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

venkat241

  • Guest
Re: Help : 2 centered compound curve lisp ---
« Reply #4 on: February 08, 2013, 11:06:14 PM »
Dear Sir,

I have checked the lisp but i couldn't understand the ray concept.

Rgds

MVRAO

bchapman

  • Guest
Re: Help : 2 centered compound curve lisp ---
« Reply #5 on: February 09, 2013, 12:47:14 AM »
I agree with op lol... that lisp isn't friendly for the non-math majors

venkat241

  • Guest
Re: Help : 2 centered compound curve lisp ---
« Reply #6 on: February 09, 2013, 08:24:13 AM »
Dear All,

If anyone could help by writing a lisp program, i will be very grateful for him.

I don't know how to write lisp program.

Thanks in Advance,

MVRAO

kirby

  • Newt
  • Posts: 127
Re: Help : 2 centered compound curve lisp ---
« Reply #7 on: February 11, 2013, 10:46:30 AM »
Hi

Here is an older routine that should do what you want.  It is more of a Civil Engineering approach.  I've added lots of comments, but let me know if you have any questions.

Regards,
Kirby
in sunny Winnipeg, Manitoba, Canada

kulfi

  • Guest
Re: Help : 2 centered compound curve lisp ---
« Reply #8 on: March 29, 2015, 05:01:25 AM »
Please can i gete the image where i can easily how to make the selection according to the lisp program.
thanks