jamesfui Posted December 17, 2011 Share Posted December 17, 2011 hi.. need help on creating lsp that can: > prompt selected circle overall diameter & change to new diameter if new value is inputed! (enter or right click) for no change i tried out the 'change' command for properties, but it only ask for the radius not the diameter... so need help on a lisp routine that can show/prompt/display diameter right beside the selected circle & if a new value is key in, the circle diameter changes instantly! thanks Quote Link to comment Share on other sites More sharing options...
pBe Posted December 17, 2011 Share Posted December 17, 2011 (defun c:test (/ cir ent z ) (while (setq cir (ssget ":E:L" '((0 . "CIRCLE")))) (setq cur (* (cdr (assoc 40 (setq ent (entget (ssname cir 0))))) 2) ) (redraw (ssname cir 0) 3) (setq z (cond ((getreal (strcat "\nEnter diameter[Enter to accept: <" (rtos (setq z cur) 2 2) ">: " ) ) ) (z) ) ) (entmod (subst (cons 40 (/ z 2.0)) (assoc 40 ent) ent ) ) ) (princ) ) Almost but not Quote Link to comment Share on other sites More sharing options...
alanjt Posted December 17, 2011 Share Posted December 17, 2011 I didn't realize multiplying and dividing by 2 was so difficult. Quote Link to comment Share on other sites More sharing options...
pBe Posted December 19, 2011 Share Posted December 19, 2011 I didn't realize multiplying and dividing by 2 was so difficult. Could've been worse, the OP coud have ask to prompt for diameter value using Sapi.SpVoice "Enter Diameter or Enter to accept current" Quote Link to comment Share on other sites More sharing options...
Dadgad Posted December 19, 2011 Share Posted December 19, 2011 I didn't realize multiplying and dividing by 2 was so difficult. It could be, if you had your precision setting to 10 decimal places, I suppose, and were running custom made drill bits, or using a CNC laser. I use rather mundane metric sizes, and have precision in mms set to no decimal places,which makes it a lot easier. If you forget where you put the lisp, you can select a circle or circles, and find and change the diameter in the QUICKPROPERTIES palette, which I use all the time. Customize so that it shows whatever info you are after, or in the regular PROPERTIES dialog box, under DIAMETER. Using lisp for something like this seems a bit like an exterminator showing up in a tank for a termite problem, IMO. So many ways to go, and yet all roads lead to home. Quote Link to comment Share on other sites More sharing options...
nalsur8 Posted December 20, 2011 Share Posted December 20, 2011 (defun C:TEST11 () (defun *error* (msg) (setq *error* nil) (princ)) (setq cirdia (entsel "\nPick circle to change...")) (setq entdia (entget (car cirdia))) (setq diarad (cdr (assoc 40 entdia))) (setq diame (* diarad 2)) (setq dia (getreal (strcat "\nEnter new diameter [current <"(rtos diame) ">]:"))) (prompt "\nSelect circle to change...") (setq A (ssget (list (cons '0 "circle")(cons '40 diarad)))) (setq B (sslength A)) (setq X 0) (repeat B (setq NAME (ssname A X)) (setq PARAM (entget NAME)) (setq CHECK (cdr (assoc 0 PARAM))) (if (/= CHECK "CIRCLE") (progn (ssdel NAME A) (setq X (1- X))) ) ;_ end of if (setq X (1+ X)) ) ;_ end of repeat (setq B (sslength A)) (setq RAD (/ DIA 2)) (setq NEWRAD (cons '40 RAD)) (setq X 0) (repeat B (setq NAME (ssname A X)) (setq PARAM (entget NAME)) (setq PARAM (subst NEWRAD (assoc 40 PARAM) PARAM)) (entmod PARAM) (setq X (1+ X)) ) ;_ end of repeat (prompt (strcat "Selected object - Qty:"(rtos b) "")) (princ) ) Quote Link to comment Share on other sites More sharing options...
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.