Evolution Posted July 19, 2022 Posted July 19, 2022 I want to make a script, which creates a square, where lines are joined, and corner are filled radius 5 And further more a text in the middle of the square Here is what i got so far _line 0,0 560,0 560,490 0,490 0,0 - works _SELECT 280,0 560,245 JOIN .....join all ....filled in every corner R5 .....insert a text in the middle of the square Couldnt find anything on google, that really helped Quote
mhupp Posted July 19, 2022 Posted July 19, 2022 not really a script but should get you what you need. Pick the midpoint of the rectangle creates points LL and UR creates rectangle from points. changes fillet radius to 5 fillets rectangle adds text to middle of rectangle run lisp by either typing TXTREC or TR ;;----------------------------------------------------------------------;; ;; CREATE RECTANGLE W\ TEXT IN MIDDLE (defun C:TXTREC (/ MPT LL UR) (setq MPT (getpoint "\nPick Midpoint") LL (mapcar '- MPT '(280 245 0)) ;change the values here to 1/2 the length and width of rectangle you want UR (mapcar '+ MPT '(280 245 0)) ;change the values here to 1/2 the length and width of rectangle you want ) (command "_.Rectangle" LL UR) (setvar 'filletrad 5) ;change to the fillet radius you want (command "_.Fillet" "P" (entlast)) (entmake (list '(0 . "TEXT") (cons 10 MPT) (cons 11 MPT) (cons 40 (getvar 'DIMTXT)) (cons 1 "text you want here") '(72 . 4) ) ) ) (defun C:TR () (C:TXTREC)) Quote
BIGAL Posted July 20, 2022 Posted July 20, 2022 (edited) Maybe (defun C:TXTREC (/ MPT LL UR L H rad) (setq MPT (getpoint "\nPick Midpoint") L (getreal "\Enter length ") H (getreal "\nEnter height ") rad (getreal "\nEnter radius ") LL (mapcar '- MPT (list (/ L 2.0) (/ H 2.0) 0)) UR (mapcar '+ MPT (list (/ L 2.0) (/ H 2.0) 0)) ) (command "_.Rectangle" LL UR) (setvar 'filletrad rad) ;change to the fillet radius you want (command "_.Fillet" "P" (entlast)) (entmake (list '(0 . "TEXT") (cons 10 MPT) (cons 11 MPT) (cons 40 (getvar 'DIMTXT)) (cons 1 "text you want here") '(72 . 4) ) ) ) (defun C:TR () (C:TXTREC)) I would use multi getvals.lsp Edited July 20, 2022 by BIGAL 1 Quote
steven-g Posted July 20, 2022 Posted July 20, 2022 Use the rectangle command as suggested which is quicker than drawing lines and then joining them, the fillet command also has various options available for using in an LT script. Try running the command and watch the command line which prompts you for input. So in your case you want to start the fillet command and the use the 'radius op[tion (which only needs the letter 'r' in a script followed by the radius you want, you are then prompted again for input and you see an option to select a polyline using the command modifier 'L' will select the last object created and then enter to accept the selection (enter is carried out by using a space or empty line in your script). When you then start the mtext command you can again use command modifiers to select the geometric center of the last object created. The mtext command in a script allows for various options if you watch the command line for the prompts 2 Quote
pendean Posted July 22, 2022 Posted July 22, 2022 See the reply in the LT forum post you started at Autodesk https://forums.autodesk.com/t5/autocad-lt-forum/puzzling-with-at-script-for-autocad/m-p/11311508#M195953 1 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.