Jump to content

Recommended Posts

Posted (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 by 3dwannab
Posted (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 by marko_ribar
  • Thanks 1
Posted

Thanks, that doesn't loop the command. After the first run it's like the built in stretch command.

Posted (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 by marko_ribar
Posted (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 by 3dwannab
Posted (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 by 3dwannab
  • Funny 1
Posted (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 by mhupp
  • Like 1
  • Thanks 1
Posted (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 by 3dwannab
  • Agree 1
Posted
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.

  • Funny 1
Posted

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.

Posted (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 by 3dwannab
  • Like 1

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...