;;; Divide area/measurement in equal X parts (first and last part are half X)
;;; Marko Ribar, d.i.a. (graduated engineer of architecture) routine
;;; Saved from: http://www.cadtutor.net/forum/showthread.php?98367-dividing-an-area-measurement-in-equal-parts

(defun c:xl( / p1 p2 v n num x k p pl )
(setq p1 (getpoint "\nPick or specify first point : "))
(setq p2 (getpoint p1 "\nPick or specify second point : "))
(setq v (mapcar '- p2 p1))
(setq n (polar '(0.0 0.0) (+ (angle '(0.0 0.0) v) (* 0.5 pi)) 1.0))
(initget 7)
(setq num (getint "\nSpecify number of XLINE entities for division: "))
(setq x (/ (distance p1 p2) num))
(setq k 0.5)
(repeat num
(setq p (polar p1 (angle p1 p2) (* k x)))
(setq k (1+ k))
(setq pl (cons p pl))
)
(setq pl (reverse pl))
(foreach p pl
(entmake
(list
'(0 . "XLINE")
'(100 . "AcDbEntity")
'(100 . "AcDbXline")
(cons 10 p)
(cons 11 n)
)
)
)
(princ)
)
(c:xl)

Advertisements