Login

View Full Version : Offset Polyline Help



BrianTFC
2012-02-06, 11:43 PM
Hi All,

I have the wonderful Lisp routine that mfuccaro wrote back in 2003 called Offset Polylines "POF" for short. like I've said before in my other threads I'm just learning how to write and modify Lisp routines, I've manage to modify this routine to offset to the current layer but i can't figure out how to get it to remember the last offset distance. Can anyone help me please.

thanks,
Brian


;| OFFSET POLYLINES
mfuccaro@hotmail.com September 2003
|;
(defun c:pof( / plines ; selection set of polylines
ext ; extrnal point
dist ; distance to offset
poly ; a polyline from plines
plist ; the list of poly
del ; polyline to delete
int ; internal point
i)
(command "undo" "begin")
(princ "select polylines")
(setq plines (ssget)
i 0
ext (getvar "limmax")
dist (getdist "distance "))
(repeat (sslength plines)
(setq poly (ssname plines i))
(setq plist (entget poly))
(command "offset" dist poly ext "")
(setq del (entlast)
int (polar
(cdr (assoc 10 (entget del)))
(angle
(cdr (assoc 10 (entget del)))
(cdr (assoc 10 plist)))
(* 2 (distance (cdr (assoc 10 plist))
(cdr (assoc 10 (entget del)))))))
(command "offset" dist poly int "")
(command "_.change" (entlast) "" "_p" "_la" (getvar 'clayer) "")
(entdel del)
(setq i (1+ i)))
(command "undo" "end")
(princ)
)

pbejse
2012-02-07, 03:37 AM
replace this


(setq plines (ssget)
i 0
ext (getvar "limmax")
dist (getdist "distance "))

with:


(setq plines (ssget)
i 0
ext (getvar "limmax"))
(setq dist (cond
((getdist
(strcat
"\nEnter Distance [Enter to accept: <"
(rtos (setq dist (getvar 'Offsetdist)) 2 2)
">: "
)
)
)
(dist)
)
)