本帖最后由 shcvip 于 2024-8-21 23:31 编辑
- (defun HTddgd (/ arcss dw_index dw_list ename index linetype pipess
- r_list)
- (princ "\n 选择多段中心线:")
- (vl-load-com)
- (setvar "cmdecho" 0)
- ;;;
- (defun *error* (msg)
- (if (wcmatch (strcase msg t) "*break,*cancel*,*exit*,*取消*")
- (princ "\n用户按了<Esc>强制退出")
- (princ (strcat "\n" msg))
- )
- (vla-EndUndoMark
- (vla-get-ActiveDocument (vlax-get-acad-object))
- ) ;回退
- (princ)
- )
- (setq *DOC (vla-get-ActiveDocument (vlax-get-acad-object)))
- (vla-StartUndoMark *DOC) ;设置回退标志
- (setq c03 (getvar "viewctr")
- c03 (trans c03 1 2)
- c08 (getvar "viewsize")
- c04 (getvar "screensize")
- c07 (car c04)
- c06 (cadr c04)
- c09 (/ (* c08 c07) c06)
- c01 (list (- (car c03) (* 0.5 c09)) (- (cadr c03) (* 0.5 c08)))
- c02 (list (+ (car c03) (* 0.5 c09)) (+ (cadr c03) (* 0.5 c08)))
- c01 (trans c01 2 1)
- c02 (trans c02 2 1)
- )
- (if (setq pipess (ssget (list (cons 0 "line"))))
- (command "change" pipess "" "p" "la" "z_中心线" "")
- )
- (setq arcss (pipesfillet pipess GD_qlR))
- (setq index 0)
- (repeat (sslength pipess)
- (setq ename (ssname pipess index)
- index (1+ index)
- linetype (cdr (assoc 0 (entget ename)))
- )
- (if (= linetype "LINE")
- (linesx ename GD_D)
- (arcsx ename GD_D)
- )
- )
- (setq index 0)
- (repeat (sslength arcss)
- (setq ename (ssname arcss index)
- index (1+ index)
- linetype (cdr (assoc 0 (entget ename)))
- )
- (arcsx ename GD_D)
- (setq entdata (entget ename))
- (if (assoc 6 entdata)
- ;;; (setq entdata (subst (cons 6 "CENTER") (assoc 6 entdata) entdata))
- (setq
- entdata (subst (cons 8 "L_轮廓线") (assoc 6 entdata) entdata)
- ) ;;此数据不知道控制哪条直线
- ;;; (setq entdata (append entdata '((6 . "CENTER"))))
- (setq entdata (append entdata '((8 . "Z_中心线")))) ;;圆弧内的中心线
- )
- (entmod entdata)
- )
- (setvar "cmdecho" 0)
- (command "zoom" c01 c02)
- ;;结尾部分
- ;;; (Restore_Locked_Layers Locks) ;恢复以前图层状态
- (vla-EndUndoMark *DOC) ;回退标志结束
- (princ)
- )
|