- 积分
- 30171
- 明经币
- 个
- 注册时间
- 2019-11-19
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2022-4-27 03:32:53
|
显示全部楼层
本帖最后由 xj6019 于 2022-4-27 10:28 编辑
更新一下!!
(defun c:NM (/ area lst p1 p2 s ss2list ygs_brk_int_cur)
(defun area(ent / obj-vla obj-area)
(setq obj-vla (vlax-ename->vla-object ent))
(setq obj-area (vla-get-Area obj-vla))
)
(defun ss2list (SS)(vl-remove-if-not '(lambda(x)(= 'ENAME (type x))) (mapcar 'cadr (ssnamex SS))))
(defun ygs_brk_int_cur(ss / BLYZ GS I PT SJD SJD_PT SS2 UN_SURF X)
(setq gs(sslength ss) i 0)
(repeat gs
(command "extrude" "MO" "SU" (ssname ss i)"" 2 )
(vla-delete (vlax-ename->vla-object(ssname ss i)))
(setq i(1+ i))
)
(command "union" (ssget "A"'((0 . "EXTRUDEDSURFACE"))) "" )
(setq un_surf(entlast)
sjd_pt(cdr(last(ssnamex ss)))
sjd nil
)
(mapcar'(lambda(x)(setq sjd(cons (car(cdr x))sjd)))sjd_pt)
(entmakex (append (list '(0 . "LWPOLYLINE")
'(100 . "AcDbEntity")
'(100 . "AcDbPolyline")
'(62 . 0)
(cons 90 (length sjd))
(cons 70 1)
)
(mapcar '(lambda (pt) (cons 10 pt)) sjd)
)
)
(command "convtosurface" (entlast) ""
"_intersect" (entlast) un_surf ""
)
)
(setq p1 (getpoint "\n框选第一点:")
p2 (getcorner p1 "\n框选第二点:")
)
(setq s(ssget "C" P1 P2 '((0 . "*LINE,ARC")))
)
(ygs_brk_int_cur s)
(setq s(ssget "C" P1 P2 '((0 . "*LINE,ARC"))))
(command ".region" s "")
(if(setq s(ssget "C" P1 P2 '((0 . "*LINE,ARC"))))
(command "erase" s "")
)
(if(setq s(ssget "C" P1 P2 '((0 . "REGION"))))
(progn
(setq lst(ss2list s))
(entdel (car(vl-sort lst '(lambda (x1 x2) (> (area x1) (area x2))))))
(mapcar '(lambda(x)
(vla-explode (vlax-ename->vla-object x))
(entdel x)
(setq s1(ssget "C" P1 P2 '((0 . "*LINE,ARC"))))
(command "pedit" "m" s1 "" "y" "j" "" ""); 合并
)
(ss2list (ssget "C" P1 P2 '((0 . "REGION"))))
)
)
)
(princ)
)
|
|