@Moshe-A a écrit :
Thank you very much for this but in this program i select the nested object by iterating over the block objects
so no call to (nentselp) is made and can not have xform from it. the parent block is selected by (ssget) so need work around?
You can use the following function (from the same library).
;; gc:BlockTransform
;; Returns the transformation matrix of a block reference (insert)
;; 4x4 matrix as the one returned by nentselp
;;
;; Argument
;; ename : the block reference entity name
(defun gc:BlockTransform (ename / elst ang norm)
(setq elst (entget ename)
ang (cdr (assoc 50 elst))
norm (cdr (assoc 210 elst))
)
(append
(mapcar
(function
(lambda (v1 v2)
(append v1 (list v2))
)
)
(setq mat
(mxm
(mapcar (function (lambda (v) (trans v 0 norm T)))
'((1. 0. 0.) (0. 1. 0.) (0. 0. 1.))
)
(mxm
(list (list (cos ang) (- (sin ang)) 0.)
(list (sin ang) (cos ang) 0.)
'(0. 0. 1.)
)
(list (list (cdr (assoc 41 elst)) 0. 0.)
(list 0. (cdr (assoc 42 elst)) 0.)
(list 0. 0. (cdr (assoc 43 elst)))
)
)
)
)
(mapcar
'-
(trans (cdr (assoc 10 elst)) norm 0)
(mxv mat
(cdr (assoc 10 (tblsearch "BLOCK" (cdr (assoc 2 elst)))))
)
)
)
'((0. 0. 0. 1.))
)
)