Switch edgemode for using trim or extend command

Switch edgemode for using trim or extend command

Sandervp
Advocate Advocate
899 Views
2 Replies
Message 1 of 3

Switch edgemode for using trim or extend command

Sandervp
Advocate
Advocate

Hello everybody,

 

I've got a question about the edgemode function.

 

If I want to use the trim command, my edgemode setting is set to 0. But if I want to use the extend command, I want to have this edgemode value to 1 every time.

 

I need to change this every time because I prefer these setting by the trim and extend commands.

 

Because I'm using the trim command more then the extend command, the edgemode variable is 0 more of the time.

 

How can I change the extend command so it will first; puts the edgemode setting to 1; second; using the extend function. Finally; puts the edgemode setting back to 0.

 

Thanks everybody!

0 Likes
900 Views
2 Replies
Replies (2)
Message 2 of 3

Kent1Cooper
Consultant
Consultant

@Sandervp wrote:

.... 

How can I change the extend command so it will first; puts the edgemode setting to 1; second; using the extend function. Finally; puts the edgemode setting back to 0.

 

....

Like this [very lightly tested]:

 

(command "_.undefine" "extend")
(defun C:EXTEND (/ *error*)
(defun *error* (errmsg); in case User ends Extend command with Escape key
(if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break"))
(princ (strcat "\nError: " errmsg))
); if
(setvar 'edgemode 0)
(princ)
); defun
(setvar 'edgemode 1)
(command "_.extend")
(while (> (getvar 'cmdactive) 0) (command pause))
(setvar 'edgemode 0)
(princ)
); defun
(prompt "\nEXTEND command has been redefined to use extension of all edges.")

If you put that into acaddoc.lsp, it will make that new definition in all drawings, and the EX command alias [or any other used for it] will work as well as the full command name.  To use it without extending edges, type .EXTEND with the period prefix to get the native command rather than this new definition, or in the new command, after edge object selection, you can still call for the Edge option and change it to No extend.

Kent Cooper, AIA
0 Likes
Message 3 of 3

dbroad
Mentor
Mentor

Another approach is to use reactors.  Shift extend will trim in the edgemode 1 mode.

 

;;D. C. Broad, Jr.
;;edgemode reactor: On for extend, off for trim
(if (null eemode)
  (setq eemode (vlr-command-reactor nil '((:vlr-commandwillstart . xbegin)
(:vlr-commandcancelled . xstop) ;don't forget (:vlr-commandended . xstop))) )) ;;turn on edgemode for extend (defun xbegin (r cl) (if (= (CAR cl) "EXTEND") (setvar "edgemode" 1) )) ;;turn off edgemode when extend ends (defun xstop (r cl) (if (= (car cl) "EXTEND") (setvar "edgemode" 0) ))
Architect, Registered NC, VA, SC, & GA.