;除spline转的面域
;16:39 2017/7/28
;【唐僧】晗子轩(515357067) 16:38:49
;;;函数名称:SWH-ent-region->curve
;;;函数说明:面域转多段线
;;;参 数:lst:面域选择集(可以是多个面域模式)
;;;返 回 值:转换后的图元名lst
;;;示 例:(setq bbb(SWH-ent-region->curve (setq lst(ssget))))
(defun SWH-ent-region->curve (lst / cl lastent lste lt:ss-entnext objl ss ss->ents ssc swh-select-ss->ents)
;;125.2 [功能] 获取在图元 en 之后产生的图元的选择集--by黄大师
(defun lt:ss-entnext (en / ss)
(if en
(progn
(setq ss (ssadd))
(while (setq en (entnext en))
(if (not (member (cdr (assoc 0 (entget en)))
'("ATTRIB"
"VERTEX"
"SEQEND"
)
)
)
(ssadd en ss)
)
)
(cond((zerop (sslength ss)) (setq ss nil)))
ss
)
(ssget "_x")
)
)
(defun SWH-select-ss->ents (ss / el i sl)
(setq
sl (sslength ss)
i -1
)
(repeat sl
(setq el (cons (ssname ss (setq i (1+ i))) el))
)
el
)
(setq lastent(entlast))
(setq ss (ssadd))
(setq ssc(ssadd))
(if (= (type lst) 'PICKSET)
(setq lste (SWH-select-ss->ents lst))
)
(setq
cl (mapcar
'(lambda (a)
(mapcar 'vlax-vla-object->ename(safearray-value (variant-value a)))
)
(mapcar'vla-explode
(mapcar
'vlax-ename->vla-object
(vl-remove-if'(lambda (x) (/= (cdr (assoc 0 (entget x))) "REGION"))lste)
)
)
)
)
(foreach x cl(foreach y x (ssadd y ss)))
(vl-cmdf "PEDIT" "m" ss "" "Y" "J" 0 "")
(setq ssc(SWH-select-ss->ents(lt:ss-entnext lastent)))
)