Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Block in MLEADER

3 REPLIES 3
Reply
Message 1 of 4
stephane.aubertin
879 Views, 3 Replies

Block in MLEADER

Hello,

We have a block contain 10 attibs to be seen with 8 differents scales making 80 attribs!  (We use that before Annotative features). When we edit this block, we have a LISP that ask for the 10 avlues, and copy it for all the scale.

This lisp use the block ename in argument.

 

We start to use that  block with MLEADER, but we can not edited with our lisp (can not find the ename of the block in the MLEADER definition ).

Is that a way to find this ename, and to be able to modify (our substitute) all the attributes value.

 

 

 

 

Stephane

Stephane A. Aubertin
Responsable - traitement de l'information (gestion des espaces)
Service de la planification et des projets immobiliers
HEC Montréal
www.hec.ca
3 REPLIES 3
Message 2 of 4

Here is an example of how you can do it.  You supply it an associated list of tag names and new values.  It will search the whole drawing for mleaders, and change the attributes that match, no matter the block name.  So you might want to change it a little, but it will be a good starting point.

 

(defun UpdateMleaderAttributes ( attList / cnt ss Ent tempList ChangeAtt newEntData )
    ; Will update all mleaders whose attribute's tag matches those in the attList argument.
    ; Call like (UpdateMleaderAttributes '(("DETAIL" . "1")("SHEET" . "S-2.4")))
    
    (setq cnt -1)
    (if (setq ss (ssget "_x" '((0 . "MULTILEADER"))))
        (while (setq Ent (ssname ss (setq cnt (1+ cnt))))
            (foreach i (entget Ent)
                (if
                    (and
                        (equal (type (cdr i)) 'ENAME)
                        (setq tempList (assoc (cdr (assoc 2 (entget (cdr i)))) attList))
                    )
                    (setq ChangeAtt T)
                )
                (setq newEntData
                    (cons
                        (if
                            (and
                                ChangeAtt
                                (equal (car i) 302)
                            )
                            (progn
                                (setq ChangeAtt nil)
                                (cons 302 (cdr tempList))
                            )
                            i
                        )
                        newEntData
                    )
                )
            )
            (entmod (reverse newEntData))
            (setq newEntData nil)
        )
    )
    (princ)
)

Message 3 of 4

What if I want to add a prompt?

 

 I added this line;

(setq newval (getstring "\nEnter new Revision value:"))

 

Then tweaked your command like this;

(UpdateMleaderAttributes '(("REVNUM" . newval)))

 

I was not able to change the attribute in my multileader.  Any ideas?

 

Thanks in advance.

Message 4 of 4

It was to complex to use Mleader with Block and rewrite our lisp to control content of the attribs. So we decided to use ordinary Leader and associate them with our Block  in a Unnamed Group.
This way our old lisp was able to control then content of the block.

 

I hope this suggestion helps

 

Stephane

Stephane A. Aubertin
Responsable - traitement de l'information (gestion des espaces)
Service de la planification et des projets immobiliers
HEC Montréal
www.hec.ca

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost