Jump to content

offset multiple objects


Guest dimekus

Recommended Posts

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 ""))
 )

Link to comment
Share on other sites

  • 3 years later...
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???

Link to comment
Share on other sites

  • 3 years later...

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

Link to comment
Share on other sites

  • 3 months later...
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?

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...