Guest dimekus Posted September 26, 2003 Share 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 Link to comment Share on other sites More sharing options...
fuccaro Posted September 26, 2003 Share 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 Link to comment Share on other sites More sharing options...
cntrk77 Posted July 31, 2007 Share 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 Link to comment Share on other sites More sharing options...
fuccaro Posted July 31, 2007 Share Posted July 31, 2007 Cntrk77 It is enaugh to ask only once. See the answer in the other thread Quote Link to comment Share on other sites More sharing options...
rajrehman Posted February 23, 2011 Share Posted February 23, 2011 how can run this lisp routine Quote Link to comment Share on other sites More sharing options...
fuccaro Posted February 24, 2011 Share 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 Link to comment Share on other sites More sharing options...
Mierkina Posted June 2, 2011 Share 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 Link to comment Share on other sites More sharing options...
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.