hamidciv Posted February 26, 2015 Posted February 26, 2015 hi every body i need one command that can drawing arc of circle with given length, radius, central angle, whether exist this command in autolisp or visual lisp? i expressed my mean in below figure. please help me Quote
hanhphuc Posted February 27, 2015 Posted February 27, 2015 commandline Command: arc ARC Specify start point of arc or : c Specify center point of arc: Specify start point of arc: Specify end point of arc or [Angle/chord Length]: a Specify included angle: 23 command or vl-cmdf ([color="blue"]command[/color] "arc" "c" [color="green"]Center StartPoint[/color] "a" [color="green"]degree[/color]) autolisp method: ([color="blue"]entmakex [/color] (list '(0 . "ARC")(cons 10 [color="green"]Center[/color])(cons 40 [color="green"]Radius[/color])(cons 50 [color="green"]StartAngle[/color])(cons 51 [color="green"]EndAngle[/color]))) GREEN TEXT is argument/variable can be replaced by input value or using functions: getpoint , getreal or getstring etc.. Quote
SEANT Posted February 27, 2015 Posted February 27, 2015 (edited) Interesting math problem. I don't know lisp, but if we set up those angled lines such that the bisector was vertical then those rays should be rotated by: ACOS(d2/(2*rad1*SIN(ang4/2.0))) Edited February 28, 2015 by SEANT Changed from ASIN to ACOS Quote
eldon Posted February 27, 2015 Posted February 27, 2015 Interesting math problem. Yes, it is quite easy to construct. But as the OP wanted a one button solution, I was keeping my head below the parapet. Quote
SEANT Posted February 27, 2015 Posted February 27, 2015 Yes, it is quite easy to construct. But as the OP wanted a one button solution, I was keeping my head below the parapet. There are old warriors. There are daring warriors. There are no daring, old warriors. Quote
BIGAL Posted February 27, 2015 Posted February 27, 2015 Something overlooked you have 3 variables but the d and the angle are independent only one can be used but op asked for all 3 only 1 solution as shown in image change angle d changes Quote
SEANT Posted February 28, 2015 Posted February 28, 2015 I don't think the 2.1 (d2) is intended to be the chord. If it were the chord, then the ang4 and d2 could not vary. I think d2 is the projection of the chord based on the rotation angle of the system. So, for instance, if d2 needed to be 1.5, the system would need further rotation. Incidentally, my first equation did have the error of using ASIN instead of ACOS. Quote
eldon Posted February 28, 2015 Posted February 28, 2015 In another thread by the OP (since deleted), the central angle seemed to vary. The radius and two parallel vertical lines were constant. As the central angle could vary between 49.4584 degrees and 20.1573 degrees (approximately) I was wondering whether there would be further information. But with the information in this thread, there is only one solution. Not having access to Constraints, I wonder if there is an easy solution using them. Quote
Lee Mac Posted February 28, 2015 Posted February 28, 2015 Interesting math problem. I don't know lisp, but if we set up those angled lines such that the bisector was vertical then those rays should be rotated by:ACOS(d2/(2*rad1*SIN(ang4/2.0))) Agreed - this was my derivation: Though, there are of course 4 possible solutions - one of each quadrant of the circle. Quote
Lee Mac Posted February 28, 2015 Posted February 28, 2015 A quickly-written LISP solution: (defun c:myarc ( / a b c d r x ) (initget 1025) (setq c (getpoint "\nSpecify center: ")) (initget 1095) (setq r (getdist "\nSpecify radius: " c)) (initget 1027) (setq b (getangle "\nSpecify included angle: ")) (initget 1093) (setq d (getdist "\nSpecify horizontal distance: ") a (acos (/ d 2 r (sin (/ b 2)))) x (/ pi 2) ) (repeat 2 (repeat 2 (entmake (list '(0 . "ARC") (cons 10 c) (cons 40 r) (cons 50 (+ x a (/ b -2))) (cons 51 (+ x a (/ b 2))) ) ) (setq a (- a)) ) (setq x (+ pi x)) ) (princ) ) ;; ArcCosine - Lee Mac ;; Args: -1 <= x <= 1 (defun acos ( x ) (if (<= -1.0 x 1.0) (atan (sqrt (- 1.0 (* x x))) x) ) ) (princ) Quote
SEANT Posted February 28, 2015 Posted February 28, 2015 Our derivation methods are pretty much identical. Diving into these kinds of problems helps prevent math skills from getting rusty. Rust never sleeps. Quote
Lee Mac Posted February 28, 2015 Posted February 28, 2015 I couldn't agree more - it's reassuring to know that I haven't forgotten it all just yet Quote
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.