nura235 Posted December 8, 2012 Posted December 8, 2012 Hi, I am new to autolisp and created a lisp which help me automate 1 of my daily task. Here is the code of the lisp. (defun C:test (/); (while (setq P1 (getpoint "\nSpecify insert point for arrow: ")) (command ".-Insert" "BLOCKA" P1 "1" "1" pause) ;insert block (command "ARC" P1 pause pause) ; create arc (command ".-Insert" "BLOCKB" pause "1" "1" "0") ; insert block (command "EXPLODE" (ssget "L" )) ;explode object ) (command "_ddedit" (ssget "L" ))(command) ;Edit text (command ".move" (ssget "L") "" pause pause));Edit number (princ) ) i have also attached the image and cad file for more understanding. What I am thinking that numbers of steps can be reduced from the above script for more efficient working. For eg: - 2nd point of arc may be automatically pick the center point of the arrow. - After placing and editing "blockb" the move of the object should come rather then picking/selecting up the number you just entered. So i request to people in this forum who can highlight or provide solution for them. Let me know if you need any other information or need to be more clear. Regards nura TEST.dwg Quote
GP_ Posted December 8, 2012 Posted December 8, 2012 Try (defun C:test (/ P1 P2 P3) (while (setq P1 (getpoint "\nSpecify insert point for arrow: ")) (command "_-Insert" "BLOCKA" P1 "1" "1" pause ) (setq P2 (cadr (grread T))) (setq P3 (polar P1 (angle P1 P2) 2.2453)) (command "_pline" P1 P3 "_A" pause "") (command "_-Insert" "BLOCKB" pause "1" "1" "0") (command "_EXPLODE" "_L") (command "_ddedit" "_L" "") (command "._move" "_L" "" pause pause) ) (princ) ) Quote
nura235 Posted December 8, 2012 Author Posted December 8, 2012 Hi GP you lisp work for me to reduce a number of step. However is there any possibility to autopick the base point of displacement to center(middle) of the text so that another single can be reduced. Anyway thanks for your effort. and please explain if you can, so that i can learn from it. what does "grread T" and "2.2453" mean for here? Best Regards, nura Try (defun C:test (/ P1 P2 P3) (while (setq P1 (getpoint "\nSpecify insert point for arrow: ")) (command "_-Insert" "BLOCKA" P1 "1" "1" pause ) (setq P2 (cadr (grread T))) (setq P3 (polar P1 (angle P1 P2) 2.2453)) (command "_pline" P1 P3 "_A" pause "") (command "_-Insert" "BLOCKB" pause "1" "1" "0") (command "_EXPLODE" "_L") (command "_ddedit" "_L" "") (command "._move" "_L" "" pause pause) ) (princ) ) Quote
GP_ Posted December 8, 2012 Posted December 8, 2012 In order not to upset your routine ... (defun C:test (/ P1 P2 P3 P4) (while (setq P1 (getpoint "\nSpecify insert point for arrow: ")) (command "_-Insert" "BLOCKA" P1 "1" "1" pause ) (setq P2 (cadr (grread T))) (setq P3 (polar P1 (angle P1 P2) 2.2453)) (command "_pline" P1 P3 "_A" pause "") (command "_-Insert" "BLOCKB" pause "1" "1" "0") (command "_EXPLODE" "_L") (command "_ddedit" "_L" "") (command "_justifytext" "_L" "" "MC" "") (setq P4 (cdr (assoc 11 (entget (entlast))))) (command "._move" "_L" "" P4 pause) ) (princ) ) Quote
GP_ Posted December 8, 2012 Posted December 8, 2012 (cadr (grread T)) -> Capture the cursor position on the screen. Quote
nura235 Posted December 9, 2012 Author Posted December 9, 2012 thank to you and cad tutor forum. (cadr (grread T)) -> Capture the cursor position on the screen. [ATTACH=CONFIG]39111[/ATTACH] 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.