Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Offset both sides of line

30 views
Skip to first unread message

Kevin Lockwood

unread,
Aug 11, 2004, 5:35:09 PM8/11/04
to
Offset to both sides of a line (maybe to a specified layer)I've looked
and looked and still cant find a tool for this (that I have to buy :) )

Jim Claypool

unread,
Aug 11, 2004, 6:25:18 PM8/11/04
to
It's old and crude but it works.

(defun dbloffset (layername / osmode ss ename ent pt1 pt2 midpt ang)
(setq osmode (getvar "osmode"))
(setvar "osmode" 0)
(while (not (setq ename (entsel "\nSelect line to offset: "))))
(setq ename (car ename))
(setq ent (entget ename))
(setq pt1 (cdr (assoc 10 ent)))
(setq pt2 (cdr (assoc 11 ent)))
(setq ang (angle pt1 pt2))
(setq midpt (polar pt1 ang (/ (distance pt1 pt2) 2.0)))
(while (not (setq offset (getdist midpt "\nOffset distance: "))))
(command ".offset" offset ename (polar midpt (+ ang (* pi 0.5)) offset) "")
(if layername (entmod (subst (cons 8 Layername) (assoc 8 (entget
(entlast))) (entget (entlast)))))
(command ".offset" offset ename (polar midpt (- ang (* pi 0.5)) offset) "")
(if layername (entmod (subst (cons 8 Layername) (assoc 8 (entget
(entlast))) (entget (entlast)))))
(setvar "osmode" osmode)
(princ)
)
"Kevin Lockwood" <kloc...@cathedralcity.gov> wrote in message
news:411a90e7_3@newsprd01...

Jeff Mishler

unread,
Aug 11, 2004, 8:56:32 PM8/11/04
to
(setq layr (getstring "\nLayer to offset to: ")
(setq offdist (getreal "\nDistance to offset: ")
(setq l1 (car (entsel "\nSelect line to offset: ")))
(setq l1-vla (vlax-ename->vla-object l1))
(setq new-l (vla-offset l1-vla offdist))
(if layr (vla-put-layer new-l laYR))
(setq new-l (vla-offset l1-vla (- offdist)))
(if layr (vla-put-layer new-l laYR))

--
Jeff
check out www.cadvault.com


"Kevin Lockwood" <kloc...@cathedralcity.gov> wrote in message
news:411a90e7_3@newsprd01...

Jim Claypool

unread,
Aug 12, 2004, 6:20:48 PM8/12/04
to
Ok here's the update using Jeff's solution (with corrections)

(defun dbloffset (layername / ename offdist l1-vla)


(setvar "osmode" 0)
(while (not (setq ename (entsel "\nSelect line to offset: "))))
(setq ename (car ename))

(setq l1-vla (vlax-ename->vla-object ename))
(while (not (setq offdist (getdist "\nOffset distance: "))))
(vla-offset l1-vla offdist)
(if layername (vla-put-layer (vlax-ename->vla-object (entlast)) layername))
(vla-offset l1-vla (- offdist))
(if layername (vla-put-layer (vlax-ename->vla-object (entlast)) layername))
(princ)
)

"Jeff Mishler" <jef...@cadvault.com> wrote in message
news:411ac03b$1_1@newsprd01...

Kevin Lockwood

unread,
Aug 16, 2004, 2:51:29 PM8/16/04
to
thanks for the help !!! and you guys dont even get paid...wow
0 new messages