View Full Version : offset multiple objects
dimekus
26th Sep 2003, 11:23 am
Is it possible to offset multiple polygons collectively, at a predifined distance to offset and towards the center of the polygons? If yes, kindly explain how.
fuccaro
26th Sep 2003, 02:45 pm
Try this bit of lisp code. Return with a message if it not works as you want.
Please turn off the OSNAP, I allways forget to do it within the lisp.
;| 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 "")
(entdel del)
(setq i (1+ i)))
(command "undo" "end")
(if (= "Y" (strcase (getstring "\ndelete initial polylines? (Y/N)")))
(command "erase" plines ""))
)
cntrk77
31st Jul 2007, 01:48 pm
Try this bit of lisp code. Return with a message if it not works as you want.
Please turn off the OSNAP, I allways forget to do it within the lisp.
;| 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 "")
(entdel del)
(setq i (1+ i)))
(command "undo" "end")
(if (= "Y" (strcase (getstring "\ndelete initial polylines? (Y/N)")))
(command "erase" plines ""))
)
The lisp code works successfully ( internal offset) but is it possible to offset external point???
fuccaro
31st Jul 2007, 03:22 pm
Cntrk77
It is enaugh to ask only once.
See the answer in the other thread
rajrehman
23rd Feb 2011, 11:10 am
how can run this lisp routine
fuccaro
24th Feb 2011, 07:18 am
Some of the routines posted in this forum are affected by a character-encoding problem. Here is the cleaned code:
;| 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 "")
(entdel del)
(setq i (1+ i)))
(command "undo" "end")
(if (= "Y" (strcase (getstring "\ndelete initial polylines? (Y/N)")))
(command "erase" plines ""))
)
I can't test it now, but probably I cleaned it correctly.
And if you wish to learn about working with Lisps while in AutoCAD: http://www.cadtutor.net/forum/showthread.php?1390-How-to-use-the-LISP-routines-in-this-archive
Mierkina
2nd Jun 2011, 07:15 pm
Some of the routines posted in this forum are affected by a character-encoding problem. Here is the cleaned code:
;| 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 "")
(entdel del)
(setq i (1+ i)))
(command "undo" "end")
(if (= "Y" (strcase (getstring "\ndelete initial polylines? (Y/N)")))
(command "erase" plines ""))
)
I can't test it now, but probably I cleaned it correctly.
And if you wish to learn about working with Lisps while in AutoCAD: http://www.cadtutor.net/forum/showthread.php?1390-How-to-use-the-LISP-routines-in-this-archive
its there a reason why the lisp does not offset in on autocad 11?
Powered by vBulletin™ Version 4.1.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.