🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
[^_^]:http://bbs.mjtd.com/forum.php?mod=viewthread&tid=110408&extra=page%3D2%26filter%3Dtypeid%26typeid%3D107 出处:http://bbs.mjtd.com/forum.php?mod=viewthread&tid=110408&extra=page%3D2%26filter%3Dtypeid%26typeid%3D107 效果图 ![](https://box.kancloud.cn/a9f452d32b8bb618f23565c435378772_986x568.gif) 源码: ``` ;;快速填充command版本 ;;code by edata@mjtd ;;2014-6-16;;变函数参数 ;;(sk\_hatch\_cmd sk\_ha\_name sk\_ha\_scale sk\_ha\_ang) ;;sk\_ha\_name 填充名字符串 ;;sk\_ha\_scale 填充比例 数字或数字字符串 ;;sk\_ha\_ang 填充角度 0-360度数字或数字字符串 ;;例子(sk\_hatch\_cmd "earth" 100 0.0) (defun sk\_hatch\_cmd ( sk\_ha\_name sk\_ha\_scale sk\_ha\_ang / bak\_clay bak\_col bak\_cmd en0 en1 en2 p1 p3) (or sk\_ha\_name (setq sk\_ha\_name "earth")) (or sk\_ha\_scale (setq sk\_ha\_scale 100)) (or sk\_ha\_ang (setq sk\_ha\_ang 0.0)) (setq bak\_clay (getvar 'clayer) bak\_col (getvar 'cecolor) bak\_cmd (getvar 'cmdecho) ) (if (not (tblobjname "layer" "自动填充")) (entmake (list ' (0 . "LAYER") ' (100 . "AcDbSymbolTableRecord") ' (100 . "AcDbLayerTableRecord") ' (70 . 0) ' (6 . "Continuous") (cons 2 "自动填充") (cons 62 5) ) ) ) (setvar 'clayer "自动填充") (setvar 'cecolor "5") (setvar 'cmdecho 0) (while (and (setq p1 (getpoint "\\n指定第一点:")) (setq p3 (getcorner p1 "\\n指定对角点:")) ) (progn (if (\> (getvar 'cmdactive) 0) (command)) (setq en0 (entlast)) (command "\_.RECTANG" "\_non" p1 "\_non" p3) (setq en1 (entlast)) (command "-bhatch" "p" sk\_ha\_name sk\_ha\_scale sk\_ha\_ang "s" en1 "" "") (if (\> (getvar 'cmdactive) 0) (command)) (setq en2 (entlast)) (if (sk\_h5\_eq en1 en2) (progn (alert "创建填充失败.") (if (not (sk\_h5\_eq en1 en0)) (entdel en1)) ) ) ) ) (and bak\_clay (setvar 'clayer bak\_clay)) (and bak\_col (setvar 'cecolor bak\_col)) (and bak\_cmd (setvar 'cmdecho bak\_cmd)) (princ) ) (defun sk\_dxf (ent code) (cdr (assoc code (entget ent)))) (defun sk\_h5\_eq (ent1 ent2) (\= (sk\_dxf ent1 5) (sk\_dxf ent2 5)) ) (defun c:tt () (sk\_hatch\_cmd "earth" 100 0.0) (princ) ) (defun c:tt2 () (sk\_hatch\_cmd "angle" 100 0.0) (princ) ) ```