代码改变世界

随笔档案-2011年3月29日

AutoLISP虚拟线变化图

2011-03-29 22:31 by 精诚所至 金石为开, 483 阅读, 收藏,
摘要: AutoLISP虚拟线变化图,代码如下。 (defun c:test() (setvar "cmdecho" 0) (setq k 1 n 1 hh 1) (get_screen_size) (while k (grread k) (while (>= hh 0.0005) (s... 阅读全文

AutoLISP切圆动画

2011-03-29 22:07 by 精诚所至 金石为开, 475 阅读, 收藏,
摘要: AutoLISP切圆动画,在已知圆外绘制一外切圆,并逆时针运动,代码如下。 (defun c:test() (setvar "cmdecho" 0) (setq en (car (entsel "\n选取一圆心:"))) (setq cen2 (getpoint "\n切点圆:")) (princ "\n按选键盘任意键可转动切圆,[EN... 阅读全文

AutoLISP将多段线各个端点坐标写入外部文件

2011-03-29 17:17 by 精诚所至 金石为开, 983 阅读, 收藏,
摘要: AutoLISP将多段线各个端点坐标写入外部文件,代码如下。 (defun c:test() (setvar "cmdecho" 0) (setq ffn (getfiled "选取文件" "" "doc" 1)) (setq ff (open ffn "w")) (close ff) (princ "\n选取多段线:")... 阅读全文

AutoLISP将外部文件中的文字写入图形

2011-03-29 17:00 by 精诚所至 金石为开, 727 阅读, 收藏,
摘要: AutoLISP将外部文件中的文字写入图形,代码如下。 (defun c:test() (setvar "cmdecho" 0) (setq ffn (getfiled "选择文件" "" "txt" 2)) (setq pt (getpoint "\n选取文字插入点:")) (setq hh (getdist pt "\n字高:"))... 阅读全文

AutoLISP将图形中文字写入外部文件

2011-03-29 16:54 by 精诚所至 金石为开, 887 阅读, 收藏,
摘要: AutoLISP将图形中文字写入外部文件,代码如下。 (defun c:test() (setq ffn (getfiled "写出文件" "" "txt" 1)) (princ "\n选取文字……") (setq ss (ssget)) (setq ff (open ffn "w")) (setq i 0) ... 阅读全文

AutoLISP自动计算封闭区域面积

2011-03-29 16:30 by 精诚所至 金石为开, 1250 阅读, 收藏,
摘要: AutoLISP自动计算封闭区域面积,代码如下。 (defun c:test() (setvar "cmdecho" 0) (setq pt (getpoint "\n选取点:")) (while pt (setvar "cecolor" "1") (command "bpoly" pt "") ... 阅读全文

AutoLISP自动标注圆,弧,直线,多段线长度

2011-03-29 16:13 by 精诚所至 金石为开, 4150 阅读, 收藏,
摘要: AutoLISP自动标注圆,弧,直线,多段线长度,代码如下。 (defun c:test() (setvar "cmdecho" 0) (setq en (entsel "\n选取圆、线、弧、多义线计算长度:")) (while en (setq en (car en)) (command "lengthen" e... 阅读全文

AutoLISP修改圆直径

2011-03-29 15:51 by 精诚所至 金石为开, 727 阅读, 收藏,
摘要: AutoLISP修改圆直径,代码如下。 (defun c:test() (princ "\n选取要修改的圆:") (setq ss (ssget)) (setq old_rr (getvar "circlerad")) (setq str_rr (strcat "\n新直径:")) (setq rr (getdist st... 阅读全文

AutoLISP修改文字倾斜角度

2011-03-29 15:43 by 精诚所至 金石为开, 862 阅读, 收藏,
摘要: AutoLISP修改文字倾斜角度,代码如下。 (defun c:test() (setq ang (getangle "\n输入倾斜角度:")) (if (null ang) (setq ang (/ pi 6))) (setq ss (ssget)) (setq i 0) (setq nn (sslength ss)) ... 阅读全文

AutoLISP修改文字高度

2011-03-29 15:32 by 精诚所至 金石为开, 923 阅读, 收藏,
摘要: AutoLISP修改文字高度,代码如下。 (defun c:test() (setq old_hh (getvar "textsize")) (setq str_hh (strcat "\n输入新字高:")) (setq hh (getdist str_hh)) (if (null hh) (setq hh old_hh)) ... 阅读全文

AutoLISP文字加上下划线

2011-03-29 15:17 by 精诚所至 金石为开, 598 阅读, 收藏,
摘要: AutoLISP文字加上下划线,代码如下。 (defun c:test() (initget "T B A") (setq typ (getkword "\n绘图形式[T顶线,B底线,A上下线]:")) (if (null typ) (setq typ "B")) (setq dd (getdist "\n字与线间距:")) ... 阅读全文

AutoLISP文字外加矩形框

2011-03-29 10:52 by 精诚所至 金石为开, 670 阅读, 收藏,
摘要: AutoLISP文字外加矩形框,代码如下。 (defun c:test() (setq dd (getdist "\n输入文字与线间距:")) (if (null dd) (setq dd 2)) (setq ss (ssget)) (setq i 0) (repeat (sslength ss) (se... 阅读全文

AutoLISP文字外加圆形框

2011-03-29 10:25 by 精诚所至 金石为开, 1216 阅读, 收藏,
摘要: AutoLISP文字外加圆形框,代码如下。 (defun c:test() (setvar "cmdecho" 0) (setq dd (getdist "\n输入文字与圆周距离:")) (if (null dd) (setq dd 2)) (setq ss (ssget)) (setq i 0) (repe... 阅读全文