AutoCAD 2013/2014/2015

AutoCAD 2013/2014/2015

Reply
Member
Voin_sveta
Posts: 3
Registered: ‎12-25-2012
Message 1 of 5 (180 Views)

displaying the number of the entry block

180 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?
*Expert Elite*
tcorey
Posts: 2,557
Registered: ‎12-18-2002
Message 2 of 5 (159 Views)

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
Member
Voin_sveta
Posts: 3
Registered: ‎12-25-2012
Message 3 of 5 (141 Views)

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. 

*Expert Elite*
tcorey
Posts: 2,557
Registered: ‎12-18-2002
Message 4 of 5 (128 Views)

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
*Expert Elite*
rkmcswain
Posts: 3,343
Registered: ‎11-13-2006
Message 5 of 5 (124 Views)

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

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.