Author Topic: Counting Blocks  (Read 19770 times)

0 Members and 1 Guest are viewing this topic.

ML

  • Guest
Re: Counting Blocks
« Reply #30 on: April 11, 2007, 01:49:18 PM »

Luke

Give The VBA a try
I will help you if you need it

Mark

Luke

  • Guest
Re: Counting Blocks
« Reply #31 on: April 11, 2007, 02:00:27 PM »
The diesel / lisp that Mark & Crank supplied work great and aside from understanding the exact code to type I already knew where and how to do all the other things they were describing. 

I'm always looking to learn new things but I've never done anything with VBA so I'll need you to hold my hand, step by step throught this.

What is first?

ML

  • Guest
Re: Counting Blocks
« Reply #32 on: April 11, 2007, 02:12:32 PM »

OK, Go to Tools-Macro-VBA Manager-Click New (For New VBa Project)
Click the button that says Visual Basic Editor

Righ Click on your new project, by default it will be called ACADProject
Click insert Module, then paste the code in the code that I gave you.

By default the new module puts in Sub and End Sub, so make sure you delete it because my code already has it.
Save it

Then you can go back to Tools-Macro-Macros and run it from there

I hope this helps?

Let me know if you have any problem   :-)

Mark

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Counting Blocks
« Reply #33 on: April 11, 2007, 02:16:03 PM »
A word of cautions....

When you use 'setenv' it will be available to all drawings, and in future sessions.  It can be good or bad, so just and FYI.

Continue....  :-)
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Luke

  • Guest
Re: Counting Blocks
« Reply #34 on: April 11, 2007, 02:29:46 PM »
OK so I did all that. 

When I run it it pops a little windows box up on my screen that says "There are 71 blocks in this drawing and" OK.  When I click OK it then says "886 Block references" OK.  When I click OK there it seems to be done. 

Is this working how you planned?

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Re: Counting Blocks
« Reply #35 on: April 11, 2007, 02:56:39 PM »
A word of cautions....

When you use 'setenv' it will be available to all drawings, and in future sessions.  It can be good or bad, so just and FYI.

Just to follow-up, the values are stored in the registry as seen below.


TheSwamp.org  (serving the CAD community since 2003)

CottageCGirl

  • Guest
Re: Counting Blocks
« Reply #36 on: April 11, 2007, 03:05:48 PM »
If you have Express Tools (I may be getting off the wrong train here) you could use "bcount". Try typing it in the command line.

NiiiiiiiCE one thanks, did not know about that...it is FABULOUS for systems furniture..........you get the good fairy points for the day!!! :-)
won't use it for ordering , but for general budgeting this will be awesome....

Luke

  • Guest
Re: Counting Blocks
« Reply #37 on: April 11, 2007, 03:18:52 PM »
Well everything Mark Thomas & Crank gave me previously works great and does just what I want.  I'm not concerned with the Model Paper space issues.  I'm only working in 1.  Additionally I have no interest in messing with or going into and extracting info from my registry. 

Thanks again all. I've done what I need to do.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Counting Blocks
« Reply #38 on: April 11, 2007, 03:43:13 PM »
A word of cautions....

When you use 'setenv' it will be available to all drawings, and in future sessions.  It can be good or bad, so just and FYI.

Just to follow-up, the values are stored in the registry as seen below.

<cut> image </cut>

Thanks for pointing out where it went.  I tried looking, but looked in the wrong place to start with.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

ML

  • Guest
Re: Counting Blocks
« Reply #39 on: April 11, 2007, 03:48:17 PM »

Yep,

That was it Luke.
I'm sorry if it isn't what you are looking for but that is how you insert VBA code and run a macro.
You can also launch the macro from a toolbar button, a pulldown menu etc.
If it is a routine you will use frequently, like LISP, you can put it in Startup Suite

Mark

Luke

  • Guest
Re: Counting Blocks
« Reply #40 on: April 11, 2007, 03:49:43 PM »
Thanks Mark,
Good to know, just doesn't give me the results I was looking for. 

Regards
Luke

ML

  • Guest
Re: Counting Blocks
« Reply #41 on: April 11, 2007, 04:07:04 PM »

Sure man, no problem
Now, it is VBA forever, right?   :-D

Remember VBA crosses over to MS Products, LISP is limited to ACAD, though LISP still has a place for sure.

Mark

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Counting Blocks
« Reply #42 on: April 11, 2007, 04:23:50 PM »
A word of cautions....

When you use 'setenv' it will be available to all drawings, and in future sessions.  It can be good or bad, so just and FYI.

Just to follow-up, the values are stored in the registry as seen below.



Just for no other reason but to ask why.

Why are you accessing and storing data to the registry?
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

Luke

  • Guest
Re: Counting Blocks
« Reply #43 on: May 02, 2007, 09:30:35 AM »
Mark Thomas,

Thanks again for your previous help on this post. 

I have another question now...

What do I need to change to get it to result a zero if the qty truely is zero.  What is happening to me is when the block is not in the drawing the lisp recognizes nothing and does not update the qty.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Re: Counting Blocks
« Reply #44 on: May 02, 2007, 09:51:46 AM »
Mark Thomas,

Thanks again for your previous help on this post. 

I have another question now...

What do I need to change to get it to result a zero if the qty truely is zero.  What is happening to me is when the block is not in the drawing the lisp recognizes nothing and does not update the qty.

That shouldn't be to hard to do, give me a little while to work it out.
TheSwamp.org  (serving the CAD community since 2003)