Jump to content

Recommended Posts

Posted

I need a lisp where I can select multiple rectangles and run the command and select an offset distance and it will offset every rectangle and create a layer or add it to an existing layer that was made previously from the Autolisp

Posted (edited)

You missed one answer inside or outside ?  Must be plines not lines.

; Multi offsets of plines
; By AlanH DEC 2019

(defun c:moff (/ ANG CO-ORD DIST LAY OBJ OFF OLDSNAP PLENT PT1 PT2 PT3 SS X)
  (setq oldsnap (getvar 'osmode))
  (setq obj (vlax-ename->vla-object (car (entsel "\nPick object for layer "))))
  (setvar 'osmode 0)
  (setq lay (vla-get-layer obj))
  (setq ss (ssget (list (cons 0 "LWPOLYLINE") (cons 8 lay))))
  (setq off (getreal "\nEnter offset"))
  (if (/= ss nil)
    (progn
      (repeat (setq x (sslength ss))
        (setq plent (ssname ss (setq x (- x 1))))
        (setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget plent))))
        (setq pt1 (nth 0 co-ord))
        (setq pt2 (nth 2 co-ord))
        (setq ang (angle pt1 pt2))
        (setq dist (/ (distance pt1 pt2) 2.0))
        (setq pt3 (polar pt1 ang dist))
        (command "offset" off plent pt3 "")
      )
    )
    (alert "No plines found")
  )
  (setvar 'osmode oldsnap)
  (princ)
)
(c:moff) 

 

Edited by BIGAL

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