Author Topic: Help : 2 centered compound curve lisp ---  (Read 3385 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,

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

Output Arcs T1t and tT2.

M V Rao

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: 3265
• Marko Ribar, architect
Re: Help : 2 centered compound curve lisp ---
« Reply #3 on: February 06, 2013, 10:11:49 AM »

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.       (setq ch (getstring "\nPress [ENTER] to cycle for other side ray choice or [any other key and enter] to keep defined ray : "))
12.       (if (eq ch "")
13.           (entdel (entlast))
14.           (vl-cmdf "_.ray" apex an2 "")
15.           (setq ra (entlast))
16.           (setq tmp an1 an1 an2 an2 tmp)
17.         )
18.         nil
19.       )
20.     )
21.   )
22.   (setvar 'osmode 512)
25.   (setq tp1 (getpoint "\nPick point for first tangent definition that lies on RAY : "))
26.   (setq tp2 (getpoint "\nPick point for second tangent definition that lies on RAY : "))
27.   (setvar 'osmode 0)
28.   (setq p (getpoint "\nPick side of RAY witch belongs to first tangent : "))
29.   (setq cen1 (polar apex (angle apex an2) rad1))
30.   (setq cen2 (polar apex (angle apex an2) rad2))
33.   (vl-cmdf "_.zoom" "e")
34.   (setq pci11 (polar cen1 (angle apex ap) rad1))
35.   (setq pci12 (polar cen1 (angle ap apex) rad1))
36.   (setq pci13 (polar cen1 (angle apex an2) rad1))
37.   (setq pci21 (polar cen2 (angle apex ap) rad2))
38.   (setq pci22 (polar cen2 (angle ap apex) rad2))
39.   (setq pci23 (polar cen2 (angle apex an2) rad2))
40.   (if (< (distance pci11 p) (distance pci12 p))
41.       (vl-cmdf "_.line" tp1 "_tan" pci11 "")
42.       (setq ta1 (entlast))
43.       (vl-cmdf "_.trim" ra ta1 "" pci12 "")
44.       (vl-cmdf "_.trim" ta1 "" pci13 "")
45.       (vl-cmdf "_.line" tp2 "_tan" pci22 "")
46.       (setq ta2 (entlast))
47.       (vl-cmdf "_.trim" ra ta2 "" pci21 "")
48.       (vl-cmdf "_.trim" ta2 "" pci23 "")
49.     )
50.       (vl-cmdf "_.line" tp1 "_tan" pci12 "")
51.       (setq ta1 (entlast))
52.       (vl-cmdf "_.trim" ra ta1 "" pci11 "")
53.       (vl-cmdf "_.trim" ta1 "" pci13 "")
54.       (vl-cmdf "_.line" tp2 "_tan" pci21 "")
55.       (setq ta2 (entlast))
56.       (vl-cmdf "_.trim" ra ta2 "" pci22 "")
57.       (vl-cmdf "_.trim" ta2 "" pci23 "")
58.     )
59.   )
60.   (vl-cmdf "_.zoom" "e")
61.   (setvar 'osmode osm)
62.   (princ)
63. )
64.

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

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.

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