6#计算有点错误
- (defun c:tt ()
- (setq PL1 (entsel "\n请选取第一条直线:")
- PL2 (entsel "\n请选取第二条直线:")
- j-j (GETREAL "\n请指定间距:")
- OFW (GETINT "\n指定等分数量:")
- n 1
- )
- (if (< j-j 0)
- (progn (princ "指定间距小于0,按0计算") (setq j-j 0))
- )
- (if (< OFW 2)
- (progn (princ "指定等分数量小于2,按2计算") (setq OFW 2))
- )
- (Setq pl1p1 (cdr (assoc 10 (entget (car pl1))))
- pl1p2 (cdr (assoc 11 (entget (car pl1))))
- pl2p1 (cdr (assoc 10 (entget (car pl2))))
- pl2p2 (cdr (assoc 11 (entget (car pl2))))
- )
- (if (< (DISTANCE pl1p1 pl2p1) (DISTANCE pl1p1 pl2p2))
- (setq jl (DISTANCE pl1p1 pl2p1)
- jd (ANGLE pl1p1 pl2p1)
- )
- (setq jl (DISTANCE pl1p1 pl2p2)
- jd (ANGLE pl1p1 pl2p2)
- )
- )
- (setq dis(/ (- jl (* j-j (1- OFW))) OFW))
- (while (< n ofw)
- (entmake
- (list '(0 . "line")
- '(62 . 1)
- (cons 10 (polar pl1p1 jd (+ (* dis n) (* j-j (1- n)))))
- (cons 11 (polar pl1p2 jd (+ (* dis n) (* j-j (1- n)))))
- )
- )
- (if (/= j-j 0)
- (entmake
- (list '(0 . "line")
- '(62 . 1)
- (cons 10 (polar pl1p1 jd (+ (* dis n) (* j-j n))))
- (cons 11 (polar pl1p2 jd (+ (* dis n) (* j-j n))))
- )
- )
- )
- (setq n (+ 1 n))
- )
- )
|