修改了一下
(1)加了图层
(2)把其他改为 q
- ;;任意云线TY
- (defun c:TY(/ x0 y0 x1 y1)
- (setvar "cmdecho" 0 )
- (setq oldlayer (getvar "clayer"));;加层
- (command-S "_layer" "n" "0-100-修改云线" "c" "6" "0-100-修改云线" "N" "0-100-修改云线" "") ;;加层,如果"N"后加“P”则为不打印图层
- (setvar "clayer" "0-100-修改云线");;加层
- (vl-load-com)
-
- ------------------------
- ;设置水平方向默认值
-
- (setq fx (getstring "\n输入修订云线偏转方向(默认水平-y;其他旋转角度-q)<空格-y>:"))
-
- (if (= fx "")
- (setq fx "y")
- )
- (princ fx)
- ----------------------
-
- (SetQ
- p0 (GetPoint "\n 指定第一个修订角点:")
- )
-
- ;显示方向,方便查看
- (if (= fx "y")
- (Command "rectang" p0 "r" 0 pause )
- (progn
- (princ "\n指定角度方向")
- (command "line" p0 pause "")
- (setq xl (entlast))
- (setq xdata (entget xl))
- (setq pend (cdr (assoc 11 xdata)))
- (grdraw p0 pend 2)
- (setq angl (bao-rtd (angle p0 pend)))
- (entdel xl);显示完成,删除
- (princ "\n点选云线框角点")
- (Command "rectang" p0 "r" angl pause )
- )
- )
- -------------------------------------------------
- ;设定比例弧长
- (setq xx (entlast))
- (setq edata (entget xx))
-
- (setq plst (bao_get_vertexs xx)) ;获取矩形四个顶点坐标
- (setq pp1 (car plst)
- pp2 (cadr plst)
- pp3 (caddr plst)
- pp4 (cadddr plst)
- )
- (setq dis1 (distance pp1 pp2)
- dis2 (distance pp2 pp3)
- )
-
- (if(<= dis1 dis2)
- (SetQ alenth (/ dis1 8))
- (SetQ alenth (/ dis2 8))
- )
-
- (Command "revcloud" "a" alenth alenth "s" "c" "o" "l" "")
-
- -------------------------
- ;返回矩形默认水平作图方向
- (Command "rectang" p0 "r" 0 pp3 )
- (setq xx (entlast))
- (entdel xx)
- ------------------------------
- (setvar "cmdecho" 1)
- (princ)
- )
- ;;弧度转换为度
- (defun bao-rtd (ang) (/ (* ang 180.0) pi))
- ;;度转换为弧度
- (defun bao-dtr (ang) (* (/ ang 180.0) pi))
- ;;获取矩形顶点
- (defun bao_get_vertexs (en)
- (mapcar 'cdr (vl-remove-if-not
- '(lambda (x) (= (car x) 10))
- (entget en)
- )
- )
- )
|