Guest dimekus Posted September 26, 2003 Posted September 26, 2003 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. Quote
fuccaro Posted September 26, 2003 Posted September 26, 2003 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 [email="mfuccaro@hotmail.com"]mfuccaro@hotmail.com[/email] 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 "")) ) Quote
cntrk77 Posted July 31, 2007 Posted July 31, 2007 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 [email="mfuccaro@hotmail.com"]mfuccaro@hotmail.com[/email] 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??? Quote
fuccaro Posted July 31, 2007 Posted July 31, 2007 Cntrk77 It is enaugh to ask only once. See the answer in the other thread Quote
fuccaro Posted February 24, 2011 Posted February 24, 2011 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 Quote
Mierkina Posted June 2, 2011 Posted June 2, 2011 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? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.