;; | ---------------------------------------------------------------------------- ;; | PL_BoundPoly ;; | ---------------------------------------------------------------------------- ;; | Function : Creates boundary polygons around lines, polylines and/or Circles ;; | Author : Rakesh Rao ;; | Argument : 'ss' - The selection set to be used. ;; | Overloaded argument, can be an entity name also ;; | The selection set can contain LINEs, POLYLINEs and CIRCLEs. ;; | LINEs will be Offset by corridor width ;; | POLYLINEs, if open will be Offset by corridor width ;; | POLYLINEs, if closed will not be Offset and taken as such. ;; | CIRCLEs will be used a such. ;; | 'CWd' - Corridor Width ;; | Action : Returns a selection set which contains the bounding polygons ;; | Updated : June 24, 1998 ;; | Comment : This function can be used to create a bounding polygon ;; | around a set of LINE/POLYLINE/CIRCLE entities. ;; | e-mail : rakesh.rao@4d-technologies.com ;; | Web : www.4d-technologies.com ;; | ---------------------------------------------------------------------------- (defun PL_BoundPoly (ss Cwd / Lst ssl ename entl cnt elast la pt1 pt2 vlist cen dia vlist1 vlist2 p11 p12 p21 p22 ename1 ename2 PolySS ss1 en flag OS ) (if (= (type ss) 'ENAME) (progn (setq ss1 (ssadd)) (ssadd ss ss1) (setq ss ss1) )) (setq OS (getvar "OSMODE")) (setvar "OSMODE" 0) (setq PolySS nil) (if ss (progn (LA_mk_c_lyr "0" "") (setq ssl (sslength ss) PolySS (ssadd) cnt 0 ) (repeat ssl (setq ename (ssname ss cnt) entl (entget ename) en (LI_item 0 entl) cnt (1+ cnt) ) (cond ((= en "CIRCLE") (setq dia (* 2.0 (LI_item 40 entl)) Cen (LI_item 10 entl) ) (command "._Donut" dia dia Cen "") (ssadd (entlast) PolySS) ) ((member en (list "LINE" "POLYLINE")) (if (= en "LINE") (setq flag 0 vlist (list (LI_item 10 entl) (LI_item 11 entl))) (setq flag (LI_item 70 entl) vlist (PL_plist ename)) ) (if (zerop (logand flag 1)) ; Open polyline or line (progn (LA_mk_c_lyr "0" "") (command "._Mline" "_Justification" "_Zero" "_Scale" Cwd) (foreach pt vlist (command pt)) (command "") (setq elast (MI_xentlast)) (command "._Explode" (entlast)) (setq ss1 (MI_after elast) ss1 (PL_PlJoin ss1 nil) ) (if (and ss1 (= (sslength ss1) 2)) (progn (command "._Change" ss1 "" "_Properties" "_Layer" "0" "") (setq vlist1 ( PL_plist (ssname ss1 0) ) vlist2 ( PL_plist (ssname ss1 1) ) p11 (nth 0 vlist1) p12 (nth (1- (length vlist1) ) vlist1) p21 (nth 0 vlist2) p22 (nth (1- (length vlist2) ) vlist2) ) (command "._Line" p11 p21 "") (setq ename1 (entlast)) (command "._Line" p12 p22 "") (setq ename2 (entlast)) (command "._Pedit" (ssname ss1 0) "_Join" (ssname ss1 1) ename1 ename2 "" "_X" "._Pedit" (entlast) "_Close" "_X" ) (ssadd (entlast) PolySS) )) ) (progn (command "._Copy" ename "" (list 0.0 0.0 0.0) "") (ssadd (entlast) PolySS) )) ) ) ) )) (setvar "OSMODE" OS) PolySS )