马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
相关公共函数

- [FONT=courier new]
- ;;; ==================================================================
- ;;; 子函数
- (defun hao-ss2lst (ss / n l)
- (if (and
- ss
- (< 0 (sslength ss))
- )
- (repeat (setq n (sslength ss))
- (setq n (1- n)
- l (cons (ssname ss n) l)
- )
- )
- )
- )
- (defun hao-ss2objlst (ss / n l)
- (if (and
- ss
- (< 0 (sslength ss))
- )
- (repeat (setq n (sslength ss))
- (setq n (1- n)
- l (cons (vlax-ename->vla-object (ssname ss n)) l)
- )
- )
- )
- )
- (defun thacadobj ()
- (cond
- (%$*thacadobj*$%)
- (setq %$*thacadobj*$% (vlax-get-acad-object))
- )
- )
- (defun thactdoc ()
- (cond
- (%$*thactdoc*$%)
- (setq %$*thactdoc*$% (vla-get-activedocument (thacadobj)))
- )
- )
- (defun th-rnd ()
- (* (rem (* (getvar "cputicks") (getvar "millisecs")) 1e8) 1e-8)
- )
- (defun hao-ss-aftere (ename / ss)
- (if (and
- ename
- (setq ss (ssadd))
- (eq 'ename (type ename))
- )
- (while (setq ename (entnext ename))
- (ssadd ename ss)
- )
- (setq ss (ssget "x"))
- )
- ss
- )
- ;;; ==================================================================
- [/FONT]
应用

- [FONT=courier new]
- ;;; ==================================================================
- (defun c:test1 (/ elist ss)
- (th-block "th"
- (getpoint "\nPick point:")
- (lambda ()
- (setq ss (ssget))
- (foreach each
- (hao-ss2lst ss)
- (setq elist (entget each))
- (entmake elist)
- )
- )
- )
- )
- (defun c:test2 ( / elist laste pt ss)
- (th-block ""
- (getpoint "\nPick point:")
- (lambda ()
- (setq laste (entlast))
- (command "line"
- (getpoint "\nPick point:")
- (getpoint "\nPick next point:")
- ""
- )
- (command "circle"
- (getpoint "\nPick point:")
- 5
- )
- (command "line"
- (getpoint "\nPick point:")
- (getpoint "\nPick next point:")
- ""
- )
- (command "circle"
- (setq pt(getpoint "\nPick point:"))
- (getdist pt "\nPick next poiont:")
- )
- (setq ss (hao-ss-aftere laste))
- (foreach each
- (hao-ss2lst ss)
- (setq elist (entget each))
- (entmake elist)
- )
- (command "erase" ss "")
- )
- )
- )
- ;;; ==================================================================
- [/FONT]
|