aswini Posted May 23, 2012 Posted May 23, 2012 (edited) hi i'm very new to autolisp i'm leraning programming now-a-days,if we draw two circles with same center point and with different radius by using polararray how can we draw lines on the circle at different angles from 0 to 360degrees from the same center.If you help me it is very useful to me Thanks Edited May 23, 2012 by aswini Quote
MSasu Posted May 23, 2012 Posted May 23, 2012 You should look to POLAR function; it will take the angle argument in radians. Example of drawn from origin a 5 units line at 35 degrees: (command "_LINE" '(0 0) (polar '(0 0) (* (/ 35.0 180.0) pi) 5.0) "") Quote
aswini Posted May 23, 2012 Author Posted May 23, 2012 thanks for your reply,i'm getting that but it is not i wanted ,actually what i wanted is to draw 12 lines on two circles with 30degrees each at a time by using a program,can you help me to do that Thanks. Quote
BlackBox Posted May 23, 2012 Posted May 23, 2012 thanks for your reply,i'm getting that but it is not i wanted ,actually what i wanted is to draw 12 lines on two circles with 30degrees each at a time by using a program,can you help me to do that Then, since you 'get' what Mircea was kind enough to point out (to use the Polar LISP Function), simply repeat the process 12 times (to generate 12 lines), using your 30 degree increment each time in your own custom program. Quote
aswini Posted May 23, 2012 Author Posted May 23, 2012 hmm thanq i thought of that but it is becoming lenghty program. Quote
aswini Posted May 23, 2012 Author Posted May 23, 2012 If i draw a rectangle in the middle of two circles like in the attachment ,then how to repeat them around the circle with different angles.can anyone help me plz Thanks Drawing1.dwg Quote
BIGAL Posted May 24, 2012 Posted May 24, 2012 Moderator This is basicly the same question as the other post. Good time to learn lisp in particular LINE pt1 pt2 & Polar & Entsel Quote
BIGAL Posted May 24, 2012 Posted May 24, 2012 (edited) Moderator is this post 3 of the same question ? http://www.cadtutor.net/forum/showthread.php?69607-how-to-write-a-program-to-get-the-lines-like-in-the-attachment http://www.cadtutor.net/forum/showthread.php?69606-how-to-repeat-the-lines-by-using-autolisp Re lengthy you have not scratched the surface in HOW MANY LINES OF CODE. Also in your first post was the lines meant to go from the centre of the circle ? Edited May 24, 2012 by BIGAL Quote
Grant Posted May 24, 2012 Posted May 24, 2012 (edited) (command "array" "P" "0,0" "14" "360" "Y") There is a start: Type: (command "array") This will go through the options Edited May 24, 2012 by SLW210 Quote
MSasu Posted May 24, 2012 Posted May 24, 2012 becoming lenghty program. It will not if you will use REPEAT and increment the angle at each draw, instead of having one line of code for each item to be drawn. Quote
BIGAL Posted May 24, 2012 Posted May 24, 2012 Ok had my gripe an example like Msasu (setq ang 0.0) (repeat 10 (command "line" 0,0 (polar 0,0 ang 5) "") ;(command "line" Pt1 (polar pt1 ang dist) "") (setq ang (+ ang 1.256)) ) Your turn use entsel to find centre of circle pt1 then distance dist=circle1cenpt-circle2cenpt Quote
Tharwat Posted May 24, 2012 Posted May 24, 2012 Use command Array as Grant said before . But the two circles are not in the same center point , so the array of lines would exceed the limits of the outer circle . Quote
pBe Posted May 24, 2012 Posted May 24, 2012 For the fun of it: (defun c:FunArray ( / ss bp ang angl ) (setq ss (ssget)) (setvar 'osmode 5) (setq bp (getpoint "\nPick Base point:")) (while (setq ang (getint (strcat "\nEnter Angle" (if ang "/Enter for none: " ": ")))) (setq angl (cons ang angl))) (foreach aval angl (command "_array" ss "" "C" bp aval "2" "Y") ) (princ) ) Quote
aswini Posted May 24, 2012 Author Posted May 24, 2012 ya i want the lines from the center of the circle Quote
aswini Posted May 24, 2012 Author Posted May 24, 2012 while running this i got an error like bad argument type:2D/3D point:nil what is that mean? Thanks Quote
BIGAL Posted May 25, 2012 Posted May 25, 2012 "ya i want the lines from the center of the circle" when you see "Pick Base point" make sure your snap is set to "center" and pick circle edge. If in doubt at this point hold down shift and right button on mouse. Quote
pBe Posted May 25, 2012 Posted May 25, 2012 I would've thought the OP would want a copy of the two lines at a diffrent angles in one go, But reading the post again, maybe he meant a diffrent angle at one time. The first code i posted do just that. For this one, using a constant angle specified by the user: (defun c:FunArray (/ ss bp) (setq ss (ssget)) (setvar 'osmode 5) (setq bp (getpoint "\nPick Base point:")) (setq ang [b][color=blue](getangle[/color][/b] [b][color=blue] (strcat "\nEnter Angle"[/color][/b] [b][color=blue] (if ang[/color][/b] [b][color=blue] (strcat " <" (angtos ang) ">: ")[/color][/b] [b][color=blue] ": ")))[/color][/b]) [color=blue][b](initcommandversion 1)[/b][/color] (command "_array" ss "" "C" bp [b][color=blue](/ (* ang 180.0) pi)[/color][/b] [color=blue][b]"-360"[/b][/color] "Y") (princ) ) Besides Polar & Recatangular optioin, the array command also have "C" which accepts angles as input, then ask you for either number of items or angle to fill. HTH Quote
aswini Posted May 25, 2012 Author Posted May 25, 2012 (edited) I would've thought the OP would want a copy of the two lines at a diffrent angles in one go, But reading the post again, maybe he meant a diffrent angle at one time.The first code i posted do just that. For this one, using a constant angle specified by the user: (defun c:FunArray (/ ss bp) (setq ss (ssget)) (setvar 'osmode 5) (setq bp (getpoint "\nPick Base point:")) (setq ang [b][color=blue](getangle[/color][/b] [b][color=blue] (strcat "\nEnter Angle"[/color][/b] [b][color=blue] (if ang[/color][/b] [b][color=blue] (strcat " <" (angtos ang) ">: ")[/color][/b] [b][color=blue] ": ")))[/color][/b]) [color=blue][b](initcommandversion 1)[/b][/color] (command "_array" ss "" "C" bp [b][color=blue](/ (* ang 180.0) pi)[/color][/b] [color=blue][b]"-360"[/b][/color] "Y") (princ) ) Besides Polar & Recatangular optioin, the array command also have "C" which accepts angles as input, then ask you for either number of items or angle to fill. HTH It is working excellent thanq verymuch,i have onemore doubt if i want the input as only number of lines and not the angle,what i have to do?? Thanks Edited May 25, 2012 by aswini Quote
Tharwat Posted May 25, 2012 Posted May 25, 2012 @pBe , You are changing the OP osmode settings without re-set them back with (setvar 'osmode 5) 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.