I know that is not easy , that why I am calling for yours help ,I don't understand at all. Try explaining in more detail and post the WMF files you are using.
The blocks wich generate the blocks , make it a WMF file , when I put this WMF file in autocad , it show like a block , but I transform it in block with atributes , I think It could help
Hi again Tharwat , thanks for fast attempting , but it does not work
For some values it work, but not for all !!!
For some values it's take the maximum values , for other ones it take the minimum values
sometimes go wrong way
(vl-load-com)
(defun c:MaxAttTable ( / *error* doc oVAR ss i pt ssi n0 n1 endel point name)
(defun *error* (errmsg)
(if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break"))
(princ (strcat "\nError: " errmsg)))
(foreach e oVAR (setvar (car e) (cdr e)))
(vla-endundomark doc)
(princ))
(vla-startundomark (setq doc (vla-get-activedocument (vlax-get-acad-object))))
(foreach e '(CMDECHO ORTHOMODE OSMODE ATTREQ)
(setq oVAR (cons (cons e (getvar e)) oVAR)))
(setvar 'CMDECHO 0)
(setvar 'ORTHOMODE 0)
(setvar 'ATTREQ 0)
(setvar 'OSMODE 0)
(if (and (princ "\nNeed ATTDEFs of exploded blocks placed on top of each other, ")
(setq ss (ssget '((0 . "ATTDEF"))))
(setq i (sslength ss))
)
(progn
(while (not (minusp (setq i (1- i))))
(setq pt (cdr (assoc 10 (entget (ssname ss i))))
ssi (ssget "_C" pt (polar pt 0.5 3) '((0 . "ATTDEF"))))
(cond ((= 1 (sslength ssi)))
((and (= 2 (sslength ssi))
(numberp (setq n0 (read (vl-string-subst "." "," (cdr (assoc 1 (entget (ssname ssi 0))))))))
(numberp (setq n1 (read (vl-string-subst "." "," (cdr (assoc 1 (entget (ssname ssi 1)))))))))
(setq endel (ssname ssi (car (vl-sort-i (list n0 n1) '<))))
(if (not (equal endel ; for deleting - if deleted ent is NOT
(ssname ss i))) ; the current of while loop
(setq i (1- i))) ; decrease the index
(ssdel endel ss)
(entdel endel))
(T
(princ "\nSomething is wrong, problematic texts are marked yellow!")
(command "_.CHPROP" ssi "" "_C" 2 ""))))
(setvar 'OSMODE (cdr (assoc 'OSMODE oVAR)))
(if (setq point (getpoint "\nSpecify insertion point <don't make a block>: "))
(progn
(setq i 0)
(while (tblsearch "block" (setq name (strcat "MyBlock" (itoa (setq i (1+ i)))))))
(command "_.-BLOCK" name "_none" point ss ""
"_.-INSERT" name "_none" point 1 "" "")))
)
)
(foreach e oVAR (setvar (car e) (cdr e)))
(vla-endundomark doc)
(princ)
)
or onother one (vl-load-com)
(defun c:demo (/ *error* ATT BLK INS_PT L1 L2 L3 LAST_E LST OBJ PT RECQ)
(defun *error* (msg)
(if req
(setvar 'ATTREQ req)
)
(cond ((not msg))
((member msg '("Function cancelled" "quit / exit abort")))
((princ (strcat "\n** Error: " msg " ** ")))
)
(princ)
)
(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 req (getvar 'ATTREQ))
(setvar 'ATTREQ 0)
(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))
)
)
)
)
)
(*error* nil)
(princ)
)
write by onother master : Henrique Silva