本帖最后由 lingfne 于 2025-11-23 14:06 编辑
网友答: 这个网站是实在是太卡了;我上传好慢。网友答: (setq myb '
((0.0 6.0) (6.0 573.143) (573.143 576.143) (576.143 1143.29) (1143.29 1146.29) (1146.29 1713.43) (1713.43 1716.43) (1716.43 2283.57) (2283.57 2286.57) (2286.57 2853.71) (2853.71 2856.71) (2856.71 3423.86) (3423.86 3426.86) (3426.86 3994.0) (3994.0 4000.0))) 这里少了个括号网友答: (defun c:tXt ()
(setq dimscale (getvar "DIMSCALE") dimfxl (getvar "DIMFXL") dimete (getvar "DIMEXE"))
(setq myb '(
(0.0 6.0) (6.0 573.143) (573.143 576.143) (576.143 1143.29) (1143.29 1146.29)
(1146.29 1713.43) (1713.43 1716.43) (1716.43 2283.57) (2283.57 2286.57)
(2286.57 2853.71) (2853.71 2856.71) (2856.71 3423.86) (3423.86 3426.86)
(3426.86 3994.0) (3994.0 4000.0)
))
;; 启动命令后立即显示预览,跟随光标
(princ "\n移动光标预览标注位置,点击左键插入...")
;; 实时预览循环
(setq continue t)
(while continue
(setq gr (grread t 15 0))
(cond
((= (car gr) 5) ; 鼠标移动
(redraw) ; 清除上一帧
;; 绘制临时预览
(foreach x myb
(Draw-Dimension-Preview (cadr x) (- (* dimfxl dimscale)) (car x) 0 0 (cadr gr))
)
)
((= (car gr) 3) ; 左键点击
;; 创建正式标注
(redraw) ; 清除预览
(foreach x myb
(Marking-标注水平-level (cadr x) (- (* dimfxl dimscale)) (car x) 0 0 (cadr gr))
)
(setq continue nil) ; 退出循环
)
((= (car gr) 25) ; 右键取消
(redraw) ; 清除预览
(setq continue nil) ; 退出循环
)
)
)
(prin1)
)
;; 临时预览绘制函数
(defun Draw-Dimension-Preview (xbiaoa ybiaob xbiaoc ybiaod jiaodu mp1 / p1 p2 p3 p4)
(setq p1 (list (+ (car mp1) xbiaoc) (+ (cadr mp1) ybiaob)) ; dim13点
p2 (list (+ (car mp1) xbiaoa) (+ (cadr mp1) ybiaob)) ; dim14点
p3 (list (+ (car mp1) xbiaoa) (+ (cadr mp1) ybiaod)) ; dim10点
p4 (list (+ (car mp1) xbiaoc) (+ (cadr mp1) ybiaod))) ; 左侧标注线端点
;; 使用grdraw绘制临时图形(红色,无实体)
(grdraw p1 p2 45) ; 尺寸线
(grdraw p1 p4 45) ; 左侧延伸线
(grdraw p2 p3 45) ; 右侧延伸线
)
;; 标注函数
(defun Marking-标注水平-level (xbiaoa ybiaob xbiaoc ybiaod dim50 mp1 / dim10 dim13 dim14 hang_down)
(setq
dim10 (list (+ (car mp1) xbiaoa) (+ (cadr mp1) ybiaob))
dim13 (list (+ (car mp1) xbiaoc) (+ (cadr mp1) ybiaod))
dim14 (list (+ (car mp1) xbiaoa) (+ (cadr mp1) ybiaod))
dim50 0
)
(setq hang_down (list
(cons 0 "DIMENSION")
(cons 100 "AcDbEntity")
(cons 67 0)
(cons 410 "Model")
(cons 100 "AcDbDimension")
(cons 10 dim10)
(cons 70 32)
(cons 1 "")
(cons 100 "AcDbAlignedDimension")
(cons 13 dim13)
(cons 14 dim14)
(cons 50 dim50)
(cons 100 "AcDbRotatedDimension")
))
(entmake hang_down)
)
(princ "\n*** 输入 TXT 启动标注命令 ***")
(princ)网友答:


网友答:
没搞明白这个的用处
- (defun c:tt ()
- (setq dimscale (getvar "DIMSCALE") dimfxl (getvar "DIMFXL") dimete (getvar "DIMEXE"))
- (setq myb '
- ((0.0 6.0) (6.0 573.143) (573.143 576.143) (576.143 1143.29) (1143.29 1146.29) (1146.29 1713.43) (1713.43 1716.43) (1716.43 2283.57) (2283.57 2286.57) (2286.57 2853.71) (2853.71 2856.71) (2856.71 3423.86) (3423.86 3426.86) (3426.86 3994.0) (3994.0 4000.0))
- ((0.0 6.0) (6.0 573.143) (573.143 576.143) (576.143 1143.29) (1143.29 1146.29) (1146.29 1713.43) (1713.43 1716.43) (1716.43 2283.57) (2283.57 2286.57) (2286.57 2853.71) (2853.71 2856.71) (2856.71 3423.86) (3423.86 3426.86) (3426.86 3994.0) (3994.0 4000.0))
- ;; 启动命令后立即显示预览,跟随光标
- (princ "\n移动光标预览标注位置,点击左键插入...")
- ;; 实时预览循环
- (setq continue t)
- (while continue
- (setq gr (grread t 15 0))
- (cond
- ((= (car gr) 5) ; 鼠标移动
- (redraw) ; 清除上一帧
- ;; 绘制临时预览
- (foreach x myb
- (Draw-Dimension-Preview (cadr x) (- (* dimfxl dimscale)) (car x) 0 0 (cadr gr))
- )
- )
- ((= (car gr) 3) ; 左键点击
- ;; 创建正式标注
- (redraw) ; 清除预览
- (foreach x myb
- (Marking-标注水平-level (cadr x) (- (* dimfxl dimscale)) (car x) 0 0 (cadr gr))
- )
- (setq continue nil) ; 退出循环
- )
- ((= (car gr) 25) ; 右键取消
- (redraw) ; 清除预览
- (setq continue nil) ; 退出循环
- )
- )
- )
- (prin1)
- )
- ;; 临时预览绘制函数
- (defun Draw-Dimension-Preview (xbiaoa ybiaob xbiaoc ybiaod jiaodu mp1 / p1 p2 p3 p4)
- (setq p1 (list (+ (car mp1) xbiaoc) (+ (cadr mp1) ybiaob)) ; dim13点
- p2 (list (+ (car mp1) xbiaoa) (+ (cadr mp1) ybiaob)) ; dim14点
- p3 (list (+ (car mp1) xbiaoa) (+ (cadr mp1) ybiaod)) ; dim10点
- p4 (list (+ (car mp1) xbiaoc) (+ (cadr mp1) ybiaod))) ; 左侧标注线端点
- ;; 使用grdraw绘制临时图形(红色,无实体)
- (grdraw p1 p2 45) ; 尺寸线
- (grdraw p1 p4 45) ; 左侧延伸线
- (grdraw p2 p3 45) ; 右侧延伸线
- )
- ;; 标注函数
- (defun Marking-标注水平-level (xbiaoa ybiaob xbiaoc ybiaod dim50 mp1 / dim10 dim13 dim14 hang_down)
- (setq
- dim10 (list (+ (car mp1) xbiaoa) (+ (cadr mp1) ybiaob))
- dim13 (list (+ (car mp1) xbiaoc) (+ (cadr mp1) ybiaod))
- dim14 (list (+ (car mp1) xbiaoa) (+ (cadr mp1) ybiaod))
- dim50 0
- )
- (setq hang_down (list
- (cons 0 "DIMENSION")
- (cons 100 "AcDbEntity")
- (cons 67 0)
- (cons 410 "Model")
- (cons 100 "AcDbDimension")
- (cons 10 dim10)
- (cons 70 32)
- (cons 1 "")
- (cons 100 "AcDbAlignedDimension")
- (cons 13 dim13)
- (cons 14 dim14)
- (cons 50 dim50)
- (cons 100 "AcDbRotatedDimension")
- ))
- (entmake hang_down)
- )
网友答: 这个网站是实在是太卡了;我上传好慢。网友答: (setq myb '
((0.0 6.0) (6.0 573.143) (573.143 576.143) (576.143 1143.29) (1143.29 1146.29) (1146.29 1713.43) (1713.43 1716.43) (1716.43 2283.57) (2283.57 2286.57) (2286.57 2853.71) (2853.71 2856.71) (2856.71 3423.86) (3423.86 3426.86) (3426.86 3994.0) (3994.0 4000.0))) 这里少了个括号网友答: (defun c:tXt ()
(setq dimscale (getvar "DIMSCALE") dimfxl (getvar "DIMFXL") dimete (getvar "DIMEXE"))
(setq myb '(
(0.0 6.0) (6.0 573.143) (573.143 576.143) (576.143 1143.29) (1143.29 1146.29)
(1146.29 1713.43) (1713.43 1716.43) (1716.43 2283.57) (2283.57 2286.57)
(2286.57 2853.71) (2853.71 2856.71) (2856.71 3423.86) (3423.86 3426.86)
(3426.86 3994.0) (3994.0 4000.0)
))
;; 启动命令后立即显示预览,跟随光标
(princ "\n移动光标预览标注位置,点击左键插入...")
;; 实时预览循环
(setq continue t)
(while continue
(setq gr (grread t 15 0))
(cond
((= (car gr) 5) ; 鼠标移动
(redraw) ; 清除上一帧
;; 绘制临时预览
(foreach x myb
(Draw-Dimension-Preview (cadr x) (- (* dimfxl dimscale)) (car x) 0 0 (cadr gr))
)
)
((= (car gr) 3) ; 左键点击
;; 创建正式标注
(redraw) ; 清除预览
(foreach x myb
(Marking-标注水平-level (cadr x) (- (* dimfxl dimscale)) (car x) 0 0 (cadr gr))
)
(setq continue nil) ; 退出循环
)
((= (car gr) 25) ; 右键取消
(redraw) ; 清除预览
(setq continue nil) ; 退出循环
)
)
)
(prin1)
)
;; 临时预览绘制函数
(defun Draw-Dimension-Preview (xbiaoa ybiaob xbiaoc ybiaod jiaodu mp1 / p1 p2 p3 p4)
(setq p1 (list (+ (car mp1) xbiaoc) (+ (cadr mp1) ybiaob)) ; dim13点
p2 (list (+ (car mp1) xbiaoa) (+ (cadr mp1) ybiaob)) ; dim14点
p3 (list (+ (car mp1) xbiaoa) (+ (cadr mp1) ybiaod)) ; dim10点
p4 (list (+ (car mp1) xbiaoc) (+ (cadr mp1) ybiaod))) ; 左侧标注线端点
;; 使用grdraw绘制临时图形(红色,无实体)
(grdraw p1 p2 45) ; 尺寸线
(grdraw p1 p4 45) ; 左侧延伸线
(grdraw p2 p3 45) ; 右侧延伸线
)
;; 标注函数
(defun Marking-标注水平-level (xbiaoa ybiaob xbiaoc ybiaod dim50 mp1 / dim10 dim13 dim14 hang_down)
(setq
dim10 (list (+ (car mp1) xbiaoa) (+ (cadr mp1) ybiaob))
dim13 (list (+ (car mp1) xbiaoc) (+ (cadr mp1) ybiaod))
dim14 (list (+ (car mp1) xbiaoa) (+ (cadr mp1) ybiaod))
dim50 0
)
(setq hang_down (list
(cons 0 "DIMENSION")
(cons 100 "AcDbEntity")
(cons 67 0)
(cons 410 "Model")
(cons 100 "AcDbDimension")
(cons 10 dim10)
(cons 70 32)
(cons 1 "")
(cons 100 "AcDbAlignedDimension")
(cons 13 dim13)
(cons 14 dim14)
(cons 50 dim50)
(cons 100 "AcDbRotatedDimension")
))
(entmake hang_down)
)
(princ "\n*** 输入 TXT 启动标注命令 ***")
(princ)网友答:
寒潮大冬瓜 发表于 2025-11-23 17:16
(defun c:tXt ()
(setq dimscale (getvar "DIMSCALE") dimfxl (getvar "DIMFXL") dimete (getvar "DIMEX ...


网友答:
没搞明白这个的用处