+ Reply to Thread
Results 1 to 10 of 10
  1. #1
    Forum Newbie
    Discipline
    Architectural
    Using
    AutoCAD 2018
    Join Date
    Jun 2018
    Posts
    6

    Default Block Description to Multileader

    Registered forum members do not see this ad.

    Hi Designers,

    I would like to have a lisp that reads the Description of a Block and shows it on a Multileader so then you don't have to type in the Text once a Block is registered.

    I know this topic was covered in an much older post before - almost 10 years ago - but I put hours experimenting with the Lisp in different ways and still couldn't get it to work 100%.

    http://www.cadtutor.net/forum/showth...ltileader-text

    Does anyone have the solution to this?

  2. #2
    Full Member
    Using
    AutoCAD 2014
    Join Date
    Dec 2010
    Posts
    95

    Default

    Here is what I wrote:
    - the client selects a block (I assume it has a description, I assume the client clicks on a block ... no anti dummy protection)
    - the client must now draw the MLeader: two points: arrow head + leader landing
    - The routine will fill in the caption, being the description of the block.

    Command: SAD (pun maybe intended, although it's just an abbreviation)

    Code:
    (defun getBlockProperties ( #Entsel / )
          (setq #Entsel   (vlax-ename->vla-object (car #Entsel))
                ;; insertion point
                #InsPoint (vlax-safearray->list
                            (vlax-variant-value
                              (vla-get-InsertionPoint #Entsel)
                            ) ;_ vlax-variant-value
                          ) ;_ vlax-safearray->list
                ;; block name
                #Name     (vla-get-name #Entsel)
                ;; block description
                #Desc     (vla-get-comments
                            (vla-item
                              (vla-get-blocks
                                (vla-get-activedocument (vlax-get-acad-object))
                              ) ;_ vla-get-blocks
                              #Name
                            ) ;_ vla-item
                          ) ;_ vla-get-comments
          ) ;_ setq
      (list #Name #InsPoint #Desc)
    )
    
    
    ;; create Mleader with caption.
    (defun wmt (caption / )
      ;;(vl-cmdf "_.MLEADER" PAUSE PAUSE "" "_.TEXTEDIT" "_L")
      (vl-cmdf "_.MLEADER" PAUSE PAUSE  caption)
    )
    
    ;; Select And get Description
    (defun c:sad ( / desc)  
      (setq desc (nth 2 (getBlockProperties (entsel "\nSelect a block: "))))
      (princ "\nNow draw the MLeader:\n")
      (wmt desc)
      (princ)
    )
    Happy with this?

  3. #3
    Forum Newbie
    Discipline
    Architectural
    Using
    AutoCAD 2018
    Join Date
    Jun 2018
    Posts
    6

    Default

    Almost !

    It identifies the Description, but won't fill in the caption.

  4. #4
    Luminous Being Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draughtsman
    Discipline
    Mechanical
    Details
    HVAC, Drainage, Water Supply, Fire Fighting and a little about Electricity.
    Using
    AutoCAD 2017
    Join Date
    Oct 2009
    Location
    Great Syria , Living in Abu Dhabi
    Posts
    6,246

    Default

    The simplest I guess.

    Code:
    (defun c:d2ml ( / s d)
      (and (princ "\nPick a block :")
           (setq s (ssget "_+.:S:E" '((0 . "INSERT"))))
           (or (setq d (cdr (assoc 4 (entget (tblobjname "BLOCK" (cdr (assoc 2 (entget (ssname s 0)))))))))
               (alert "Block does not have a description <!>")
               )
           (vl-cmdf "_.Mleader" "\\" "\\" d)
           )
      (princ)
      )

  5. #5
    Forum Newbie
    Discipline
    Architectural
    Using
    AutoCAD 2018
    Join Date
    Jun 2018
    Posts
    6

    Default

    Same result.

    I don't know why it won't put in the Description..

  6. #6
    Luminous Being Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draughtsman
    Discipline
    Mechanical
    Details
    HVAC, Drainage, Water Supply, Fire Fighting and a little about Electricity.
    Using
    AutoCAD 2017
    Join Date
    Oct 2009
    Location
    Great Syria , Living in Abu Dhabi
    Posts
    6,246

    Default

    Quote Originally Posted by AlexP View Post
    Same result.

    I don't know why it won't put in the Description..
    Can you post a drawing including the block?

  7. #7
    Forum Newbie
    Discipline
    Architectural
    Using
    AutoCAD 2018
    Join Date
    Jun 2018
    Posts
    6

    Default Dwg

    See attached.
    Attached Files

  8. #8
    Luminous Being Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draughtsman
    Discipline
    Mechanical
    Details
    HVAC, Drainage, Water Supply, Fire Fighting and a little about Electricity.
    Using
    AutoCAD 2017
    Join Date
    Oct 2009
    Location
    Great Syria , Living in Abu Dhabi
    Posts
    6,246

    Default

    Just this a go and let me know.
    Code:
    (defun c:d2ml ( / s d l n e)
      (and (princ "\nPick a block :")
           (setq s (ssget "_+.:S:E" '((0 . "INSERT"))))
           (or (setq d (cdr (assoc 4 (entget (tblobjname "BLOCK" (cdr (assoc 2 (entget (ssname s 0)))))))))
               (alert "Block does not have a description <!>")
               )
           (setq l (entlast))
           (vl-cmdf "_.Mleader" "\\" "\\" "")
           (and (not (= l (setq n (entlast))))
                (entmod (subst (cons 304 d) (assoc 304 (setq e (entget n))) e))
                )
           )
      (princ)
      )

  9. #9
    Forum Newbie
    Discipline
    Architectural
    Using
    AutoCAD 2018
    Join Date
    Jun 2018
    Posts
    6

    Default

    You are a Legend Tharwat !!

    It's works perfectly, many thanks for that !

    And you Emanuel for giving it a go, I appreciate it.

  10. #10
    Luminous Being Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draughtsman
    Discipline
    Mechanical
    Details
    HVAC, Drainage, Water Supply, Fire Fighting and a little about Electricity.
    Using
    AutoCAD 2017
    Join Date
    Oct 2009
    Location
    Great Syria , Living in Abu Dhabi
    Posts
    6,246

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by AlexP View Post
    You are a Legend Tharwat !!

    It's works perfectly, many thanks for that !
    Thanks for the nice words AlexP.

    You are welcome anytime.

Similar Threads

  1. Replies: 0
    Last Post: 23rd May 2016, 12:22 pm
  2. Block Description Property
    By guitarguy1685 in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 2
    Last Post: 16th May 2016, 04:20 pm
  3. How to add Block Description
    By bijoyvm in forum AutoLISP, Visual LISP & DCL
    Replies: 5
    Last Post: 4th Apr 2011, 08:57 am
  4. Edit Block Description
    By AQucsaiJr in forum AutoCAD General
    Replies: 17
    Last Post: 19th Oct 2009, 09:27 pm
  5. block description in vba
    By Jaap in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 20th Jan 2009, 02:51 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts