Jump to content

Recommended Posts

Posted

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.

Posted

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

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

Posted

Cntrk77

It is enaugh to ask only once.

See the answer in the other thread

  • 3 years later...
Posted

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

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

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...