(defun c:sv_lamps (/ nabor _len1 _eff_name _block _conduit quantity point counter poinsert _cond )
(vl-load-com)
(setq acadd (vlax-get-acad-object))
(setq active_doc (vla-get-ActiveDocument acadd))
(setq mspace (vla-get-ModelSpace active_doc))
(setq L900 9.1)
(setq L1200 13)
(setq L600 6)
(setq xscale 1)
(setq yscale 1)
(setq zscale 1)
(setq rot (/ (getint "Введите угол поворота светильников на карнизах: 0; 180 ") (/ 180 pi)))
(setq rot1 (/ (getint "Введите угол поворота светильников в дверных проемах: 0; 180 ") (/ 180 pi)))
(setq nabor (ssget "_X" (list (cons 8 "_АХП_Вспомогательный_слой_не_печать" ) (cons 0 "insert"))))
(if nabor
(progn
(princ (strcat "Найдено блоков:" (rtos (sslength nabor) 2 0) "шт."))
(terpri)
(setq name "L (900 mm)")
(setq counter 0)
(while (< counter (sslength nabor))
(setq _block (vlax-ename->vla-object (ssname nabor counter)))
(setq point (cdr (assoc 10 (entget (ssname nabor counter)))))
(setq x_coord (nth 0 point))
(setq y_coord (nth 1 point))
(setq z_coord (nth 2 point))
(setq _eff_name (vla-get-effectivename _block))
(princ _eff_name)
(terpri)
(if
(wcmatch _eff_name "!Карниз")
(progn
(setq drop (vlax-invoke _block 'getdynamicblockproperties ))
(nth 0 drop)
(setq _len1 (vlax-variant-value (vla-get-value (nth 0 drop) )))
(setq quantity (fix (/ _len1 L900)))
(setq counter1 0)
(while (< counter1 quantity)
(setq x_coord` (+ x_coord (/ L900 2) (* 1 counter1 L900)))
(setq poinsert (vlax-3d-point x_coord` y_coord z_coord))
(vla-InsertBlock mspace poinsert name xscale yscale zscale rot)
(setq counter1 (+ 1 counter1)))(princ "ok !Карниз")(terpri))
(progn (setq _cond (getint "\n Выберите вариант: 1 - Один блок; 2 - Заполнить проем"))
(if (= _cond 1) (progn
(setq drop (vlax-invoke _block 'getdynamicblockproperties ))
(nth 0 drop)
(setq _len1 (vlax-variant-value (vla-get-value (nth 0 drop) )))
(setq x_half (+ x_coord (/ _len1 2)))
(setq poinsert (vlax-3d-point x_half y_coord z_coord))
(vla-InsertBlock mspace poinsert name xscale yscale zscale rot1)
(princ "ok !Дверной проем")(terpri))
(progn
(setq drop (vlax-invoke _block 'getdynamicblockproperties ))
(nth 0 drop)
(setq _len1 (vlax-variant-value (vla-get-value (nth 0 drop) )))
(setq quantity (fix (/ _len1 L900)))
(setq counter1 0)
(while (< counter1 quantity)
(setq x_coord` (+ x_coord (/ L900 2) (* 1 counter1 L900)))
(setq poinsert (vlax-3d-point x_coord` y_coord z_coord))
(vla-InsertBlock mspace poinsert name xscale yscale zscale rot1)
(setq counter1 (+ 1 counter1))(princ "ok !Дверной проем")(terpri))
)
)))
(princ counter)
(setq counter (+ 1 counter))))
(progn
(alert (princ "\nНет блоков, расположите блоки на фасаде здания"))
(terpri))
))