V-SAM Posted June 26, 2013 Posted June 26, 2013 HELP !! I am looking for a quick way to key-in 3 dimensions and then have a rectangle polyline drawn and closed. It could automatically start drawing at 0,0,0 The three user entries would be A, B, C where A and C would be different and the program would close the object. See attached for a better explanation. I appreciate any input on this.. I am not very good at writing lisps but i have good visions THanks guys you are the best. Document1.pdf Quote
ReMark Posted June 26, 2013 Posted June 26, 2013 Why do you need a lisp routine to draw that shape? It could all be done at the command line very quickly. Command: _pline Specify start point: Current line-width is 0.0000 Specify next point or [Arc/Halfwidth/Length/Undo/Width]: 10 Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]: 4 Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]: 14 Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]: c Quote
V-SAM Posted June 26, 2013 Author Posted June 26, 2013 I know it is very simple... however I have an engineer who wants to just type in three dimensions and nothing else and have it done for him... Quote
V-SAM Posted June 26, 2013 Author Posted June 26, 2013 An help would be appreciative.. THank you again. Quote
ReMark Posted June 26, 2013 Posted June 26, 2013 I see. I think I'll stop now before I say something I'll regret. I'm sure one of the lisp gurus here can solve this dilemma for your engineer in no time flat. Good luck and happy coding. Quote
Tharwat Posted June 26, 2013 Posted June 26, 2013 This one ? (defun c:Test (/ i x p pt l) (setq i 0 x '("First" "Second" "Third" "Fourth") ) (while (and (not (eq (length l) 4)) (if pt (setq p (getpoint (strcat "\n" (nth i x) " point :") pt)) (setq p (getpoint (strcat "\n" (nth i x) " point :"))) ) (setq pt p) ) (setq l (cons p l) i (1+ i) ) ) (if (eq (length l) 4) (command "_.pline" "_non" (car l) "_non" (cadr l) "_non" (caddr l) "_non" (nth 3 l) "c" ) ) (princ) ) Quote
ReMark Posted June 26, 2013 Posted June 26, 2013 And they all lived happily ever after. The End. Quote
alanjt Posted June 26, 2013 Posted June 26, 2013 (edited) Feeling generous... (defun c:Test (/ a b c p1 p2) (if (and (progn (initget 6) (setq a (getdist "\nSpecify length of side A: "))) (progn (initget 6) (setq b (getdist "\nSpecify length of side B: "))) (progn (initget 6) (setq c (getdist "\nSpecify length of side C: "))) (setq p1 (getpoint "\nSpecify intersection of sides A and C: ")) ) (command "_.pline" "_non" (mapcar '+ p1 (list 0. a 0.)) "_non" p1 "_non" (setq p2 (mapcar '+ p1 (list c 0. 0.))) "_non" (mapcar '+ p2 (list 0. b 0.)) "_close" ) ) (princ) ) Edited June 26, 2013 by alanjt Quote
V-SAM Posted June 26, 2013 Author Posted June 26, 2013 YOU ARE AWESOME THAT WORKS GREAT .. I know it is simple and really un-needed but i appreciate still the same. Quote
V-SAM Posted June 26, 2013 Author Posted June 26, 2013 One small thing....What would I change to make this startt drawing the polyline at 0,0,0 ?? Quote
alanjt Posted June 26, 2013 Posted June 26, 2013 (defun c:Test (/ a b c) (initget 6) (if (and (setq a (getdist "\nSpecify length of side A: ")) (progn (initget 6) (setq b (getdist "\nSpecify length of side B: "))) (progn (initget 6) (setq c (getdist "\nSpecify length of side C: "))) ) (command "_.pline" "_non" (list 0. a 0.) "_non" '(0. 0. 0.) "_non" (list c 0. 0.) "_non" (list c b 0.) "_close" ) ) (princ) ) Quote
V-SAM Posted June 26, 2013 Author Posted June 26, 2013 Works great thank you gentleman... As always you always amaze me. Quote
ReMark Posted June 26, 2013 Posted June 26, 2013 You should see these guys when they are faced with a real challenge...they're simply amazing. 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.