本帖最后由 xshrimp 于 2012-6-6 14:45 编辑
核心函数其实很简单.只要几句就可以了.
根据下面的不用窗口就可以绘制栏杆了.
(defun gps->entmake-Line (p1 p2)
(entmake(list (cons 0 "LINE")(cons 10 p1)(cons 11 p2)))
)
(defun entmakelg(dis / pt)
(setq pt (polar spt ang dis))(gps->entmake-Line pt (polar pt (+ (* 0.5 pi) ang) L))
)
- (setq A 25.0 B 110 C 50 L 300)
- (if (setq ents (entsel))
- (progn
- (setq ent (car ents)entlst (entget ent) )
- (setq spt(cdr(assoc 10 entlst)) ept(cdr(assoc 11 entlst)))
- (setq ang (angle spt ept)dis (distance ept spt))
- (entmakelg 0)
- (entmakelg (setq adis c))
- (setq n (/ (- dis c )(+ a b)))
- (repeat (fix n)
- (entmakelg (setq adis (+ b adis)))
- (entmakelg (setq adis (+ a adis)))
- )
- )
- )
|