Jump to content

Recommended Posts

Posted
21 hours ago, Tharwat said:

No worries, try it and let me know. :) 

(defun c:Test (/ n c f i s e o)
  ;;----------------------------------------------------;;
  ;;	Author : Tharwat Al Choufi			;;
  ;; website: https://autolispprograms.wordpress.com	;;
  ;;----------------------------------------------------;;
  (setq n "Layer" ;; Target layer name.	;;
        c 232     ;; Colour of Layer.	;;
        f 0.8     ;; Offset distance.	;;
  )
  (and
    (or (tblsearch "LAYER" n)
        (entmake (list '(0 . "LAYER")
                       '(100 . "AcDbSymbolTableRecord")
                       '(100 . "AcDbLayerTableRecord")
                       (cons 2 n)
                       (cons 62 c)
                       '(70 . 0)
                 )
        )
    )
    (setq i -1
          s (ssget "_X"
              (list (cons 410 (getvar 'CTAB))
                    '(0 . "LWPOLYLINE")
                    '(-4 . "&=")
                    '(70 . 1)
              )
            )
    )
    (while (setq i (1+ i)
                 e (ssname s i)
           )
      (and (setq g (entget e)
                 o (entlast)
           )
           (vlax-write-enabled-p (vlax-ename->vla-object e))
           (vl-cmdf "_.OFFSET"
                    f
                    e
                    "_none"
                    (mapcar (function (lambda (j k) (* (+ j k) 0.5)))
                            (vlax-curve-getstartpoint e)
                            (vlax-curve-getpointatparam e 2)
                    )
                    ""
           )
           (not (= o (setq o (entlast))))
           (entmod (subst (cons 8 n) (assoc 8 (setq e (entget o))) e))
      )
    )
  )
  (princ)
) (vl-load-com)

 

 

Thanks, it worked fine :)

 

  • Like 1
Posted
31 minutes ago, Trap3d said:

 

Thanks, it worked fine :)

 

Excellent, you are welcome anytime. :) 

  • Like 1

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