View Full Version : Polylines with Global Width to Boundaries
daiharv
19th Dec 2006, 07:09 pm
I'm using AutoCAD 2007.
I'm working on a drawing with footpaths represented by polylines with a global width. What I actually need is the "boundary/outline" of these lines.
Any ideas, could a lsp achieve this?
Thanks.
rkmcswain
19th Dec 2006, 07:18 pm
You could offset the polyline 1/2 its width on both sides, then use PEDIT to join the ends.
ASMI
19th Dec 2006, 09:25 pm
You could offset the polyline 1/2 its width on both sides
Good idea in short *.lsp:
(defun c:plb(/ plSet plLst offDis posPl negPl)
(vl-load-com)
(princ "\n>>> Select wide polylines and press Enter <<<")
(if
(setq plSet
(ssget
'((0 . "LWPOLYLINE")(-4 . "<NOT")(43 . 0.0)(-4 . "NOT>"))))
(progn
(setq plLst
(mapcar 'vlax-ename->vla-object
(vl-remove-if 'listp
(mapcar 'cadr(ssnamex plSet)))))
(foreach pl plLst
(setq offDis(/(vla-get-ConstantWidth pl)2)
posPl(car
(vlax-safearray->list
(vlax-variant-value
(vla-Offset pl offDis))))
negPl(car
(vlax-safearray->list
(vlax-variant-value
(vla-Offset pl (- offDis)))))
); end setq
(vla-put-ConstantWidth posPl 0.0)
(vla-put-ConstantWidth negPl 0.0)
(vla-Delete pl)
); end foreach
); end progn
); end if
(princ)
); end of c:plb
ASMI
20th Dec 2006, 10:00 am
Previous program badly works with self-intersection polylines.
(defun c:plb(/ plSet plLst offDis posLst negLst)
(vl-load-com)
(princ "\n>>> Select wide polylines and press Enter <<<")
(if
(setq plSet
(ssget
'((0 . "LWPOLYLINE")(-4 . "<NOT")(43 . 0.0)(-4 . "NOT>"))))
(progn
(setq plLst
(mapcar 'vlax-ename->vla-object
(vl-remove-if 'listp
(mapcar 'cadr(ssnamex plSet)))))
(foreach pl plLst
(setq offDis(/(vla-get-ConstantWidth pl)2)
posLst(vlax-safearray->list
(vlax-variant-value
(vla-Offset pl offDis)))
negLst(vlax-safearray->list
(vlax-variant-value
(vla-Offset pl (- offDis))))
); end setq
(mapcar '(lambda(x)(vla-put-ConstantWidth x 0.0))posLst)
(mapcar '(lambda(x)(vla-put-ConstantWidth x 0.0))negLst)
); end foreach
(mapcar 'vla-Delete plLst)
); end progn
); end if
(princ)
); end of c:plb
Powered by vBulletin™ Version 4.1.2 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.