Sergiu,
as I said in my previous message, one solution was to use the relative position from each Att ,from the block insertion, to point to text insertion point.
But to use this approach, the blocks must be identical, I did edit the two blocks, to ensure that, in my dwg, both blocks, are identical, I did edit the bloks in the Block Editor, and scale both, to the same size.
The following quick and dirty 'demo', sorry but I don't have much spare time to write a cleaner code, is just one possible approach to make the comparison between both blocs...
(vl-load-com)
(defun c:demo (/ ATT BLK INS_PT L1 L2 L3 LAST_E LST OBJ PT SS)
(if (and (princ "\n Select the two blocks: ")
(setq ss (ssget '((0 . "INSERT") (2 . "MyBlock1,MyBlock2") (66 . 1))))
(= (sslength ss) 2)
(setq pt (getpoint "\ Enter point to insert the result: "))
(setq last_e (entlast))
)
(progn
(setq obj (vlax-ename->vla-object (ssname ss 0))
ins_pt (vlax-get obj 'insertionpoint)
blk (vla-get-effectivename obj)
l1 (mapcar
'(lambda (att)
(cons (mapcar '- (vlax-get att 'insertionpoint) ins_pt) (vla-get-TextString att))
)
(vlax-invoke obj "GetAttributes")
)
obj (vlax-ename->vla-object (ssname ss 1))
ins_pt (vlax-get obj 'insertionpoint)
l2 (mapcar
'(lambda (att)
(cons (mapcar '- (vlax-get att 'insertionpoint) ins_pt) (vla-get-TextString att))
)
(vlax-invoke obj "GetAttributes")
)
l1 (vl-remove-if
'(lambda (x)
(vl-some '(lambda (y)
(if (equal (car x) (car y) 3.5)
(setq l2 (vl-remove y l2)
l3 (cons (if (> (atof (vl-string-subst "." "," (cdr x))) (atof (vl-string-subst "." "," (cdr y))))
x
y
)
l3
)
)
)
)
l2
)
)
l1
)
lst (append l1 l2 l3)
)
(command "-insert" blk "_Scale" 1 pt 0)
(command "_.explode" "_L")
(setq ss (ssget "_P" '((0 . "ATTDEF"))))
(command "_.erase" ss "")
(foreach x lst
(entmake
(list
(cons 0 "TEXT")
(cons 100 "AcDbText")
(cons 40 2.5)
(cons 10 (mapcar '+ (car x) pt))
(cons 1 (cdr x))
)
)
)
)
)
(princ)
)
Hope this helps,
Henrique