;点阵复制[mini_copy2points].lsp

(defun c:mini_copy2points ( / old_cmd old_pwidth get_ins_point ss bo ss_mark p1 p2 p3 old_del_ent )

(defun get_ins_point ( inp bo / p1 p2 p3 p4 )
	(mapcar 'set '(p1 p2 p3 p4) bo)
	(cond
		((or (not inp) (= inp "S")) (mai_divide_point p1 p3 0.5))
		((= inp "Z") p1)
		((= inp "C") p2)
		((= inp "E") p3)
		((= inp "Q") p4)
		((= inp "X") (mai_divide_point p1 p2 0.5))
		((= inp "D") (mai_divide_point p2 p3 0.5))
		((= inp "W") (mai_divide_point p4 p3 0.5))
		((= inp "A") (mai_divide_point p1 p4 0.5))
		((= (mai_data_type inp) "POINT") inp)
	)
)

	(mai_start nil)
	(mai_last_com "mini_excopy")
	(setq old_pwidth (getvar "plinewid"))
	(setvar "plinewid" 0)
	(setq ss (mai_select_firsts nil "点阵复制，选择需要复制的实体:<退出>" "没有选择到实体." T))
	(setq
		bo (mai_ss_rectangle_cucs ss)
		ss_mark (entlast)
		p1 (car bo)
		p2 (caddr bo)
		p3 (mai_divide_point p1 p2 0.5)
		p1 (* 0.1 (distance p1 p2))
		p2 (* 0.25 pi)
	)
	(setvar "cecolor" "1")
	(mai_entmake "lwpolyline" (cons (last bo) bo))
	(setvar "cecolor" "2")
	(mai_entmake "line" (list (polar p3 (* 0.25 pi) p1) (polar p3 (* 1.25 pi) p1)))
	(mai_entmake "line" (list (polar p3 (* 0.75 pi) p1) (polar p3 (* 1.75 pi) p1)))
	(setvar "cecolor" (caddr old_cmd))
	(setq old_del_ent (mai_newset ss_mark))
	(initget "Q W E A S D Z X C")
	(setq p1 (getpoint "\n自动基点[┏(Q)/┳(W)/┓(E)/┣(A))/+(S)/┫(D)/┗(Z)/┻(X)/┛(C)]输入按点阵复制基点:<输入复制数量,正数往外、负数往内，或输入普通复制基点，回车基点为中心点>"))
	(mai_entdel old_del_ent nil)
	(setq p1 (get_ins_point p1 bo))
	(mai_excopy2points ss p1)
	(mai_update_win_bg (mai_newset ss_mark) ss 5)
	(mai_end)
)
