• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    AutoCAD 2013/2014 DWG Format

    Reply
    Member
    Posts: 3
    Registered: ‎12-25-2012

    displaying the number of the entry block

    120 Views, 4 Replies
    12-25-2012 09:59 AM
    In block attribute manager i can see the number of instances of the selected block in the current drawing. Can I set this value in the field?
    Please use plain text.
    *Expert Elite*
    Posts: 1,766
    Registered: ‎12-18-2002

    Re: displaying the number of the entry block

    12-26-2012 08:55 AM in reply to: Voin_sveta

    You could do this by creating an AutoLISP variable that stores the number of blocks. Your field could reference the variable.

     

    (setq blknm (getstring "\nEnter Block Name: "))
    (setq ss (ssget "x" (list (cons 0 "INSERT")(cons 2 Blknm))))
    (setq sslen (sslength ss))

     

    Have the field reference the variable sslen. This will not update automatically when additional copies of the block are inserted. You would either have to run it manually or put it in acaddoc.lsp so it loads with each drawing you open.

     

     

     

     

    Tim Corey, Owner
    Delta Engineering Systems
    Redding, CA
    Autodesk Authorized Value-Added Reseller
    Please use plain text.
    Member
    Posts: 3
    Registered: ‎12-25-2012

    Re: displaying the number of the entry block

    12-27-2012 03:16 AM in reply to: tcorey

    i created file %name%.lsp

     

    with code

     

    "(setq blknm (getstring "\nEnter Block Name: "))
    (setq ss (ssget "x" (list (cons 0 "INSERT")(cons 2 Blknm))))
    (setq sslen (sslength ss))

    "

    next i used command appload for load this file.

     

    and now i have lispVariable only blknm. 

    Please use plain text.
    *Expert Elite*
    Posts: 1,766
    Registered: ‎12-18-2002

    Re: displaying the number of the entry block

    12-27-2012 01:13 PM in reply to: Voin_sveta

    You should also have SSLEN. I have attached a lisp file that works correclty.

     

     

     

     

    Tim Corey, Owner
    Delta Engineering Systems
    Redding, CA
    Autodesk Authorized Value-Added Reseller
    Please use plain text.
    *Expert Elite*
    rkmcswain
    Posts: 1,382
    Registered: ‎11-13-2006

    Re: displaying the number of the entry block

    12-27-2012 01:47 PM in reply to: Voin_sveta

    If you can't or don't want to use lisp, another option would be to create a DataExtraction table. The Quantity cell will update (semi) automatically like a field.

     

    table1.png

    Please use plain text.