need help to set block to a variable from (assoc 10 (entget (car (entsel "Select Block: "))))
Hi.
I'm trying to write a lisp that select a block for copy,get its insertion point as base point and paste it in a destenation point.
I can select the block to get its insertion point,but I cant find a way to use this selection to get the block object for the copying command.
here is the lisp and where I stuck:
(defun c:copytest81 ()
(vl-load-com)
(prompt "\nSelect block: ")
(setq p10 (assoc 10 (entget (car (entsel "Select Block: "))))) ;; HOW GET THE OBJECT THAT WAS SELECTED HERE
AND SET IT TO OBJ?
(setq obj (.....?
(setq p20 (getpoint "\nStart Point: "))
(command "COPY" obj "" p10 p20 ) ;;Insert the pipe block
(princ)
)
thanks,
Ari.
*EDIT:
Got it:
(if (setq ensel (entsel "\nSelect Block: ")) ;select the block object to copy
(setq bname (cdr (assoc 2 (entget (car ensel)))))
)
(setq obj (car ensel)) ;set the block object to varaible
I'm trying to write a lisp that select a block for copy,get its insertion point as base point and paste it in a destenation point.
I can select the block to get its insertion point,but I cant find a way to use this selection to get the block object for the copying command.
here is the lisp and where I stuck:
(defun c:copytest81 ()
(vl-load-com)
(prompt "\nSelect block: ")
(setq p10 (assoc 10 (entget (car (entsel "Select Block: "))))) ;; HOW GET THE OBJECT THAT WAS SELECTED HERE
AND SET IT TO OBJ?
(setq obj (.....?
(setq p20 (getpoint "\nStart Point: "))
(command "COPY" obj "" p10 p20 ) ;;Insert the pipe block
(princ)
)
thanks,
Ari.
*EDIT:
Got it:
(if (setq ensel (entsel "\nSelect Block: ")) ;select the block object to copy
(setq bname (cdr (assoc 2 (entget (car ensel)))))
)
(setq obj (car ensel)) ;set the block object to varaible
0