所以我在业余时间继续修补,主要是为了更好地使用lisp编码,并提出了这段代码。
- (defun c:aspacing () ;define function
- (setq a (getpoint "\nFirst Point ")) ;first point
- (setq b (getpoint "\nSecond Point " a)) ;second point
- (setq x (/ (distance a b) 4200)) ;divide distance from a to b by 4200
- (setq y (fix (1+ x))) ;round up to next whole number
- (setq z1 (/ (distance a b) y)) ;value of S - divide distance a b by whole number
- (setq z2 (/ (/ (distance a b) y) 2)) ;value of half S
- (setq ang (angle a b)) ;set angle of distance
- (setq a1 (polar a ang z2)) ;starting point for xline
- (command "xline" a1 (polar a1 (+ ang 1.570795765134617) 100)"") ;draw xline perpendicular to ab
- (command "offset" z1 a1 "m" (repeat y(b)) "" "") ;offset y number of times
- ) ;end function
- (princ) ;clean loading
我对(命令“offset”…)有问题线我使用点b作为偏移的方向,但我需要它重复y多次。我不知道在这种情况下如何重复工作。思想? |