Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi!
I found this interesting lsp that offsets a polyline / line and then it join its ends. But I only need to offset to one side. Could you help me transform it?
Thanks!
;; OffsetBothSidesJoin.lsp [command name: OBSJ]
;; To Offset the same object to Both Sides at the same distance, and
;; if open-ended, Join the resulting objects with PEDIT.
;; On first use, offers regular Offset command's default distance,
;; but only if numerical [not "Through"].
;; Remembers specified offset distance, separately from regular
;; Offset command's default, and offers as default on later use.
;; Kent Cooper, 21 March 2014
;
(defun C:OBSJ (/ osd disttemp obj); = Offset to Both Sides
;
(setq osd (getvar 'offsetdist))
(setvar 'peditaccept 1)
;
(if *obsjdist (initget 6) (initget 7))
; no 0, no negative, no Enter on first use
(setq
disttemp
(getdist
(strcat
"\nBoth-sides-offset distance"
(strcat
(if (or *obsjdist (> osd 0))
(strcat ; then - construct default
" <"
(if *obsjdist
(rtos *obsjdist)
(rtos osd)
); end if
">"
); end strcat
"" ; else - no default offered on first use if Offset's is Through
); end if
); end strcat
": "
); end strcat
); end getdist
*obsjdist
(cond
(disttemp); User specified something other than Enter - use it
(*obsjdist); Enter with prior value set - use that
((> osd 0) osd)
; Enter on first use with non-Through Offset default - use that
); end cond & *obsjdist
); end setq
;
(while T
(if
(setq obj
(vlax-ename->vla-object
(car (entsel "\nSelect object to Offset to Both Sides [Esc to exit]: "))
); end vlax-...
); end setq
(progn
(vla-offset obj *obsjdist)
(setq ent1 (entlast))
(vla-offset obj (- *obsjdist))
(if (not (vlax-curve-isClosed obj)); e.g. Line, Arc, open Polyline
(command "_.pedit" "_m" ent1 (entlast) "" "_j" "_j" "_b" (* *obsjdist 2.5) "")
); if
); end progn
); end if
); end while
;
(princ)
); end defun
(prompt "Type OBSJ to Offset to Both Sides by the same distance and Join if possible.")
Solved! Go to Solution.