AutoCAD 2013/2014/2015

AutoCAD 2013/2014/2015

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

displaying the number of the entry block

190 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,765
Registered: ‎12-18-2002
Message 2 of 5 (169 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 (151 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,765
Registered: ‎12-18-2002
Message 4 of 5 (138 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,634
Registered: ‎11-13-2006
Message 5 of 5 (134 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

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.