Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Active Member
stephane.aubertin
Posts: 9
Registered: ‎02-26-2010
Message 1 of 4 (388 Views)

Block in MLEADER

388 Views, 3 Replies
09-27-2010 02:27 PM

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
Mentor
t.willey
Posts: 2,504
Registered: ‎02-17-2004
Message 2 of 4 (346 Views)

Re: Block in MLEADER

09-28-2010 10:11 AM in reply to: stephane.aubertin

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)
)

Contributor
bbarkman
Posts: 18
Registered: ‎09-28-2010
Message 3 of 4 (154 Views)

Re: Block in MLEADER

09-21-2012 07:06 AM in reply to: stephane.aubertin

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.

Active Member
stephane.aubertin
Posts: 9
Registered: ‎02-26-2010
Message 4 of 4 (146 Views)

Re: Block in MLEADER

09-21-2012 07:57 AM in reply to: bbarkman

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
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.