pman860507 Posted September 1, 2011 Posted September 1, 2011 I'm sure there is a way to do this. i am using the command "arc" in my lisp file. and my mid point and my end point i need to store as a variable. at the moment it looks like this. but i would like it to work like the normal arc command showing the arc. (command "arc" cent (setq mid (getpoint cent)) (setq pnt (getpoint mid))) As Always thanks. What i really need is the end point of the arc. i know there is a visal lisp way of doing this but i know nothing about that. Quote
alanjt Posted September 1, 2011 Posted September 1, 2011 ?? (defun _arc (centerpoint / ent) (setq ent (entlast)) (command "_.arc" "_c" "_non" centerpoint) (while (eq (logand 1 (getvar 'CMDACTIVE)) 1) (command PAUSE)) (if (not (equal ent (setq ent (entlast)))) ent ) ) (defun c:Test (/ point arc) (vl-load-com) (if (and (setq point "\nSpecify center point: ") (setq arc (_arc point)) ) (vlax-curve-getEndPoint arc) ) ) Also/or, look at the LASPOINT variable. (getvar 'LASTPOINT) Quote
Lee Mac Posted September 1, 2011 Posted September 1, 2011 Or, to use just Vanilla: (defun c:Test ( / point arc ) (if (and (setq point (getpoint "\nSpecify center point: ")) (setq arc (_arc point)) (setq arc (entget arc)) ) (polar (cdr (assoc 10 arc)) (cdr (assoc 51 arc)) (cdr (assoc 40 arc)) ) ) ) (using the '_arc' function as posted by Alan) Quote
alanjt Posted September 1, 2011 Posted September 1, 2011 Or, to use just Vanilla: (defun c:Test ( / point arc ) (if (and (setq point (getpoint "\nSpecify center point: ")) (setq arc (_arc point)) (setq arc (entget arc)) ) (polar (cdr (assoc 10 arc)) (cdr (assoc 51 arc)) (cdr (assoc 40 arc)) ) ) ) (using the '_arc' function as posted by Alan) LoL, I knew you were going to come along and post the vanilla way. I guess I shouldn't be so lazy. Quote
pman860507 Posted September 1, 2011 Author Posted September 1, 2011 Thanks the (getvar 'lastpoint) worked great also didnt make me change a lot of my code. again Thanks. Quote
alanjt Posted September 1, 2011 Posted September 1, 2011 Thanks the (getvar 'lastpoint) worked great also didnt make me change a lot of my code. again Thanks. I'd use the _arc command I posted and Lee's extraction method (no VLA required) - it's a lot more stable/reliable. Quote
Lee Mac Posted September 1, 2011 Posted September 1, 2011 LoL, I knew you were going to come along and post the vanilla way. I guess I shouldn't be so lazy. We are spoilt with the curve* functions Quote
alanjt Posted September 1, 2011 Posted September 1, 2011 We are spoilt with the curve* functions I couldn't agree more. I know how to get it the other way, but the vlax-curve* function just let's me be far too lazy. Quote
pman860507 Posted September 1, 2011 Author Posted September 1, 2011 well it doesnt work like i need it to. which is my fault i didnt explain how i needed it to work. Select startpoint. (which is already defined as the insertion point of the object selected. Then select midpoint. Then select endpoint. Quote
alanjt Posted September 1, 2011 Posted September 1, 2011 well it doesnt work like i need it to. which is my fault i didnt explain how i needed it to work. Select startpoint. (which is already defined as the insertion point of the object selected. Then select midpoint. Then select endpoint. Well, your original code has 'cent', so I assumed you were wanting to begin with the CENTER of the curve. The more information you provide, the better results you receive and the less time spent by others, trying to help. (defun _arc (startpoint / ent) (setq ent (entlast)) (command "_.arc" "_non" startpoint) (while (eq (logand 1 (getvar 'CMDACTIVE)) 1) (command PAUSE)) (if (not (equal ent (setq ent (entlast)))) ent ) ) Quote
pman860507 Posted September 1, 2011 Author Posted September 1, 2011 Sorry about that. its actually the center point/Insertion point of the object that's selected. Forgive me. thanks for the updated code. will check it out. Quote
alanjt Posted September 1, 2011 Posted September 1, 2011 Sorry about that. its actually the center point/Insertion point of the object that's selected. Forgive me. thanks for the updated code. will check it out. No worries. Quote
ayuksel Posted May 11, 2017 Posted May 11, 2017 Hi everyone, I just do not understand a simple thing (Sorry for resurrecting the topic btw). I just need to draw two arcs, connect with two lines and subtract (extruded cut) the generated shape from a 3D solid I already drew. Here is my solid. I don't know how to write arc command. (command "arc" ........ What should I write for the rest? Variables? Center point? Start point? Is there any reference book you can suggest that shows how to use AutoCAD commands by AutoLISP? I always have trouble AutoCAD commands like (command "something" ......) Thanks for bearing with my dumb questions. Quote
alanjt Posted May 11, 2017 Posted May 11, 2017 Hi everyone, I just do not understand a simple thing (Sorry for resurrecting the topic btw). I just need to draw two arcs, connect with two lines and subtract (extruded cut) the generated shape from a 3D solid I already drew. Here is my solid. I don't know how to write arc command. (command "arc" ........ What should I write for the rest? Variables? Center point? Start point? Is there any reference book you can suggest that shows how to use AutoCAD commands by AutoLISP? I always have trouble AutoCAD commands like (command "something" ......) Thanks for bearing with my dumb questions. When trying to replicate a native command, the easiest thing is to step through the command and fill in appropriate data, based on prompts. eg. Command: a ARCSpecify start point of arc or : Specify second point of arc or [Center/End]: e Specify end point of arc: Specify center point of arc (hold Ctrl to switch direction) or [Angle/Direction/Radius]: r Specify radius of arc (hold Ctrl to switch direction): 50 would translate to (if (and (setq p1 (getpoint "\nSpecify first point: ")) (setq p2 (getpoint "\nSpecify end point: ")) (setq rad (getreal "\nSpecify radius: ")) ) (command "_.arc" "_non" p1 "_e" "_non" p2 "_radius" rad) ) The "_non" should always precede a point call so as to ignore any running osnaps. Quote
ayuksel Posted May 11, 2017 Posted May 11, 2017 When trying to replicate a native command, the easiest thing is to step through the command and fill in appropriate data, based on prompts. eg. would translate to (if (and (setq p1 (getpoint "\nSpecify first point: ")) (setq p2 (getpoint "\nSpecify end point: ")) (setq rad (getreal "\nSpecify radius: ")) ) (command "_.arc" "_non" p1 "_e" "_non" p2 "_radius" rad) ) The "_non" should always precede a point call so as to ignore any running osnaps. Thanks a lot for your kind help! In my code there are also lots of "line" commands. Should I write "_non" for line commands as well? Thanks, Quote
alanjt Posted May 11, 2017 Posted May 11, 2017 Thanks a lot for your kind help! In my code there are also lots of "line" commands. Should I write "_non" for line commands as well? Thanks, ANYTIME a point would be specified, precede with "_non". Quote
ayuksel Posted May 11, 2017 Posted May 11, 2017 ANYTIME a point would be specified, precede with "_non". Thank you sir, your suggestions helped me a lot. But, I don't know how to change the direction of the arc. Please see the picture. I need the arc in other direction. Quote
ayuksel Posted May 11, 2017 Posted May 11, 2017 ANYTIME a point would be specified, precede with "_non". Thank you again, Last question I hope: How can I reverse the direction of the arc? Quote
ayuksel Posted May 11, 2017 Posted May 11, 2017 ANYTIME a point would be specified, precede with "_non". Thanks @alanjt I tried to post one more question here but somehow I couldn't succeed. 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.