(defun c:Foo (/ d e l)
(if (and (setq d (getdist "\nSpecify distance: "))
(setq e (car (entsel "\nSelect MText/Text to modify: ")))
(vl-position (cdr (assoc 0 (setq l (entget e)))) '("MTEXT" "TEXT"))
)
(entmod (subst (cons 1 (vl-string-right-trim "0" (rtos d))) (assoc 1 l) l))
)
(princ)
) 为了学习更好的方法,我如何改进这段代码?
点之间的距离应为点与起点/终点之间距离的两倍
(defun c:test (/ p1 p2 # ang ins)
(setq dis (distance (setq p1(getpoint "\nSpecify first point :"))
(setq p2(getpoint p1 "\nSpecify second point :")))
# (getint "\nSpecify number of evaps: ")
ang (angle p1 p2)
ins(polar p1 ang (/ dis (* 2 #)))
)
(repeat #
(entmake
(list
(cons 0 "POINT")
(cons 10 ins)
)
)
(setq ins (polar ins ang (/ dis #)))
)
(princ)
)
不确定你说的是什么,所以把它们均匀地隔开。。。
(defun c:test ( / p1 p2 a d )
(if (and
(setq p1 (getpoint "\nSpecify First Point: "))
(setq p2 (getpoint "\nSpecify Second Point: " p1))
(setq n*
(cond
(
(getint
(strcat "\nSpecify Number of Evaps <"
(itoa
(setq n* (cond ( n* ) ( 3 )))
)
"> : "
)
)
)
( n* )
)
)
(setq a (angle p1 p2) d (distance p1 p2))
)
(
(lambda ( i )
(repeat n*
(entmake
(list
(cons 0 "POINT")
(cons 10 (polar p1 a (* (setq i (1+ i)) (/ d (1- n*)))))
)
)
)
)
-1
)
)
(princ)
)
页:
1
[2]