你好
需要这个例程的帮助,它会偏移到选定的层,但是我需要添加编码来删除它偏移的原始对象。
编码如下所示:
- [/b]
- ;; OL.lsp
- ;; Offset-to-Layer = Offset an entity a specified distance, and Change the new entity to a specified Layer.
- ;; At first use, offers current Offset Distance and current Layer as defaults;
- ;; subsequently, offers this routine's previously-used Offset-to-Layer Distance (even if ordinary Offset
- ;; distance has been changed) and Layer-to-change-to as defaults.
- ;; by Kent Cooper, August 2008
- (defun C:OL (/ offlaytemp offent)
- (initget 134)
- (setq
- offlaydist
- (cond
- (
- (getdist
- (strcat
- "\nOffset-to-Layer distance or [Through] <"
- (cond
- ((numberp offlaydist) (rtos offlaydist))
- ((= (getvar 'offsetdist) -1) "Through")
- ((rtos (getvar 'offsetdist)))
- ); end cond
- ">: "
- ); end strcat
- ); end getdist
- ); end first cond test
- (T (if (not offlaydist) (getvar 'offsetdist) offlaydist))
- ); end cond
- offlaytemp
- (getstring
- (strcat
- "\nLayer to Offset to <"
- (if offlay offlay (getvar 'clayer))
- ">: "
- ); end strcat
- ); end getstring
- offlay
- (cond
- ((/= offlaytemp "") offlaytemp)
- (offlay)
- (T (getvar 'clayer))
- ); end cond
- ); end setq
- (while
- (not
- (while
- (not
- (and
- (setq offent (ssget ":S" '((0 . "LINE,ARC,CIRCLE,ELLIPSE,LWPOLYLINE,SPLINE,XLINE,RAY"))))
- (= (cdr (assoc 70 (tblsearch "layer" (cdr (assoc 8 (entget (ssname offent 0))))))) 0); 0 for Unlocked, 4 for Locked
- ); end and
- ); end not
- (prompt "\nSelected Entity cannot be Offset, or is on a Locked Layer; try again: ")
- ); end while
- ); end not
- (command "_.undo" "_be")
- (command
- ".offset" offlaydist offent pause ""
- ".chprop" "l" "" "la" offlay ""
- ); end command
- (command "_.undo" "_e")
- ); end while
- ); end defun
- (princ "\nType OL to Offset to Layer.")
- (princ)
- [b]
任何帮助都将不胜感激。 |