hi,
So i have now
(defun C:VV (/ *error* inspt done) (defun *error* (errmsg); on Escape at insertion-point prompt (command); cancel Insert command, then (command "_.layerp") ); defun -- *error* (command "_.LAYER" "_Set" "4031.Niet.Afdrukbaar" "") (while (not done) (command "_.xline" "V"); leave in command (cond ; at insertion-point prompt ((setq inspt (getpoint "\nInsertion point or <exit>: ")); point if picked, nil if Enter (command inspt "" "" ""); finish Insertion ); end picked-a-point condition (T ; on Enter/space at insertion-point prompt (command); cancel Insert (setq done T); stop (while) loop ); end exit condition ); cond ); while (command "_.layerp") ); defun
But i need a lisp, that put a verticale Xline and also make it possible to undo one of the "loop"xlines. So in normal terms, i would put xline, enter, then copy last object, the xline at the base point and then drag it around. Copy make it possible to undo in the command. The code above was a little try so it could be that there are some bugs in it :).
Shout away.
Thanks
Solved! Go to Solution.
Solved by Kent1Cooper. Go to Solution.
@Anonymous wrote:
....
But i need a lisp, that put a verticale Xline and also make it possible to undo one of the "loop"xlines. So in normal terms, i would put xline, enter, then copy last object, the xline at the base point and then drag it around. Copy make it possible to undo in the command. The code above was a little try so it could be that there are some bugs in it :).
....
Several things about that code are left-overs from a multiple-Insert routine [which I think I wrote], and are not relevant to copying Xlines around. I think if you want to be able to Undo individual added Xlines, then each needs to be put there by its own separate Copy command, rather than with one Copy command and the Multiple option. Borrowing from another routine of mine for the individual-Undo-along-the-way aspect, I patched together the following, which seems to do what you're describing, in limited testing:
(defun C:VV (/ *error* pt1 xl n pt done)
(defun *error* (errmsg); Escape at next-Xline location prompt
(if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break"))
(princ (strcat "\nError: " errmsg))
); if
(command "_.layerp")
(princ)
); defun -- *error*
(command
"_.LAYER" "_thaw" "4031.Niet.Afdrukbaar" "_make" "4031.Niet.Afdrukbaar" ""
;; [in case it's frozen, or doesn't yet exist]
"_.xline" "_ver" (setq pt1 (getpoint)) "" ; draw first one
); command
(setq
xl (entlast); the first one drawn
n 0 ; for Undo counter below
); setq
(while (not done)
(if (> n 0) (initget "Undo")); Undo option only if things to undo
(setq pt
(getpoint pt1 ; rubber-banded from first one
(strcat
"\nNext Xline location, or "
(if (> n 0) "[Undo] " ""); Undo option only if things to undo
"<exit>: "
); strcat
); getpoint
); setq
(cond ; overall point-selection or Undo option
((= pt "Undo")
(setq n (1- n)); increment counter downward
(command "_u"); remove last-added Xline
); Undo condition
(pt ; picked a point
(command "_.copy" xl "" pt1 pt)
(setq n (1+ n)); increment counter upward
); picked-a-point condition
(T ; Enter/space for <exit> default [nil return]
(setq done T); stop (while) loop
); end exit condition
); cond
); while
(command "_.layerp")
(princ)
); defun
It could use further enhancements [maybe Unlock the Layer just in case, command-echo suppression for parts of it, etc.].
Works fine for me. and yes it was from that insert command, told myself i could manage to make one on my own, but that reality is far away it seems.
Thanks Kent,flawless as always.
Can't find what you're looking for? Ask the community or share your knowledge.