Одиночная вставка блока, висящего на курсоре
(defun ru-block-insert-scaled-angleask (msg
block_name
x_scale
y_scale
block_angle
is_attedit
/
curr_layer
do_insert
ins_point
is_attrib
sub_ent
tmp_angle
tmp_block
tmp_ent
unnamed_block
put_point
exp_block
result
)
;;;
;|------------------------------------------------------------------
Вариант с одиночной вставкой блока
(ru-block-insert-scaled-angleask "Центр отверстия" "RU_WALL_HOLE_MARK" 500 1000 nil nil)
(ru-block-insert-scaled-angleask "Центр отверстия" "RU_WALL_HOLE_MARK" 500 1000 nil T)
|;
(if (ru-ucs-z-is-parallel-wcs)
(progn
(setq do_insert t
ins_point
(list (+ (car (getvar "VSMAX"))
(* 2 (max x_scale y_scale))
) ;_ end of +
(+ (cadr (getvar "VSMAX"))
(* 2 (max x_scale y_scale))
) ;_ end of +
0.0
) ;_ end of list
tmp_angle (if block_angle
block_angle
0
) ;_ end of if
curr_layer (getvar "CLAYER")
) ;_ end of setq
(if (setq tmp_block (ru-block-insert-obj
block_name
ins_point
x_scale
y_scale
1.0
tmp_angle
) ;_ end of ru-block-insert-obj
) ;_ end of setq
(progn
(setq tmp_block (vlax-vla-object->ename tmp_block)
tmp_ent tmp_block
) ;_ end of setq
(entmake (list (cons 0 "BLOCK")
(cons 100 "AcDbEntity")
(cons 100 "AcDbBlockBegin")
(cons 2 "*U0")
(cons 8 curr_layer)
(cons 70 1)
(cons 62 256)
(cons 10 ins_point)
) ;_ end of list
) ;_ end of entmake
(entmake (entget tmp_ent))
(while (setq tmp_ent (entnext tmp_ent))
(if (= (cdr (assoc 0 (setq sub_ent (entget tmp_ent))))
"ATTRIB"
) ;_ end of =
(setq is_attrib t)
) ;_ end of if
(entmake sub_ent)
) ;_ end of while
(setq unnamed_block
(entmake (list (cons 0 "ENDBLK")
(cons 100 "AcDbEntity")
(cons 100 "AcDbBlockEnd")
(cons 8 curr_layer)
) ;_ end of list
) ;_ end of entmake
) ;_ end of setq
(entdel tmp_block)
) ;_ end of progn
(setq do_insert nil)
) ;_ end of if
(while do_insert
(setq tmp_block (vlax-vla-object->ename
(ru-block-insert-obj
unnamed_block
ins_point
1.0
1.0
1.0
0.0
) ;_ end of ru-block-insert-obj
) ;_ end of vlax-vla-object->ename
) ;_ end of setq
(princ (strcat "
" msg " <Хватит>: "))
(if (or (not (setq do_insert (vl-cmdf "_.CHANGE"
tmp_block
""
""
pause
""
) ;_ end of vl-cmdf
) ;_ end of setq
) ;_ end of not
(equal
(setq put_point (cdr (assoc 10 (entget tmp_block))))
ins_point
1e-6
) ;_ end of equal
) ;_ end of or
(setq do_insert nil)
(progn
(if (not block_angle)
(progn
(princ "
Угол поворота <0>: ")
(setq do_insert (vl-cmdf "_.CHANGE"
tmp_block
""
""
""
pause
) ;_ end of vl-cmdf
) ;_ end of setq
) ;_ end of progn
) ;_ end of if
(if do_insert
(progn
(setq exp_block
(car
(vlax-safearray->list
(vlax-variant-value
(vla-explode
(vlax-ename->vla-object
tmp_block
) ;_ end of vlax-ename->vla-object
) ;_ end of vla-explode
) ;_ end of vlax-variant-value
) ;_ end of vlax-safearray->list
) ;_ end of car
) ;_ end of setq
(if (and is_attrib is_attedit)
(vl-cmdf "_.DDATTE" (entlast))
) ;_ end of if
(vla-put-insertionpoint
exp_block
(vlax-3d-point put_point)
) ;_* Mark #2
(setq result (list (entlast) put_point))
) ;_ end of progn
) ;_ end of if
) ;_ end of progn
) ;_ end of if
(entdel tmp_block)
;;; Чтобы не было продолжения и не ломать цикл
(setq do_insert nil)
) ;_ end of while
) ;_ end of progn
(alert (strcat "
Ось Z текущей ПСК не параллельна оси Z МСК."
"
Выполение команды прекращено."
) ;_ end of strcat
) ;_ end of alert
) ;_ end of if
;; Вернуть какой-то результат - списком примитив - точка_вставки
result
) ;_ end of defun