本帖最后由 尘缘一生 于 2022-4-30 18:05 编辑
我试了,自交的样条曲线,还是不行的。
代码没完成,先保留这里备用。判断SPLINE自交没有找到函数,不判断,直接转PLINE为PLIN,代码看太繁杂,还没修改好。- ;打断相交线----------------
- (defun c:tt (/ ss ss1 ss2 nam n i obj tp e_lst temp xk)
- (setq e_lst (sysvar '("osmode" "cmdecho" "PELLIPSE" "CLAYER" "peditaccept")) ss1 (ssadd))
- (setvar "CMDECHO" 0) (setvar "OSMODE" 0) (setvar "peditaccept" 1)
- (setq ss (ssget '((0 . "LINE,*POLYLINE,ARC,CIRCLE,SPLINE,ELLIPSE,REGION"))))
- (repeat (setq n (sslength ss))
- (setq nam (ssname ss (setq n (1- n))) tp (dxf1 nam 0) obj (en2obj nam))
- (cond
- ((= tp "ARC")
- (command "pedit" nam "w" 0 "")
- (ssdel nam ss)
- (ssadd (entlast) ss1)
- )
- ((= tp "SPLINE")
- (command "pedit" nam 10 "w" 0 "")
- (ssdel nam ss)
- (ssadd (entlast) ss1)
- )
- ((= tp "REGION")
- (setq xk (linwind nam))
- (reg2pline nam)
- (vla-put-ConstantWidth (en2obj (entlast)) xk)
- (ssdel nam ss)
- (ssadd (entlast) ss1)
- )
- ((or (= tp "POLYLINE")
- (and (= tp "LWPOLYLINE" tp) (= (_polyselfintersect-p obj) t)) ;自交
- )
- (setq xk (linwind nam))
- (setq temp (entlast))
- (vla-explode obj)
- (vla-delete obj)
- (setq ss2 (last_ent temp))
- (repeat (setq i (sslength ss2))
- (vla-put-ConstantWidth (en2obj (ssname ss2 (setq i (1- i)))) xk)
- )
- (ssdel nam ss)
- (setq ss2 (last_ent temp))
- )
- )
- )
- (ygs_brk_int_cur (sl:pickset-join (sl:pickset-join ss1 ss1) ss))
- (mapcar 'eval e_lst)
- )
|