3dwannab Posted July 26, 2022 Posted July 26, 2022 (edited) I'm trying to remap the S command to stretch multiple times instead of exiting. This doesn't work and is asking for a 2nd point. (command "._multiple" "stretch") Also tried: (vl-cmdf "._multiple" "stretch") Edited July 26, 2022 by 3dwannab Quote
marko_ribar Posted July 26, 2022 Posted July 26, 2022 (edited) (defun c:foo ( / done ) (while (not (setq done (acet-sys-lmouse-down))) (vl-cmdf "_.STRETCH") (while (< 0 (getvar 'cmdactive)) (vl-cmdf "\\") ) (prompt "\nLeft click to FINISH...") ) (princ) ) Edited July 26, 2022 by marko_ribar 1 Quote
3dwannab Posted July 26, 2022 Author Posted July 26, 2022 Thanks, that doesn't loop the command. After the first run it's like the built in stretch command. Quote
marko_ribar Posted July 26, 2022 Posted July 26, 2022 (edited) I've changed it : It was : (if (< 0 (getvar 'cmdactive)) (vl-cmdf "\\") ) And it was supposed to be : (while (< 0 (getvar 'cmdactive)) (vl-cmdf "\\") ) Edited July 26, 2022 by marko_ribar Quote
3dwannab Posted July 26, 2022 Author Posted July 26, 2022 (edited) Thanks, unfortunately the stretch command acts like an entget as opposed to an ssget. No crossing selection can be made. Oh and escape or RMB click doesn't get out of the command. A very long ESC press will exit it though after a few seconds. Edited July 26, 2022 by 3dwannab Quote
3dwannab Posted July 26, 2022 Author Posted July 26, 2022 (edited) This seems to work.. (vl-load-com) (defun c:foofighters (/ actDoc) (setq actDoc (vla-get-ActiveDocument (vlax-get-acad-object))) (vla-SendCommand actDoc (strcat "MULTIPLE STRETCH ")) ) (c:foofighters) Edited July 26, 2022 by 3dwannab 1 Quote
mhupp Posted July 26, 2022 Posted July 26, 2022 (edited) Yeah its kinda strange that (command "_.Multiple") returns nil Was going to see if a keybinding in CUI was going to do the trick but this works well. little tweak (defun c:foofighters () (vla-SendCommand (vla-get-ActiveDocument (vlax-get-acad-object)) "MULTIPLE STRETCH ") ) Edited July 26, 2022 by mhupp 1 1 Quote
3dwannab Posted July 26, 2022 Author Posted July 26, 2022 (edited) @mhuppWhat have you against local variables? Yeah, I thought this would be simple enough to do, well it turned out simple and a small piece of code but I couldn't see any help on the multiple command for LISP anywhere. Perhaps others can use this in the future for other things. Edited July 26, 2022 by 3dwannab 1 Quote
mhupp Posted July 26, 2022 Posted July 26, 2022 1 minute ago, 3dwannab said: @mhuppWhat have you against local variables? Hehe I tell people to always defined local variables. makes me wonder what "(command" is doing if not outputting directly to the command line. 1 Quote
3dwannab Posted July 27, 2022 Author Posted July 27, 2022 I noticed something peculiar with my post here. On the first run it acts like an entget but if I press ESC and run the command again it works as intended then repeating the stretch command until ESC is pressed. Quote
3dwannab Posted July 27, 2022 Author Posted July 27, 2022 (edited) Here's another way which works but after I right click to exit it gives this error. Unknown command "S". Press F1 for help. I wouldn't mind doing it this way as I would like to omit XLINEs and HATCH entities from the stretch. ;; Repeat stretch command that doesn't select xLINES or HATCH entities. (defun c:S (/) (while (= 0 (logand 0 (getvar 'cmdactive))) (command "_.stretch" (ssget '((0 . "~XLINE") (0 . "~HATCH"))) "" pause) (vl-cmdf "\\") ) ) Edited July 27, 2022 by 3dwannab 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.