AutoCAD 2013/2014/2015

AutoCAD 2013/2014/2015

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

displaying the number of the entry block

189 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,716
Registered: ‎12-18-2002
Message 2 of 5 (168 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 (150 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,716
Registered: ‎12-18-2002
Message 4 of 5 (137 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,592
Registered: ‎11-13-2006
Message 5 of 5 (133 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
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!