本帖最后由 尘缘一生 于 2024-12-19 20:48 编辑
不好意思兄弟:我刚才看了下子,不行,下面啊,函数更多,没法一一弄出来,如果弄,我都得改写一遍所有函数,本坛其他地方有,但三领的不一样,集成太多,DXF1那句这样 (setq tp (cdr (assoc 0 (entget e))))
- ;;SLdesign V3.0 三领打断(简版) BY 尘缘一生
- ;;如果文字,动态指示打断位置
- ;;如果线类,选择打断第二点时右键或空格则打断于点
- (defun c:sldaduan (/ ent p0 p1 p2 p3 p4 e tp ang e_lst plis)
- (setq e_lst (sysvar '("OSMODE" "CMDECHO")))
- (setvar "CMDECHO" 0)
- (setq e (car (setq ent (entsel "\n 选择要打断的对象:"))))
- (setq tp (cdr (assoc 0 (entget e))))
- ;(if (member tp '("ELLIPSE" "CIRCLE" "POLYLINE" "REGION" "MLINE" "3DFACE"))
- ; (progn (gx (ssadd e) nil) (setq e (entlast) ent (list (entlast) (cadr ent)))) ;重新构建 entsel
- ;)
- (if (member tp '("TEXT" "TCH_TEXT" "MTEXT" "TCH_MTEXT"))
- (progn
- (setvar "OSMODE" 0)
- (setq p0 (car (ddslx (+ (e-ang e nil) pi2)))) ;;ddslx 动态定位矢量线函数 e-ang 实体角度函数
- (setq plis (maxtxbox (e-box4 e)) p1 (car plis) p2 (cadr plis) p3 (caddr plis) p4 (cadddr plis)) ;e-box4 包容盒3点位 maxtxbox 扩大10%包容盒
- (sl_text:breakall e) ;文字原位打断函数
- (if (setq ss (ssget "W" p1 (pertolinecz p0 p4 p3) '((0 . "TEXT,TCH_TEXT,MTEXT,TCH_MTEXT")))) ;pertolinecz p0到p3 p4两点垂足
- (sswzhb ss) ;合并文字选择集左侧
- )
- (if (setq ss (ssget "W" (pertolinecz p0 p1 p2) p3 '((0 . "TEXT,TCH_TEXT,MTEXT,TCH_MTEXT"))))
- (sswzhb ss) ;合并文字选择集右侧
- )
- )
- (progn ;线类
- (setvar "OSMODE" 16383)
- (setq ang (+ (e-ang e nil) pi4))
- (if (setq p1 (getpoint "\n 指定打断的第一点:"))
- (progn (setq p1 (vlax-curve-getClosestPointTo e p1 nil)) (slslx p1 ang))
- )
- (if (setq p2 (getpoint "\n 指定打断的第二点 , 或打断于点<右键>:"))
- (progn (setq p2 (vlax-curve-getClosestPointTo e p2 nil)) (slslx p2 ang))
- )
- (setvar "OSMODE" 0)
- (if p2
- (vl-cmdf ".BREAK" ent "F" "_non" (trans p1 0 1) "_non" (trans p2 0 1))
- (progn (vl-cmdf ".BREAK" ent "F" "_non" (trans p1 0 1) "@") (redraw (entlast) 3))
- )
- )
- )
- (mapcar 'eval e_lst)
- (redraw)
- (princ)
- )
|