;;;Conics_by_line.lsp by Takaya Iwamoto ;;;changed name from test_818 to conics_by_line.lsp ;Collection of curves created by envelope, lines & circles ;;;updated on June 18,2007 by T.Iwamoto ; ;;;---------------ellipse case ---------------- ;envelope trial version _1 ellipse case; pedals on a circle (defun c:ellipse_model() (setup_env_1) (setq pnt_temp (getpoint "\nPick a point on the circle.")) (if (= pnt_temp nil) (setq pnt_temp '(-0.2588 0.9659))) ;;1.<105. (setq temp_angle (angle pnt_org pnt_temp) temp_x (* (cos temp_angle) ref_rad) temp_y (* (sin temp_angle) ref_rad) pnt_p (list temp_x temp_y) ) (make_pt "0" 0 pnt_p) (mark_id pnt_p "P" 3 chr_size) (setq angle_b (angle pnt_f1 pnt_p) angle_a (- temp_angle angle_b) angle_g (- temp_angle (* 2.0 angle_a)) pnt_s (polar pnt_org angle_g ref_rad) pnt_q (polar pnt_org (+ pi angle_g) ref_rad) pnt_r (polar pnt_org (+ pi temp_angle) ref_rad) pnt_t (plt pnt_f1 pnt_p 2.0) pnt_u (inters pnt_t pnt_f2 pnt_p pnt_s nil) ) (make_pt "0" 0 pnt_q) (mark_id pnt_q "Q" 3 chr_size) (make_pt "0" 0 pnt_r) (mark_id pnt_r "R" 4 chr_size) (make_pt "0" 0 pnt_s) (mark_id pnt_s "S" 1 chr_size) (make_pt "0" 0 pnt_t) (mark_id pnt_t "T" 1 chr_size) (make_pt "0" 0 pnt_u) (mark_id pnt_u "U" 1 chr_size) (make_line_1 "0" 2 pnt_p pnt_s ) (make_line_1 "0" 2 pnt_q pnt_r ) (make_line_1 "0" 8 pnt_q pnt_p ) (make_line_1 "0" 8 pnt_p pnt_r ) (make_line_1 "0" 8 pnt_r pnt_s ) (make_line_1 "0" 8 pnt_p pnt_t ) (make_line_1 "0" 0 pnt_t pnt_u ) (make_line_1 "0" 0 pnt_f1 pnt_u ) (make_line_1 "0" 0 pnt_f2 pnt_u ) (command "_.zoom" "_E") ;;draw the resulting ellipse a = a_major b = b_minor (command "_.color" 3) (command "_.ellipse" pnt_a pnt_b pnt_c) (command "_.regen") (command "_.color" "BYLAYER") ;;mark right angles, tick-mark same length lines (line_tick_mark pnt_f1 pnt_p 1 1) (line_tick_mark pnt_p pnt_t 1 1) (line_tick_mark pnt_f1 pnt_u 2 2) (line_tick_mark pnt_u pnt_t 2 2) (mark_right_angle pnt_q pnt_p pnt_s 3 0) (mark_right_angle pnt_s pnt_p pnt_t 3 0) (if (= (Yes_or_No "Continue ?") "_Y") (progn (make_circle_1 "0" 8 pnt_f2 (* 2. ref_rad)) (setq big_circle (entlast)) (command "_.zoom" "_E") (make_line_1 "0" 8 pnt_p pnt_s) (setq base_line1 (entlast)) (make_line_1 "0" 8 pnt_s pnt_p) (setq base_line2 (entlast)) (command "_.extend" big_circle "" base_line1 "") (command "_.extend" big_circle "" base_line2 "") ;;Identify point V & W (setq pnt_v (cdr (assoc 10 (entget base_line1))) pnt_w (cdr (assoc 10 (entget base_line2))) ) (make_pt "0" 0 pnt_v) (mark_id pnt_v "V" 2 chr_size) (make_pt "0" 0 pnt_w) (mark_id pnt_w "W" 2 chr_size) ;(command "_.erase" base_line1 base_line2 "") ) );;;end if (command "_.zoom" "_E") (command "_.regen") (reset_sysvar) ); ;;; ;;; (defun setup_env_1() (setup_sysvar) (setvar "PDMODE" 32) (setvar "PDSIZE" -3) (setq ref_rad 1.0 c 0.75 pnt_f1 (list (- c) 0) pnt_f2 (list c 0) pnt_org '(0 0) chr_size 0.125 a_major ref_rad b_minor (sqrt (- (* a_major a_major) (* c c))) pnt_a (list (- ref_rad) 0) pnt_b (list ref_rad 0) pnt_c (list 0 b_minor) ) (make_pt "0" 0 pnt_f1) (make_pt "0" 0 pnt_f2) (mark_id pnt_org "O" 1 chr_size) (mark_id pnt_f1 "F1" 4 chr_size) (mark_id pnt_f2 "F2" 4 chr_size) (mark_id '(1.1 0 ) "x" 1 chr_size) (mark_id '(0 1.1 ) "y" 1 chr_size) (make_circle_1 "0" 8 pnt_org ref_rad) (make_line_1 "0" 8 '(0 -1.1) '(0 1.1) ) (make_line_1 "0" 8 '(-1.1 0) '(1.1 0) ) (command "_.zoom" "_EXTENT" ) (command "_.regen") ) ;;; ;;; (defun c:ellipse_manual() (setup_env_1) (alert "\nPick a point along the circle\nHit ESC key to end.") (while (setq pnt_temp (cadr (grread ))) (setq temp_angle (angle pnt_org pnt_temp) temp_x (* (cos temp_angle) ref_rad) temp_y (* (sin temp_angle) ref_rad) pnt_p (list temp_x temp_y) ) (setq angle_b (angle pnt_f1 pnt_p) angle_a (- temp_angle angle_b) angle_g (- temp_angle (* 2.0 angle_a)) pnt_s (polar pnt_org angle_g ref_rad) pnt_q (polar pnt_org (+ pi angle_g) ref_rad) pnt_r (polar pnt_org (+ pi temp_angle) ref_rad) ) (make_line_1 "0" 2 pnt_p pnt_s ) (make_line_1 "0" 2 pnt_q pnt_r ) );;end of while loop (reset_sysvar) ); (defun c:ellipse_auto() (setup_env_1) (setq ndiv 40 count 1 start_angle 0. del_theta (/ pi ndiv) ) (alert "\nStart ?") (make_jpg) (make_jpg) (repeat (1+ ndiv) (setq temp_angle (+ start_angle (* count del_theta)) temp_x (* (cos temp_angle) ref_rad) temp_y (* (sin temp_angle) ref_rad) pnt_p (list temp_x temp_y) ) (setq angle_b (angle pnt_f1 pnt_p) angle_a (- temp_angle angle_b) angle_g (- temp_angle (* 2.0 angle_a)) pnt_s (polar pnt_org angle_g ref_rad) pnt_q (polar pnt_org (+ pi angle_g) ref_rad) pnt_r (polar pnt_org (+ pi temp_angle) ref_rad) ) (make_line_1 "0" 2 pnt_p pnt_s ) (make_line_1 "0" 2 pnt_q pnt_r ) (setq count (1+ count)) (make_jpg) (command "_.delay" 250) );;end of repeat loop (make_jpg) (make_jpg) (make_jpg) (reset_sysvar) ); ;;; ;;; (defun c:ellipse_by_triangle() (setup_env_1) (setq blk_scale 0.30) (command "_.zoom" "_E") (command "_.regen") (make_jpg) (make_jpg) (alert "\nPick a point along the circle\nHit ESC key to end.") (while (setq pnt_temp (getpoint "\nPick a point")) (if (/= trig_block nil) (entdel trig_block)) (setq temp_angle (angle pnt_org pnt_temp) temp_x (* (cos temp_angle) ref_rad) temp_y (* (sin temp_angle) ref_rad) pnt_p (list temp_x temp_y) ) (setq angle_b (angle pnt_f1 pnt_p) angle_a (- temp_angle angle_b) angle_g (- temp_angle (* 2.0 angle_a)) angle_ins (rtd (+ pi angle_b)) pnt_s (polar pnt_org angle_g ref_rad) pnt_q (polar pnt_org (+ pi angle_g) ref_rad) pnt_r (polar pnt_org (+ pi temp_angle) ref_rad) ) (my_block_insert2 "triangle_45_45_hatch" pnt_p blk_scale angle_ins) (setq trig_block (entlast)) (make_line_1 "0" 2 pnt_p pnt_s ) (command "_.draworder" (entlast) "" "_F") (make_jpg) (command "_.delay" 500) );;end of while loop (make_pt "0" 0 pnt_p) (mark_id pnt_p "P" 2 chr_size) (make_pt "0" 0 pnt_s) (mark_id pnt_s "S" 2 chr_size) (make_pt "0" 0 pnt_q) (mark_id pnt_q "Q" 3 chr_size) (make_jpg) (make_jpg) (make_jpg) (make_jpg) (reset_sysvar) ); ;;; ;;; ;ellipse by pedals on a circle (defun c:ellipse_manual_2() (setup_env_1) (setq block_scale 0.4) (alert "\nPlace cursor near -x- mark.\nAfter hit return key\n,move cursor along the circle \ncounter clockwise.\nHit ESC key to end.") (while (setq pnt_temp (cadr (grread T))) (setq temp_angle (angle pnt_org pnt_temp) temp_x (* (cos temp_angle) ref_rad) temp_y (* (sin temp_angle) ref_rad) pnt_p (list temp_x temp_y) ) (setq angle_b (angle pnt_f1 pnt_p) angle_a (- temp_angle angle_b) angle_g (- temp_angle (* 2.0 angle_a)) pnt_s (polar pnt_org angle_g ref_rad) pnt_q (polar pnt_org (+ pi angle_g) ref_rad) pnt_r (polar pnt_org (+ pi temp_angle) ref_rad) ) (make_line_1 "0" 2 pnt_p pnt_s ) (make_line_1 "0" 2 pnt_q pnt_r ) );;end of while loop ) ;;; ;;;ellipse_by_folding ellipse by folding a circular paper ;;; (defun c:ellipse_by_folding() (setup_env_1) (setq half_pi (* 0.5 pi)) (make_circle_1 "0" 8 pnt_f2 (* 2. ref_rad)) (setq big_circle (entlast)) (command "_.zoom" "_E") (make_jpg) (make_jpg) (while (setq pnt_tmp (getpoint "\nPick a point on the circle.")) (setq tmp_angle (angle pnt_f2 pnt_tmp) pnt_t (polar pnt_f2 tmp_angle (* 2. ref_rad)) pnt_p (mid_point pnt_f1 pnt_t) ) (make_pt "0" 0 pnt_t) (setq angle_f1_p_o (angle_3p pnt_p pnt_f1 pnt_org) angle_b (angle pnt_f1 pnt_p) angle_g (- angle_b angle_f1_p_o ) pnt_s (polar pnt_org angle_g ref_rad) ) (make_line_1 "0" 2 pnt_p pnt_s) (setq base_line1 (entlast)) (setq pick_line1 (plt pnt_p pnt_s 0.01)) (setq pick_line2 (plt pnt_p pnt_s 0.99)) (command "_.extend" big_circle "" pick_line1 "") (command "_.extend" big_circle "" pick_line2 "") ;;Identify point V & W (setq pnt_v (cdr (assoc 10 (entget (entlast)))) pnt_w (cdr (assoc 11 (entget (entlast)))) ) ;;form an arc and rotate this around the chord pnt_v - pnt_w 180 deg & back (command "_.pline" pnt_w "_A" "_CE" pnt_f2 pnt_v "_L" "cl") (setq arc_line (entlast)) (command "bhatch" "_Sel" (entlast) "" "Prop" "ansi31" "1." "0." "") (setq arc_hatch (entlast)) (setq ss (ssadd)) (ssadd arc_line ss)(ssadd arc_hatch ss) ;(command "_.rotate3d" ss "" "2" pnt_v pnt_w 180.) (slow_rotate3d_origami ss pnt_v pnt_w 180.) (entdel arc_hatch)(entdel arc_line) (command "_.delay" 250) );;;end of while loop ;;draw the resulting ellipse a = a_major b = b_minor (command "_.color" 3) (command "_.ellipse" pnt_a pnt_b pnt_c) (command "_.regen") (command "_.color" "BYLAYER") (command "_.zoom" "_E") (command "_.regen") (make_jpg) (make_jpg) (make_jpg) (make_jpg) (reset_sysvar) ); ;;; ;;;----------------------hyperbola ----------------------- ;hyperbola #basic geometry ;;; (defun c:hyperbola_model() (setup_env_3) (setq pnt_temp (getpoint "\nPick a point on the circle.")) (if (= pnt_temp nil) (setq pnt_temp '(0.583855 0.811858)) ) (setq temp_angle (angle pnt_org pnt_temp) temp_x (* (cos temp_angle) ref_rad) temp_y (* (sin temp_angle) ref_rad) pnt_p (list temp_x temp_y) ) (make_pt "0" 0 pnt_p) (mark_id pnt_p "P" 1 chr_size) (setq angle_b (angle pnt_f1 pnt_p) angle_a (- temp_angle angle_b) angle_g (- temp_angle (* 2.0 angle_a)) pnt_s (polar pnt_org angle_g ref_rad) pnt_q (polar pnt_org (+ pi angle_g) ref_rad) pnt_end2 (polar pnt_org (+ pi temp_angle) ref_rad) pnt_a (pld pnt_end2 pnt_q (* 2.75 ref_rad)) pnt_b (pld pnt_p pnt_s (* 2.75 ref_rad)) pnt_t (plt pnt_f1 pnt_p 2.0) pnt_u (inters pnt_t pnt_f2 pnt_p pnt_s nil) ) (make_circle_1 "0" 8 pnt_f2 (* 2. ref_rad)) (command "_.zoom" "_E") (make_pt "0" 0 pnt_q) (mark_id pnt_q "Q" 2 chr_size) (make_pt "0" 0 pnt_s) (mark_id pnt_s "S" 1 chr_size) (make_pt "0" 0 pnt_a) (mark_id pnt_a "A" 1 chr_size) (make_pt "0" 0 pnt_b) (mark_id pnt_b "B" 1 chr_size) (make_pt "0" 0 pnt_t) (mark_id pnt_t "T" 1 chr_size) (make_pt "0" 0 pnt_u) (mark_id pnt_u "U" 1 chr_size) (make_line_1 "0" 8 pnt_p pnt_t) (make_line_1 "0" 8 pnt_t pnt_u) (make_line_1 "0" 8 pnt_f1 pnt_u) (make_line_1 "0" 8 pnt_f1 pnt_p) (make_line_1 "0" 8 pnt_p pnt_s) (make_line_1 "0" 2 pnt_s pnt_b ) (make_line_1 "0" 3 pnt_q pnt_a ) ;;mark right angles, tick-mark same length lines (line_tick_mark pnt_f1 pnt_p 1 1) (line_tick_mark pnt_p pnt_t 1 1) (line_tick_mark pnt_f1 pnt_u 2 2) (line_tick_mark pnt_u pnt_t 2 2) (mark_right_angle pnt_f1 pnt_p pnt_u 3 0) (mark_right_angle pnt_t pnt_p pnt_u 3 0) (reset_sysvar) );;;hyperbola_model ;;; ;;; (defun setup_env_3() (setvar "PDMODE" 32) (setvar "PDSIZE" -3) (setq ref_rad 1.0) (setq pnt_f1 '(-1.5 0) pnt_f2 '(1.5 0) pnt_org '(0 0) a 1.0 c 1.5 half_pi (* 0.5 pi) two_pi (* 2. pi) chr_size 0.20 y_up '(0 1.5) y_down '(0 -1.1) x_right '(2.2 0) x_left '(-1.7 0) ) (make_pt "0" 0 pnt_f1) (make_pt "0" 0 pnt_f2) (make_pt "0" 0 pnt_org) (mark_id pnt_org "O" 1 chr_size) (mark_id pnt_f1 "F1" 2 chr_size) (mark_id pnt_f2 "F2" 2 chr_size) (mark_id x_right "x" 2 chr_size) (mark_id y_up "y" 3 chr_size) (make_circle_1 "0" 8 pnt_org ref_rad) (make_line_1 "0" 8 x_left x_right ) (make_line_1 "0" 8 y_up y_down ) (command "_.zoom" "_E" ) (command "_.regen") ) ;;; (defun c:hyperbola_manual() (setup_env_3) (mark_id (shift_pnt pnt_f1 '(-0.2 0)) "(-c,0)" 4 chr_size) (mark_id (shift_pnt pnt_f2 '(-0.2 0)) "(c,0)" 4 chr_size) (setq dist1 (distance pnt_f1 pnt_org) dist2 (- dist1 ref_rad) dist3 (+ dist1 ref_rad) dist4 (sqrt (* dist2 dist3)) theta (atan (/ dist4 ref_rad)) alpha (- half_pi theta) pnt_tang1 (polar pnt_f1 alpha dist4) pnt_tang2 (polar pnt_f1 (- two_pi alpha) dist4) pnt_asym1 (plt pnt_org pnt_tang1 4.) pnt_asym3 (plt pnt_org pnt_tang1 -4.) pnt_asym2 (plt pnt_org pnt_tang2 -4.) pnt_asym4 (plt pnt_org pnt_tang2 4.) ) (mark_id pnt_tang1 "K" 2 chr_size) (mark_id pnt_tang2 "L" 2 chr_size) (make_line_1 "0" 8 pnt_asym1 pnt_asym3) (make_line_1 "0" 8 pnt_asym2 pnt_asym4) (command "_.delay" 500) (alert "\nPlace cursor near point K.\nAfter hitting return,move cursor clockwise. \nfrom point K clockwise to point L\n Hit ESC or R-click to stop.") (while (setq pnt_temp (cadr (grread ))) (setq temp_angle (angle pnt_org pnt_temp) temp_x (* (cos temp_angle) ref_rad) temp_y (* (sin temp_angle) ref_rad) pnt_p (list temp_x temp_y) ) (setq angle_b (angle pnt_f1 pnt_p) angle_a (- temp_angle angle_b) angle_g (- temp_angle (* 2.0 angle_a)) pnt_s (polar pnt_org angle_g ref_rad) pnt_q (polar pnt_org (+ pi angle_g) ref_rad) pnt_end2 (polar pnt_org (+ pi temp_angle) ref_rad) pnt_a (pld pnt_end2 pnt_q (* 4.0 ref_rad)) pnt_b (pld pnt_p pnt_s (* 4.0 ref_rad)) ) (make_line_1 "0" 2 pnt_s pnt_b ) (make_line_1 "0" 3 pnt_q pnt_a ) ) ) ;;; ;;; ;;; (defun c:hyperbola_by_triangle() (setup_env_3) (setq blk_scale 0.50) (mark_id (shift_pnt pnt_f1 '(-0.2 0)) "(-c,0)" 4 chr_size) (mark_id (shift_pnt pnt_f2 '(-0.2 0)) "(c,0)" 4 chr_size) (setq dist1 (distance pnt_f1 pnt_org) dist2 (- dist1 ref_rad) dist3 (+ dist1 ref_rad) dist4 (sqrt (* dist2 dist3)) theta (atan (/ dist4 ref_rad)) alpha (- half_pi theta) pnt_tang1 (polar pnt_f1 alpha dist4) pnt_tang2 (polar pnt_f1 (- two_pi alpha) dist4) pnt_asym1 (plt pnt_org pnt_tang1 4.) pnt_asym3 (plt pnt_org pnt_tang1 -4.) pnt_asym2 (plt pnt_org pnt_tang2 -4.) pnt_asym4 (plt pnt_org pnt_tang2 4.) ) (mark_id pnt_tang1 "K" 2 chr_size) (mark_id pnt_tang2 "L" 2 chr_size) (make_line_1 "0" 8 pnt_asym1 pnt_asym3) (make_line_1 "0" 8 pnt_asym2 pnt_asym4) (make_jpg) (make_jpg) (command "_.delay" 500) (alert "\nPlace cursor near point K.\nAfter hitting return,move cursor clockwise. \nfrom point K clockwise to point L\n Hit ESC or R-click to stop.") (while (setq pnt_temp (getpoint "\nPick a point")) (if (/= trig_block nil) (entdel trig_block)) (setq temp_angle (angle pnt_org pnt_temp) temp_x (* (cos temp_angle) ref_rad) temp_y (* (sin temp_angle) ref_rad) pnt_p (list temp_x temp_y) ) (setq angle_b (angle pnt_f1 pnt_p) angle_a (- temp_angle angle_b) angle_g (- temp_angle (* 2.0 angle_a)) angle_ins (rtd (- angle_b pi)) pnt_s (polar pnt_org angle_g ref_rad) pnt_q (polar pnt_org (+ pi angle_g) ref_rad) pnt_end2 (polar pnt_org (+ pi temp_angle) ref_rad) pnt_a (pld pnt_end2 pnt_q (* 4.0 ref_rad)) pnt_b (pld pnt_p pnt_s (* 4.0 ref_rad)) ) (if (< temp_y 0.) (setq angle_ins (- angle_ins 90.)) ) (my_block_insert2 "triangle_45_45_hatch" pnt_p blk_scale angle_ins) (setq trig_block (entlast)) (make_line_1 "0" 2 pnt_s pnt_b ) (make_jpg) ;(make_line_1 "0" 3 pnt_q pnt_a ) ) (make_jpg) (make_jpg) (make_jpg) (make_jpg) (reset_sysvar) ) ;hyperbola #2 (defun c:hyperbola_manual_2() (setup_env_3) (setq dist1 (distance pnt_f1 pnt_org) dist2 (- dist1 ref_rad) dist3 (+ dist1 ref_rad) dist4 (sqrt (* dist2 dist3)) theta (atan (/ dist4 ref_rad)) alpha (- half_pi theta) pnt_tang1 (polar pnt_f1 alpha dist4) pnt_tang2 (polar pnt_f1 (- two_pi alpha) dist4) pnt_asym1 (plt pnt_org pnt_tang1 4.) pnt_asym3 (plt pnt_org pnt_tang1 -4.) pnt_asym2 (plt pnt_org pnt_tang2 -4.) pnt_asym4 (plt pnt_org pnt_tang2 4.) ) (mark_id pnt_tang1 "K" 2 chr_size) (mark_id pnt_tang2 "L" 2 chr_size) (make_line_1 "0" 8 pnt_asym1 pnt_asym3) (make_line_1 "0" 8 pnt_asym2 pnt_asym4) (command "_.delay" 500) (alert "\nPlace cursor near point K.\nAfter hitting return,move cursor clockwise. \nfrom point K clockwise to point L\n Hit ESC to stop.") (while (setq pnt_temp (cadr (grread T))) (setq temp_angle (angle pnt_org pnt_temp) temp_x (* (cos temp_angle) ref_rad) temp_y (* (sin temp_angle) ref_rad) pnt_p (list temp_x temp_y) ) (setq angle_b (angle pnt_f1 pnt_p) angle_a (- temp_angle angle_b) angle_g (- temp_angle (* 2.0 angle_a)) pnt_s (polar pnt_org angle_g ref_rad) pnt_q (polar pnt_org (+ pi angle_g) ref_rad) pnt_end2 (polar pnt_org (+ pi temp_angle) ref_rad) pnt_a (pld pnt_end2 pnt_q (* 4.0 ref_rad)) pnt_b (pld pnt_p pnt_s (* 4.0 ref_rad)) ) (make_line_1 "0" 2 pnt_s pnt_b) (make_line_1 "0" 3 pnt_q pnt_a) ) ) ;hyperbola_auto (defun c:hyperbola_auto() (setup_sysvar) (setvar "PDMODE" 32) (setvar "PDSIZE" -3) (setq ref_rad 2.0 half_pi (* 0.5 pi) two_pi (* 2.0 pi) ref_length (* 3.0 ref_rad) chr_size 0.20 pnt_f1 '(-2.5 0) pnt_f2 '(2.5 0) pnt_org '(0 0) ) (make_pt "0" 0 pnt_f1) (make_pt "0" 0 pnt_f2) (make_pt "0" 0 pnt_org) (mark_id pnt_f1 "F1" 2 chr_size) (mark_id pnt_f2 "F2" 2 chr_size) (mark_id pnt_org "O" 1 chr_size) (mark_id '(3 0) "x" 2 chr_size) (mark_id '(0 3) "y" 1 chr_size) (command "_circle" '(0 0) ref_rad) (command "_.line" '(0 -3) '(0 3) "") (command "_.line" '(-3 0) '(3 0) "") (command "_.zoom" "_EXTENT" ) (command "_.regen") (setq dist1 (distance pnt_f1 pnt_org) dist2 (- dist1 ref_rad) dist3 (+ dist1 ref_rad) dist4 (sqrt (* dist2 dist3)) theta (atan (/ dist4 ref_rad)) alpha (- half_pi theta) pnt_tang1 (polar pnt_f1 alpha dist4) pnt_tang2 (polar pnt_f1 (- two_pi alpha) dist4) pnt_asym1 (plt pnt_org pnt_tang1 4.) pnt_asym3 (plt pnt_org pnt_tang1 -4.) pnt_asym2 (plt pnt_org pnt_tang2 -4.) pnt_asym4 (plt pnt_org pnt_tang2 4.) ) (mark_id pnt_tang1 "K" 2 chr_size) (mark_id pnt_tang2 "L" 2 chr_size) ;draw two asymptote lines (make_line_1 "0" 8 pnt_asym1 pnt_asym3) (make_line_1 "0" 8 pnt_asym2 pnt_asym4) (make_jpg) (make_jpg) (command "_.delay" 500) (alert "\nStart ?") (setq theta_start (angle pnt_org pnt_tang1) theta_range (* 1.9999 theta_start) ndiv 60 del_theta (- (/ theta_range ndiv)) step 0 ) (repeat (1+ ndiv) (setq temp_angle (+ theta_start (* del_theta step)) temp_x (* (cos temp_angle) ref_rad) temp_y (* (sin temp_angle) ref_rad) pnt_p (list temp_x temp_y) ) (setq angle_b (angle pnt_f1 pnt_p) angle_a (- temp_angle angle_b) angle_g (- temp_angle (* 2.0 angle_a)) pnt_s (polar pnt_org angle_g ref_rad) pnt_q (polar pnt_org (+ pi angle_g) ref_rad) pnt_end2 (polar pnt_org (+ pi temp_angle) ref_rad) pnt_a (pld pnt_end2 pnt_q (* 3.0 ref_rad)) pnt_b (pld pnt_p pnt_s (* 3.0 ref_rad)) ) (make_line_1 "0" 2 pnt_s pnt_b) (make_line_1 "0" 3 pnt_q pnt_a) ;(princ "step theta")(princ step)(princ "::")(princ temp_angle)(terpri) (make_jpg) (command "_.delay" 250) (setq step (1+ step)) );;;end of repeat loop (make_jpg) (make_jpg) (make_jpg) (reset_sysvar) );;; ;;; ;hyperbola by foling a circular paper ;;; (defun c:hyperbola_by_folding() (setup_env_3) (setq pu (list ref_rad (* 2. ref_rad)) pd (list ref_rad (- (* 2. ref_rad))) ) (make_line_1 "0" 9 pu pd) (make_circle_1 "0" 8 pnt_f2 (* 2. ref_rad)) (setq big_circle (entlast)) (command "_.zoom" "_E") (make_jpg) (make_jpg) (while (setq pnt_tmp (getpoint "\nPick a point on the big circle.")) (setq tmp_angle (angle pnt_f2 pnt_tmp) pnt_t (polar pnt_f2 tmp_angle (* 2. ref_rad)) pnt_p (mid_point pnt_f1 pnt_t) ) (make_pt "0" 0 pnt_t) ;(mark_id pnt_p "P" 1 chr_size) (setq temp_angle (angle pnt_org pnt_p) angle_b (angle pnt_f1 pnt_p) angle_a (- temp_angle angle_b) angle_g (- temp_angle (* 2.0 angle_a)) pnt_s (polar pnt_org angle_g ref_rad) ;pnt_b (plt pnt_p pnt_s 2.5) ) (make_line_1 "0" 8 pnt_p pnt_s) (setq base_line1 (entlast)) (setq pick_line1 (plt pnt_p pnt_s 0.001)) (setq pick_line2 (plt pnt_p pnt_s 0.999)) (command "_.extend" big_circle "" pick_line1 "") (command "_.extend" big_circle "" pick_line2 "") ;;Identify point V & W (setq pnt_v (cdr (assoc 10 (entget (entlast)))) pnt_w (cdr (assoc 11 (entget (entlast)))) ) ;;form an arc and rotate this around the chord pnt_v - pnt_w 180 deg & back (if (> (cadr pnt_p) 0.) (command "_.pline" pnt_w "_A" "_CE" pnt_f2 pnt_v "_L" "cl") (command "_.pline" pnt_v "_A" "_CE" pnt_f2 pnt_w "_L" "cl") );;;end if (setq arc_line (entlast)) (command "bhatch" "_Sel" (entlast) "" "Prop" "ansi31" "1." "0." "") (setq arc_hatch (entlast)) (setq ss (ssadd)) (ssadd arc_line ss)(ssadd arc_hatch ss) ;(command "_.rotate3d" ss "" "2" pnt_v pnt_w 180.) (slow_rotate3d_origami ss pnt_v pnt_w 180.) (entdel arc_hatch)(entdel arc_line) (make_jpg) (make_jpg) (command "_.delay" 250) );;;end of while loop (make_jpg) (make_jpg) (make_jpg) (make_jpg) (reset_sysvar) );;;hyperbola_by_folding ;;; ----------------parabola case ------------------- ;parabola #1 (defun c:parabola_model() (setup_parabola) (setq pnt_temp (getpoint "\nPick a point on y_axis.")) (if (= pnt_temp nil) (setq pnt_temp '(0 1.))) (setq temp_y (cadr pnt_temp) pnt_b (list 0.0 temp_y) ref_angle (angle pnt_f pnt_b) ref_length (* 1.25 (distance pnt_f pnt_b)) ) (if (> temp_y 0.0) (setq pnt_a (polar pnt_b (- ref_angle half_pi) ref_length)) (setq pnt_a (polar pnt_b (+ ref_angle half_pi) ref_length)) ) (mark_id pnt_a "A" 1 chr_size) (mark_id pnt_b "B" 4 chr_size) (mark_id dir_up "D1" 1 chr_size) (mark_id dir_down "D2" 1 chr_size) (mark_id pnt_h "H" 1 chr_size) (mark_id pnt_h "(-c, 0)" 4 chr_size) (mark_id pnt_f "(c, 0)" 4 chr_size) (make_line_1 "0" 8 pnt_f pnt_b) (make_line_1 "0" 2 pnt_b pnt_a) (line_tick_mark pnt_h pnt_org 1 0) (line_tick_mark pnt_org pnt_f 1 0) (mark_right_angle pnt_a pnt_b pnt_f 3 0) (mark_right_angle pnt_a pnt_b pnt_c 3 0) ;;extend FB to C (setq pnt_c (plt pnt_f pnt_b 2.0) pnt_e (list 2.0 (cadr pnt_c)) pnt_g (inters pnt_a pnt_b pnt_c pnt_e nil) ) (mark_id pnt_c "C" 1 chr_size) (mark_id pnt_g "G (x,y)" 1 chr_size) (make_line_1 "0" 8 pnt_b pnt_c) (make_line_1 "0" 0 pnt_c pnt_g) (make_line_1 "0" 0 pnt_g pnt_f) ;;line tick marks (line_tick_mark pnt_c pnt_b 1 1) (line_tick_mark pnt_b pnt_f 1 1) (line_tick_mark pnt_c pnt_g 2 2) (line_tick_mark pnt_g pnt_f 2 2) (reset_sysvar) ) ;;; ;;; ;parabola #2 (defun c:parabola_by_triangle() (setup_parabola) (setq blk_scale 0.65) (command "_.zoom" "_E") (command "_.regen") (make_jpg) (make_jpg) (alert "\nPick a point on y_axis.\nHit return key to end") (while (setq pnt_temp (getpoint "\nPick a point")) (if (/= trig_block nil) (entdel trig_block)) (setq temp_y (cadr pnt_temp) pnt_b (list 0.0 temp_y) ref_angle (angle pnt_f pnt_b) ref_length (* 1.25 (distance pnt_f pnt_b)) angle_ins (rtd (- ref_angle pi )) ) (if (> angle_ins 0.) (setq angle_ins (- (- 90. angle_ins))) ) (if (> temp_y 0.0) (setq pnt_a (polar pnt_b (- ref_angle half_pi) ref_length)) (setq pnt_a (polar pnt_b (+ ref_angle half_pi) ref_length)) ) (my_block_insert2 "triangle_45_45_hatch" pnt_b blk_scale angle_ins) (setq trig_block (entlast)) ;(make_line_1 "0" 8 pnt_f pnt_b) (make_line_1 "0" 2 pnt_b pnt_a) (make_jpg) );;;end of while loop (make_jpg) (make_jpg) (make_jpg) (reset_sysvar) ) ;;;; ;;; ;;; ;parabola #2 (defun c:parabola_manual_1() (setup_parabola) (alert "\nPick a point on y_axis.\nHit ESC key to end") (while (setq pnt_temp (cadr (grread ))) (setq temp_y (cadr pnt_temp) pnt_b (list 0.0 temp_y) ref_angle (angle pnt_f pnt_b) ref_length (* 1.25 (distance pnt_f pnt_b)) ) (if (> temp_y 0.0) (setq pnt_a (polar pnt_b (- ref_angle half_pi) ref_length)) (setq pnt_a (polar pnt_b (+ ref_angle half_pi) ref_length)) ) (make_line_1 "0" 8 pnt_f pnt_b) (make_line_1 "0" 2 pnt_b pnt_a) ) ) ;parabola #3 (defun c:parabola_manual_2() (setup_parabola) (alert "\nPlace your cursor up along the y_axis\nand after hitting return key \n move cursor slowly downward. Hit ESC key to end.") (while (setq pnt_temp (cadr (grread T))) (setq temp_y (cadr pnt_temp) pnt_b (list 0.0 temp_y) ref_angle (angle pnt_f pnt_b) ref_length (* 1.25 (distance pnt_f pnt_b)) ) (if (> temp_y 0.0) (setq pnt_a (polar pnt_b (- ref_angle half_pi) ref_length)) (setq pnt_a (polar pnt_b (+ ref_angle half_pi) ref_length)) ) (make_line_1 "0" 8 pnt_f pnt_b) (make_line_1 "0" 2 pnt_b pnt_a) ) ) ;parabola #4 (defun c:parabola_manual_3() (setup_parabola) (alert "\nPlace your cursor up along the y_axis\nand after hitting return key \n move cursor slowly downward. Hit ESC key to end.") (while (setq pnt_temp (cadr (grread T))) (setq temp_y (cadr pnt_temp) pnt_b (list 0.0 temp_y) ref_angle (angle pnt_f pnt_b) ref_length (* 1.25 (distance pnt_f pnt_b)) ) (if (> temp_y 0.0) (setq pnt_a (polar pnt_b (- ref_angle half_pi) ref_length)) (setq pnt_a (polar pnt_b (+ ref_angle half_pi) ref_length)) ) ;(make_line_1 "0" 8 pnt_f pnt_b) (make_line_1 "0" 2 pnt_b pnt_a) ) ) ;parabola #5 (defun c:parabola_auto() (setup_parabola) (setq y_start 2. y_end -2. ndiv 20 del_y (/ (- y_end y_start) ndiv) step 0 ) (make_jpg) (make_jpg) (alert "\nDraw automatically.") (repeat (1+ ndiv) (setq pnt_temp (list 0 (+ y_start (* del_y step))) ) (setq temp_y (cadr pnt_temp) pnt_b (list 0.0 temp_y) ref_angle (angle pnt_f pnt_b) ref_length (* 1.25 (distance pnt_f pnt_b)) ) (if (> temp_y 0.0) (setq pnt_a (polar pnt_b (- ref_angle half_pi) ref_length)) (setq pnt_a (polar pnt_b (+ ref_angle half_pi) ref_length)) ) (make_line_1 "0" 2 pnt_b pnt_a ) (setq step (1+ step)) (make_jpg) (make_jpg) (command "_.delay" 250) );;end of repeat loop (make_jpg) (make_jpg) (make_jpg) (make_jpg) (reset_sysvar) ) ;;; (defun setup_parabola() (setup_sysvar) (setvar "PDMODE" 32) (setvar "PDSIZE" -3) (setq half_pi (* 0.5 pi) two_pi (* 2.0 pi) pnt_f '(2.0 0) pnt_org '(0 0) y_up '(0 4) y_down '(0 -4) x_left '(-2 0) x_right '(4 0) chr_size 0.3 dir_up '(-2 4) dir_down '(-2 -4) pnt_h '(-2 0) ) (make_pt "0" 0 pnt_f) (mark_id pnt_f "F" 2 chr_size) (mark_id y_up "y" 1 chr_size) (mark_id x_right "x" 1 chr_size) (mark_id pnt_org "O" 1 chr_size) (make_line_1 "0" 8 y_up y_down) (make_line_1 "0" 8 x_left x_right) (make_line_1 "0" 8 dir_up dir_down) (command "_.zoom" "_EXTENT" ) ) ;;; ---------------hypo-cycloid case ------------------------- ;;; ;astroid created by an envelop (defun c:envelop_8() (setvar "PDMODE" 32) (setq line_length 4.0 x_left '(-4.5 0) x_right '(4.5 0) y_up '(0 4.5) y_down '(0 -4.5) l_sqrd (* line_length line_length) ) (command "_.line" x_left x_right "") (command "_.line" y_down y_up "") (command "_.zoom" "_EXTENT" ) (while (setq pnt_temp (cadr (grread T))) (setq temp_y (cadr pnt_temp) pnt_ref (list 0.0 temp_y) ) (if (<= (abs temp_y ) line_length) (setq temp_x (sqrt (- l_sqrd (* temp_y temp_y)))) (setq temp_x 0.0) ;dummy for out of range case ) (setq r_new_x (list temp_x 0.) l_new_x (list (- temp_x) 0.)) (if (<= (abs temp_y ) line_length) (command "_.line" l_new_x pnt_ref r_new_x "") ) ) ) ;envelop by a circle along parabola (defun c:env_c1() (setvar "PDMODE" 32) (setvar "PDSIZE" -1) (setq pnt_origin '(0 0) x_left '(-45 0) x_right '(45 0) y_up '(0 45) y_down '(0 -45) ) (command "_.line" x_left x_right "") (command "_.line" y_down y_up "") (command "_.zoom" "_EXTENT" ) (while (setq pnt_temp (cadr (grread T))) (setq temp_y (cadr pnt_temp) temp_x (* 0.125 (* temp_y temp_y)) pnt_ref (list temp_x temp_y) temp_radius (distance pnt_ref pnt_origin) ) (command "_.point" pnt_ref) (command "_circle" pnt_ref temp_radius) ) ) ;envelop by a circle along hyperbola (defun c:env_c2() (setvar "PDMODE" 32) (setq pnt_origin '(0 0) x_left '(-5 0) x_right '(5 0) y_up '(0 5) y_down '(0 -5) ) (command "_.line" x_left x_right "") (command "_.line" y_down y_up "") (command "_.zoom" "_EXTENT" ) (while (setq pnt_temp (cadr (grread T))) (setq temp_y (cadr pnt_temp) temp_x (sqrt (+ 1.0 (* temp_y temp_y))) pnt_ref1 (list temp_x temp_y) pnt_ref2 (list (- temp_x) temp_y) temp_radius (distance pnt_ref1 pnt_origin) ) (command "_.point" pnt_ref1) (command "_.point" pnt_ref2) (command "_circle" pnt_ref1 temp_radius) (command "_circle" pnt_ref2 temp_radius) ) ) ;envelop by a circle along an ellipse (defun c:env_c3() (setvar "PDMODE" 32) (setq pnt_origin '(0 0) x_left '(-4.5 0) x_right '(4.5 0) y_up '(0 4.5) y_down '(0 -4.5) ) (command "_.point" '(0 2)) (command "_.point" '(0 -2)) (command "_.line" x_left x_right "") (command "_.line" y_down y_up "") (command "_.zoom" "_EXTENT" ) (while (setq pnt_temp (cadr (grread ))) (setq temp_y (cadr pnt_temp) temp_x (sqrt (- 9.0 (* 2.15 (* temp_y temp_y)))) pnt_ref1 (list temp_x temp_y) pnt_ref2 (list (- temp_x) temp_y) temp_radius (distance pnt_ref1 pnt_origin) ) (command "_.point" pnt_ref1) (command "_.point" pnt_ref2) (command "_circle" pnt_ref1 temp_radius) (command "_circle" pnt_ref2 temp_radius) ) ) ;envelop of circles on a circle with a selcted ref_point (defun c:env_c4() (setvar "PDMODE" 32) (setq ref_rad 2.0) (setq pnt_s '(-1.5 0) pnt_center '(0 0)) (command "_.point" pnt_s) (command "_circle" '(0 0) ref_rad) (command "_.line" '(0 -3) '(0 3) "") (command "_.line" '(-3 0) '(3 0) "") (command "_.zoom" "_EXTENT" ) (while (setq pnt_temp (cadr (grread T))) (setq temp_angle (angle pnt_center pnt_temp) temp_x (* (cos temp_angle) ref_rad) temp_y (* (sin temp_angle) ref_rad) cir_loc (list temp_x temp_y) temp_rad (distance cir_loc pnt_s) ) (command "_circle" cir_loc temp_rad) ) ) ;special cas eof env_c4 -- cardioid ref_point is on the circle. (defun c:env_c5() (setvar "PDMODE" 32) (setq ref_rad 2.0) (setq pnt_s '(-2.0 0) pnt_center '(0 0)) (command "_.point" pnt_s) (command "_circle" '(0 0) ref_rad) (command "_.line" '(0 -3) '(0 3) "") (command "_.line" '(-3 0) '(3 0) "") (command "_.zoom" "_EXTENT" ) (while (setq pnt_temp (cadr (grread T))) (setq temp_angle (angle pnt_center pnt_temp) temp_x (* (cos temp_angle) ref_rad) temp_y (* (sin temp_angle) ref_rad) cir_loc (list temp_x temp_y) temp_rad (distance cir_loc pnt_s) ) (command "_circle" cir_loc temp_rad) ) ) ;special case eof env_c3 -- ref_point is outside of the circle. (defun c:env_c6() (setvar "PDMODE" 32) (setq ref_rad 2.0) (setq pnt_s '(-3.0 0) pnt_center '(0 0)) (command "_.point" pnt_s) (command "_circle" '(0 0) ref_rad) (command "_.line" '(0 -3) '(0 3) "") (command "_.line" '(-3 0) '(3 0) "") (command "_.zoom" "_EXTENT" ) (while (setq pnt_temp (cadr (grread T))) (setq temp_angle (angle pnt_center pnt_temp) temp_x (* (cos temp_angle) ref_rad) temp_y (* (sin temp_angle) ref_rad) cir_loc (list temp_x temp_y) temp_rad (distance cir_loc pnt_s) ) (command "_circle" cir_loc temp_rad) ) ) ;the last example of Cindy & Rollett (defun c:envelop_9() (setvar "PDMODE" 32) (setq x_left '(-3 0) x_right '(3 0) y_up '(0 3) y_down '(0 -3) ) (command "_.line" x_left x_right "") (command "_.line" y_down y_up "") (command "_circle" '(0 0) 2.0) (command "_.zoom" "_EXTENT" ) (while (setq pnt_temp (cadr (grread T))) (setq temp_x (car pnt_temp) temp_arg (- 4.0 (* temp_x temp_x)) ) (if (>= temp_arg 0.0) (setq temp_y (sqrt temp_arg)) (setq temp_y 0.0) ) (setq pnt_ref (list temp_x 0.0)) (if (>= temp_arg 0.0) (command "_circle" pnt_ref temp_y) ) ) ) ;cardioid & limacon trial version 8/13/98 (defun c:cardioid() (setq pnt_o '(0 0) length 1.0) (command "_.line" '(-5 0) '(5 0) "") (command "_.line" '(0 -5) '(0 5) "") (command "_circle" '(0 1.) "1.0") (command "_.zoom" "e" ) (while (setq pnt_temp (cadr (grread T))) (setq theta (angle pnt_o pnt_temp) a (tan theta) two_a (* 2.0 a) denom (+ 1.0 (* a a)) ) (setq int_x (/ two_a denom) int_y (* a int_x) pnt_int (list int_x int_y) ) (setq far_end (polar pnt_int theta length) near_end (polar pnt_int (+ theta pi) length) ) (command "_.line" near_end pnt_int far_end "") ) ) ;utility function for tangent (defun tan( theta / sine cosine tangent) (setq sine (sin theta) cosine (cos theta) tangent (/ sine cosine) ) ) ;cissoid trial version 8/13/98 (defun c:cissoid() (setq pnt_o '(0 2) length 1.0) (command "_.line" '(-4 0) '(4 0) "") (command "_.line" '(0 -1) '(0 4) "") (command "_circle" '(0 1.) "1.0") (command "_.zoom" "e" ) (while (setq pnt_temp (cadr (grread T))) (setq coord_x (car pnt_temp) pnt_base (list coord_x 0.) ) (setq theta (angle pnt_base pnt_o ) a (tan theta) two_a (* 2.0 a) denom (+ 1.0 (* a a)) ) (setq int_x (- (/ two_a denom)) int_y (+ 2.0 (* a int_x)) pnt_int (list int_x int_y) ) (setq ref_dist (distance pnt_int pnt_base) near_end (polar pnt_o (+ theta pi) ref_dist) ) (command "_.line" near_end pnt_base "") ) ) (defun c:cissoid2() (setvar "PDMODE" 32) (setvar "PDSIZE" 0.005) (setq pnt_o '(0 2) length 1.0) (command "_.line" '(-4 0) '(4 0) "") (command "_.line" '(0 -1) '(0 4) "") (command "_circle" '(0 1.) "1.0") (command "_.zoom" "e" ) (while (setq pnt_temp (cadr (grread T))) (setq coord_x (car pnt_temp) pnt_base (list coord_x 0.) ) (setq theta (angle pnt_base pnt_o ) a (tan theta) two_a (* 2.0 a) denom (+ 1.0 (* a a)) ) (setq int_x (- (/ two_a denom)) int_y (+ 2.0 (* a int_x)) pnt_int (list int_x int_y) ) (setq ref_dist (distance pnt_int pnt_base) near_end (polar pnt_o (+ theta pi) ref_dist) ) (command "_.point" near_end ) ) ) ;test #2 draw a line from (0 0) following the cursor location (defun radial_2() (setq pnt_0 '(0 0)) (while (setq pnt_1 (cadr (grread T))) (command "_.line" pnt_0 pnt_1 "") ) ) ;test #3 ESC key interrupt test (defun test_3() (setq pnt_0 '(0 0)) (while (setq gd (grread T)) (setq temp (car gd)) (prin1 temp) ) ) ;;; ;;;************************************************************************ ;;; Function: NORMAL_BISECTOR_END ;;; ;;; compute two end points of a normal bisector ;;; (defun NORMAL_bisector_end( pnt_1 pnt_2 / ang_12 line_length left_ang right_ang half_pi ) (setq half_pi (/ pi 2.0)) (setq pnt_0 (plt pnt_1 pnt_2 0.5) ang_12 (angle pnt_1 pnt_2) line_length (distance pnt_1 pnt_2) left_ang (+ ang_12 half_pi) right_ang (- ang_12 half_pi) pnt_left (polar pnt_0 left_ang line_length) pnt_right (polar pnt_0 right_ang line_length) ) );NORMAL_BISECTOR_END ;;; ;;;************************************************************************ ;;; Function: PLT ;;; ;;; get a point off the line segment defined by two end points and angle. ;;; ; utility routine ;; get a point along the line segment defined by two end points ;; ;; pnt_a pnt_b end points ;; loc_from_a ratio of distance from a to length AB ;; output point data (x,y) (defun PLT (pnt_a pnt_b loc_from_a / xa xb ya yb dist_ab dx dy xm ym ) (setq xa (car pnt_a) ya (cadr pnt_a) xb (car pnt_b) yb (cadr pnt_b) dx (- xb xa) dy (- yb ya) xm (+ xa (* loc_from_a dx)) ym (+ ya (* loc_from_a dy)) ) (list xm ym ) );PLT ; ;parabola #BASIC (defun c:parabola_1() (setvar "PDMODE" 32) (setq pnt_f '(1 0) x_left '(-1 0) x_right '(10 0) y_low '(-1 -10) y_up '(-1 10) ) (command "_.point" pnt_f) (command "_.line" x_left x_right "") (command "_.line" y_low y_up "") (command "_.zoom" "_EXTENT" ) (alert "\npick a point near x = -1 line") (while (setq pnt_temp (cadr (grread ))) (setq temp_y (cadr pnt_temp) pnt_ref (list -1 temp_y) pnt_ref_right (list 10 temp_y) ) (normal_bisector_end pnt_ref pnt_f) (setq para_pnt (inters pnt_left pnt_right pnt_ref pnt_ref_right nil)) (command "_.point" para_pnt) );end of while loop );;PARABOLA_1 ;;; ;;; ;;;Tick mark at the midpoint of a line to show two line length ;;;are the same. options:1,2 & 3 tick marks ;;;line_tick_mark ;;; (defun line_tick_mark(pnt_1 pnt_2 option color_id / pnt_mid t_list pnt_a pnt_b pnt_ae pnt_be) (setq pnt_mid (plt pnt_1 pnt_2 0.5)) (make_line_1 "0" 8 pnt_1 pnt_2) (command "_.rotate" (entlast) "" pnt_mid 90.) (setq t_list (entget (entlast)) pnt_a (cdr (assoc 10 t_list)) pnt_b (cdr (assoc 11 t_list)) pnt_ae (plt pnt_a pnt_b 0.45) pnt_be (plt pnt_a pnt_b 0.55) ) (entdel (entlast)) ;;option :1 (if (= option 1) (make_line_1 "0" color_id pnt_ae pnt_be)) ;;option :2 (if (= option 2) (progn (make_line_1 "0" color_id pnt_ae pnt_be) (command "_.copy" (entlast) "" pnt_mid pnt_mid) (command "_.rotate" (entlast) "" pnt_mid 45.) ) );;;end if ;;option :3 (if (= option 3) (progn (make_line_1 "0" color_id pnt_ae pnt_be) (command "_.copy" (entlast) "" pnt_mid pnt_mid) (command "_.rotate" (entlast) "" pnt_mid 45.) (command "_.copy" (entlast) "" pnt_mid pnt_mid) (command "_.rotate" (entlast) "" pnt_mid 90.) ) );;;end if ) ;;; ;;;Mark_right_angle ;;; ;;; ;;;mark_right_angle ;;; (defun mark_right_angle(pnt_a pnt_o pnt_b col_id side_len / pnt_c pnt_d pnt_e pnt_m) (if (= side_len 0) (setq side_len (* 0.1 (distance pnt_a pnt_o))) ) (setq pnt_c (pld pnt_o pnt_a side_len) pnt_e (pld pnt_o pnt_b side_len) pnt_m (plt pnt_c pnt_e 0.5) pnt_d (plt pnt_o pnt_m 2.0) ) (make_line_1 "0" col_id pnt_c pnt_d) (make_line_1 "0" col_id pnt_d pnt_e) ) ;;; ;;; ;;; ;;;slow_rotate3d_origami rotate3d slow display origami version ;;; (defun slow_rotate3d_origami(3d_ent ax_1 ax_2 rot_angle ) (setq n_repeat 12 n_repeat_return 8 del_th (/ (float rot_angle) n_repeat) min_del_th (- (/ (float rot_angle) n_repeat_return) ) ) (repeat n_repeat (command "_.rotate3d" 3d_ent "" "2" ax_1 ax_2 del_th) (setq temp (entlast)) (make_jpg) (command "_.delay" 100) ) (command "_.delay" 1000) (repeat n_repeat_return (command "_.rotate3d" temp "" "2" ax_1 ax_2 min_del_th) (setq temp (entlast)) (make_jpg) (command "_.delay" 50) ) );;; ;;;