最初由 张涛 发布
[B]大家好,我是一个新会员,而且是刚刚学习AUTOLISP
语言。在这里我想请哪位热心的老师帮我编写一个程序。好吗?
“要求绘制一个圆锥滚子轴承“
不过要每一句都有说明!在这里先谢谢了。
真诚的... [/B]
论坛中的LSP程序多如牛毛,为什么非要“绘制一个圆锥滚子轴承”的LSP,我这儿正好有一个关于拖动的小程序,是帮网友修改的,你可以参考一下。

- [FONT=courier new]
- ;;;0.01 (2003.3.31) for r2002
- ;;;测试GRREAD
- (defun c:t1 (/ pt1 pt2 ls line1 ts1 ds ts2 tx1 tx2 pick p ip pt p1)
- (setvar "CMDECHO" 0)
- (setq pt1 (getpoint "\please input pt1"))
- (while (= 0 (distance (setq pt2 (cadr (grread t 4 0))) pt1))
- )
- (command "line" pt1 pt2 "")
- (setq ls (entlast))
- (setq line1 (entget ls))
- (setq ts1 " long=")
- (setq ds (rtos (distance pt1 pt2) 2 2))
- (setq ts2 (strcat ts1 ds))
- (command "text" pt2 (/ (getvar "viewsize") 40.0) "" ts2)
- (setq tx1 (entlast))
- (vla-put-color (vlax-ename->vla-object tx1) 1)
- (setq tx2 (entget tx1))
- (setq pick nil)
- (while (not pick)
- (setq p (grread t 4 0))
- (princ)
- (setq ip (car p))
- (setq pt (cadr p))
- (if (= ip 5)
- ;;;;;;;;;;;;;;确定为坐标移动
- (progn
- (setq p1 (trans pt 1 0))
- ;;坐标系转换(以防止更新数据表时出错)
- (setq line1 (subst (cons 11 p1) (assoc 11 line1) line1))
- (entmod line1)
- (setq ds (rtos (distance pt1 p1) 2 2))
- (setq ts2 (strcat ts1 ds))
- (setq tx2 (subst (cons 10 p1) (assoc 10 tx2) tx2))
- (setq tx2 (subst (cons 1 ts2) (assoc 1 tx2) tx2))
- (setq tx2 (subst (cons 40 (/ (getvar "viewsize") 40.0)) (assoc 40 tx2) tx2))
- (entmod tx2)
- )
- ;;progn
- )
- ;;if
- (setq pick (= 3 ip))
- ;;;;;确定为点取坐标
- )
- ;;while
- (entdel tx1)
- (setvar "CMDECHO" 1)
- (princ)
- )
- [/FONT]
|