| Author |
Message |
gizmowiebe
Guest
|
Posted:
Sun Dec 26, 2004 2:07 am Post subject:
Count blocks add to listbox |
|
|
Hi,
What I would like to do is to count all block(with the same name) in the acad modelspace. and then put those values in a listbox with 2 columns. So It would look something like this.
Rear 3
Front 6
Bold 9
screw 10
does anyone have any sugestions.
Thx
Wiebe
|
|
| Back to top |
|
 |
Nava Ran
Guest
|
Posted:
Sun Dec 26, 2004 11:12 am Post subject:
Re: Count blocks add to listbox |
|
|
ToolPac does what you want and more
http://www.dotsoft.com/toolpac.htm
BSR-Block summary report of selected blocks, with clipboard & table options
Ran
"gizmowiebe" <nospam@address.withheld> wrote in message
news:6615005.1104008874756.JavaMail.jive@jiveforum2.autodesk.com...
| Quote: | Hi,
What I would like to do is to count all block(with the same name) in the
acad modelspace. and then put those values in a listbox with 2 columns. So
It would look something like this.
Rear 3
Front 6
Bold 9
screw 10
does anyone have any sugestions.
Thx
Wiebe |
|
|
| Back to top |
|
 |
gizmowiebe
Guest
|
Posted:
Sun Dec 26, 2004 11:00 pm Post subject:
Re: Count blocks add to listbox |
|
|
Thx but I would like to create my own program....
|
|
| Back to top |
|
 |
Wade
Guest
|
Posted:
Mon Dec 27, 2004 6:11 pm Post subject:
Re: Count blocks add to listbox |
|
|
Here is something that will at least get you started. This assumes you have
a Form with a Command Button (named cmdListBlocks) and a List Box (named
ListBoxBlocks). To be more useful, you'll have to set up some filters.
Private Sub cmdListBlocks_Click()
Dim blk As AcadBlock
Dim MyBlkArray() As Variant
Dim i As Long
i = 0
For Each blk In ThisDrawing.Blocks
i = i + 1
ReDim Preserve MyBlkArray(2, i) '2 rows by i columns
MyBlkArray(0, i) = blk.Name
MyBlkArray(1, i) = blk.Count
Next blk
Me.ListBoxBlocks.ColumnCount = 2
Me.ListBoxBlocks.ColumnWidths = "36;36" ' each 0.5" wide
Me.ListBoxBlocks.Column() = MyBlkArray
End Sub
"gizmowiebe" <nospam@address.withheld> wrote in message
news:6615005.1104008874756.JavaMail.jive@jiveforum2.autodesk.com...
| Quote: | Hi,
What I would like to do is to count all block(with the same name) in the
acad modelspace. and then put those values in a listbox with 2 columns. So |
It would look something like this.
| Quote: |
Rear 3
Front 6
Bold 9
screw 10
does anyone have any sugestions.
Thx
Wiebe |
|
|
| Back to top |
|
 |
Wade
Guest
|
Posted:
Mon Dec 27, 2004 7:47 pm Post subject:
Re: Count blocks add to listbox (Better) |
|
|
This one works better...
Private Sub cmdListBlocks_Click()
Dim MyBlkArray() As Variant
Dim i As Long, j As Long
Dim count As Integer
Dim index As Integer
Dim FoundBlock As Boolean
count = ThisDrawing.ModelSpace.count
i = 0
For index = 0 To count - 1
If ThisDrawing.ModelSpace.Item(index).ObjectName =
"AcDbBlockReference" Then
j = 1
FoundBlock = False
While j <= i
If MyBlkArray(0, j) = ThisDrawing.ModelSpace.Item(index).Name
Then
MyBlkArray(1, j) = MyBlkArray(1, j) + 1
j = i
FoundBlock = True
End If
j = j + 1
Wend
If Not FoundBlock Then
i = i + 1
ReDim Preserve MyBlkArray(2, i)
MyBlkArray(0, i) = ThisDrawing.ModelSpace.Item(index).Name
MyBlkArray(1, i) = 1
End If
End If
Next index
Me.ListBoxBlocks.ColumnCount = 2
Me.ListBoxBlocks.ColumnWidths = "72;36"
Me.ListBoxBlocks.Column() = MyBlkArray
End Sub
"gizmowiebe" <nospam@address.withheld> wrote in message
news:6615005.1104008874756.JavaMail.jive@jiveforum2.autodesk.com...
| Quote: | Hi,
What I would like to do is to count all block(with the same name) in the
acad modelspace. and then put those values in a listbox with 2 columns. So |
It would look something like this.
| Quote: |
Rear 3
Front 6
Bold 9
screw 10
does anyone have any sugestions.
Thx
Wiebe |
|
|
| Back to top |
|
 |
gizmowiebe
Guest
|
Posted:
Thu Dec 30, 2004 6:38 pm Post subject:
Re: Count blocks add to listbox |
|
|
Thx Wade,
That codes works, but do you know how I can change it to add blocks nested in another block |
|
| Back to top |
|
 |
Wade
Guest
|
Posted:
Thu Dec 30, 2004 10:05 pm Post subject:
Re: Count blocks add to listbox |
|
|
Unfortuately, no, at least not yet.
Does anyone else know how?
"gizmowiebe" <nospam@address.withheld> wrote in message
news:20768832.1104413940191.JavaMail.jive@jiveforum1.autodesk.com...
| Quote: | Thx Wade,
That codes works, but do you know how I can change it to add blocks nested
in another block |
|
|
| Back to top |
|
 |
Ed Jobe
Guest
|
Posted:
Thu Dec 30, 2004 10:09 pm Post subject:
Re: Count blocks add to listbox |
|
|
Do you need to physically count nested blocks? Shouldn't it just be a
multiple of how many times its inserted? e.g. if block A contains 2 of block
B and block A is inserted 30 times, then there will be 60 of block B.
--
----
Ed
----
"Wade" <wnederveld@preinnewhofdonotreply.com> wrote in message
news:41d434fb_3@newsprd01...
| Quote: | Unfortuately, no, at least not yet.
Does anyone else know how?
"gizmowiebe" <nospam@address.withheld> wrote in message
news:20768832.1104413940191.JavaMail.jive@jiveforum1.autodesk.com...
Thx Wade,
That codes works, but do you know how I can change it to add blocks
nested
in another block
|
|
|
| Back to top |
|
 |
Wade
Guest
|
Posted:
Fri Dec 31, 2004 12:23 am Post subject:
Re: Count blocks add to listbox |
|
|
Ed,
Thanks for you input.
I think (just my opinion) it would be easier on the user if the program
would count the nested blocks inside each block. What if the user didn't
know how many blocks were in block "A" (like a new employee or if you
received a drawing from someone outside the company). What if your drawing
consisted of blocks A-Z, and blocks 1-99 each of which had anywhere from 0
to 2 or 3 nested blocks (and maybe a couple had blocks that were nested 3 or
4 levels deep - i.e. a faucet block inside a sink block inside a building
block) - of course a drawing this complicated is very unlikely. What you
suggest would work, it just might be harder if the drawing were very
complicated or the user was unfamilar with the blocks in the drawing.
"Ed Jobe" <not.edljobe@hotmail.com> wrote in message
news:41d43635$1_1@newsprd01...
| Quote: | Do you need to physically count nested blocks? Shouldn't it just be a
multiple of how many times its inserted? e.g. if block A contains 2 of
block
B and block A is inserted 30 times, then there will be 60 of block B.
--
----
Ed
----
"Wade" <wnederveld@preinnewhofdonotreply.com> wrote in message
news:41d434fb_3@newsprd01...
Unfortuately, no, at least not yet.
Does anyone else know how?
"gizmowiebe" <nospam@address.withheld> wrote in message
news:20768832.1104413940191.JavaMail.jive@jiveforum1.autodesk.com...
Thx Wade,
That codes works, but do you know how I can change it to add blocks
nested
in another block
|
|
|
| Back to top |
|
 |
Ed Jobe
Guest
|
Posted:
Fri Dec 31, 2004 12:39 am Post subject:
Re: Count blocks add to listbox |
|
|
When I said, "you", I meant you as a programmer. Your code needs to examine
each block def for nested blocks, then multiply by the parent's count.
--
----
Ed
----
"Wade" <wnederveld@preinnewhofdonotreply.com> wrote in message
news:41d45559$1_3@newsprd01...
| Quote: | Ed,
Thanks for you input.
I think (just my opinion) it would be easier on the user if the program
would count the nested blocks inside each block. What if the user didn't
know how many blocks were in block "A" (like a new employee or if you
received a drawing from someone outside the company). What if your
drawing
consisted of blocks A-Z, and blocks 1-99 each of which had anywhere from 0
to 2 or 3 nested blocks (and maybe a couple had blocks that were nested 3
or
4 levels deep - i.e. a faucet block inside a sink block inside a building
block) - of course a drawing this complicated is very unlikely. What you
suggest would work, it just might be harder if the drawing were very
complicated or the user was unfamilar with the blocks in the drawing.
"Ed Jobe" <not.edljobe@hotmail.com> wrote in message
news:41d43635$1_1@newsprd01...
Do you need to physically count nested blocks? Shouldn't it just be a
multiple of how many times its inserted? e.g. if block A contains 2 of
block
B and block A is inserted 30 times, then there will be 60 of block B.
--
----
Ed
----
"Wade" <wnederveld@preinnewhofdonotreply.com> wrote in message
news:41d434fb_3@newsprd01...
Unfortuately, no, at least not yet.
Does anyone else know how?
"gizmowiebe" <nospam@address.withheld> wrote in message
news:20768832.1104413940191.JavaMail.jive@jiveforum1.autodesk.com...
Thx Wade,
That codes works, but do you know how I can change it to add blocks
nested
in another block
|
|
|
| Back to top |
|
 |
Ed Jobe
Guest
|
Posted:
Fri Dec 31, 2004 12:46 am Post subject:
Re: Count blocks add to listbox |
|
|
BTW, I didn't examine Wade's code closely...until now. It uses the Block's
Count prop. This does not return the number of times the block was inserted,
but the Count of Items in the block. To get the number of insertions, you
have to iterate MS and/or PS looking for AcadBlockRef objects or use a
filtered selection set. There's lots of examples on this ng of how to do
that.
--
----
Ed
----
"Wade" <wnederveld@preinnewhofdonotreply.com> wrote in message
news:41d00867$1_2@newsprd01...
| Quote: | Here is something that will at least get you started. This assumes you
have
a Form with a Command Button (named cmdListBlocks) and a List Box (named
ListBoxBlocks). To be more useful, you'll have to set up some filters.
Private Sub cmdListBlocks_Click()
Dim blk As AcadBlock
Dim MyBlkArray() As Variant
Dim i As Long
i = 0
For Each blk In ThisDrawing.Blocks
i = i + 1
ReDim Preserve MyBlkArray(2, i) '2 rows by i columns
MyBlkArray(0, i) = blk.Name
MyBlkArray(1, i) = blk.Count
Next blk
Me.ListBoxBlocks.ColumnCount = 2
Me.ListBoxBlocks.ColumnWidths = "36;36" ' each 0.5" wide
Me.ListBoxBlocks.Column() = MyBlkArray
End Sub
"gizmowiebe" <nospam@address.withheld> wrote in message
news:6615005.1104008874756.JavaMail.jive@jiveforum2.autodesk.com...
Hi,
What I would like to do is to count all block(with the same name) in
the
acad modelspace. and then put those values in a listbox with 2 columns. So
It would look something like this.
Rear 3
Front 6
Bold 9
screw 10
does anyone have any sugestions.
Thx
Wiebe
|
|
|
| Back to top |
|
 |
Wade
Guest
|
Posted:
Fri Dec 31, 2004 12:59 am Post subject:
Re: Count blocks add to listbox |
|
|
OK, thanks.
Being relatively new to Autocad vba, I'm not sure how to do this (refering
to objects parent and getting parent info). Do you have an example? (always
looking to learn new stuff)
Thanks.
"Ed Jobe" <not.edljobe@hotmail.com> wrote in message
news:41d45976$1_2@newsprd01...
| Quote: | When I said, "you", I meant you as a programmer. Your code needs to
examine
each block def for nested blocks, then multiply by the parent's count.
--
----
Ed
----
"Wade" <wnederveld@preinnewhofdonotreply.com> wrote in message
news:41d45559$1_3@newsprd01...
Ed,
Thanks for you input.
I think (just my opinion) it would be easier on the user if the program
would count the nested blocks inside each block. What if the user
didn't
know how many blocks were in block "A" (like a new employee or if you
received a drawing from someone outside the company). What if your
drawing
consisted of blocks A-Z, and blocks 1-99 each of which had anywhere from
0
to 2 or 3 nested blocks (and maybe a couple had blocks that were nested
3
or
4 levels deep - i.e. a faucet block inside a sink block inside a
building
block) - of course a drawing this complicated is very unlikely. What
you
suggest would work, it just might be harder if the drawing were very
complicated or the user was unfamilar with the blocks in the drawing.
"Ed Jobe" <not.edljobe@hotmail.com> wrote in message
news:41d43635$1_1@newsprd01...
Do you need to physically count nested blocks? Shouldn't it just be a
multiple of how many times its inserted? e.g. if block A contains 2 of
block
B and block A is inserted 30 times, then there will be 60 of block B.
--
----
Ed
----
"Wade" <wnederveld@preinnewhofdonotreply.com> wrote in message
news:41d434fb_3@newsprd01...
Unfortuately, no, at least not yet.
Does anyone else know how?
"gizmowiebe" <nospam@address.withheld> wrote in message
news:20768832.1104413940191.JavaMail.jive@jiveforum1.autodesk.com...
Thx Wade,
That codes works, but do you know how I can change it to add
blocks
nested
in another block
|
|
|
| Back to top |
|
 |
Wade
Guest
|
Posted:
Fri Dec 31, 2004 1:00 am Post subject:
Re: Count blocks add to listbox |
|
|
I think one example is under the post "Re: Count block add to listbox
(Better)", and I'm sure there are even better ways to accomplish this.
"Ed Jobe" <not.edljobe@hotmail.com> wrote in message
news:41d45b26$1_1@newsprd01...
| Quote: | BTW, I didn't examine Wade's code closely...until now. It uses the Block's
Count prop. This does not return the number of times the block was
inserted,
but the Count of Items in the block. To get the number of insertions, you
have to iterate MS and/or PS looking for AcadBlockRef objects or use a
filtered selection set. There's lots of examples on this ng of how to do
that.
--
----
Ed
----
"Wade" <wnederveld@preinnewhofdonotreply.com> wrote in message
news:41d00867$1_2@newsprd01...
Here is something that will at least get you started. This assumes you
have
a Form with a Command Button (named cmdListBlocks) and a List Box (named
ListBoxBlocks). To be more useful, you'll have to set up some filters.
Private Sub cmdListBlocks_Click()
Dim blk As AcadBlock
Dim MyBlkArray() As Variant
Dim i As Long
i = 0
For Each blk In ThisDrawing.Blocks
i = i + 1
ReDim Preserve MyBlkArray(2, i) '2 rows by i columns
MyBlkArray(0, i) = blk.Name
MyBlkArray(1, i) = blk.Count
Next blk
Me.ListBoxBlocks.ColumnCount = 2
Me.ListBoxBlocks.ColumnWidths = "36;36" ' each 0.5" wide
Me.ListBoxBlocks.Column() = MyBlkArray
End Sub
"gizmowiebe" <nospam@address.withheld> wrote in message
news:6615005.1104008874756.JavaMail.jive@jiveforum2.autodesk.com...
Hi,
What I would like to do is to count all block(with the same name) in
the
acad modelspace. and then put those values in a listbox with 2 columns.
So
It would look something like this.
Rear 3
Front 6
Bold 9
screw 10
does anyone have any sugestions.
Thx
Wiebe
|
|
|
| Back to top |
|
 |
Ed Jobe
Guest
|
Posted:
Fri Dec 31, 2004 1:40 am Post subject:
Re: Count blocks add to listbox |
|
|
I just did search in this ng for "count block" and got all kinds of samples.
Looking at the names of the posters, I'm sure you'll find something useful
right away.
--
----
Ed
----
"Wade" <wnederveld@preinnewhofdonotreply.com> wrote in message
news:41d45dbf$1_3@newsprd01...
| Quote: | OK, thanks.
Being relatively new to Autocad vba, I'm not sure how to do this (refering
to objects parent and getting parent info). Do you have an example?
(always
looking to learn new stuff)
Thanks.
"Ed Jobe" <not.edljobe@hotmail.com> wrote in message
news:41d45976$1_2@newsprd01...
When I said, "you", I meant you as a programmer. Your code needs to
examine
each block def for nested blocks, then multiply by the parent's count.
--
----
Ed
----
"Wade" <wnederveld@preinnewhofdonotreply.com> wrote in message
news:41d45559$1_3@newsprd01...
Ed,
Thanks for you input.
I think (just my opinion) it would be easier on the user if the
program
would count the nested blocks inside each block. What if the user
didn't
know how many blocks were in block "A" (like a new employee or if you
received a drawing from someone outside the company). What if your
drawing
consisted of blocks A-Z, and blocks 1-99 each of which had anywhere
from
0
to 2 or 3 nested blocks (and maybe a couple had blocks that were
nested
3
or
4 levels deep - i.e. a faucet block inside a sink block inside a
building
block) - of course a drawing this complicated is very unlikely. What
you
suggest would work, it just might be harder if the drawing were very
complicated or the user was unfamilar with the blocks in the drawing.
"Ed Jobe" <not.edljobe@hotmail.com> wrote in message
news:41d43635$1_1@newsprd01...
Do you need to physically count nested blocks? Shouldn't it just be
a
multiple of how many times its inserted? e.g. if block A contains 2
of
block
B and block A is inserted 30 times, then there will be 60 of block
B.
--
----
Ed
----
"Wade" <wnederveld@preinnewhofdonotreply.com> wrote in message
news:41d434fb_3@newsprd01...
Unfortuately, no, at least not yet.
Does anyone else know how?
"gizmowiebe" <nospam@address.withheld> wrote in message
news:20768832.1104413940191.JavaMail.jive@jiveforum1.autodesk.com...
Thx Wade,
That codes works, but do you know how I can change it to add
blocks
nested
in another block
|
|
|
| Back to top |
|
 |
Wade
Guest
|
Posted:
Fri Dec 31, 2004 2:06 am Post subject:
Re: Count blocks add to listbox |
|
|
Must be my ng search isn't working, because the only "hits" I receive is
this thread. It doesn't matter if I set either of the "Received before" or
"Recieved after" dates or leave them blank (uncheck), if I put the "count
block" in the Subject Field or the Message Field or both, I still only get
this thread I even changed the "Look in" field to
"discussion.autodesk.com". I'll try googles search....
Thanks anyway.
"Ed Jobe" <not.edljobe@hotmail.com> wrote in message
news:41d467c8$1_3@newsprd01...
| Quote: | I just did search in this ng for "count block" and got all kinds of
samples.
Looking at the names of the posters, I'm sure you'll find something useful
right away.
--
----
Ed
----
"Wade" <wnederveld@preinnewhofdonotreply.com> wrote in message
news:41d45dbf$1_3@newsprd01...
OK, thanks.
Being relatively new to Autocad vba, I'm not sure how to do this
(refering
to objects parent and getting parent info). Do you have an example?
(always
looking to learn new stuff)
Thanks.
"Ed Jobe" <not.edljobe@hotmail.com> wrote in message
news:41d45976$1_2@newsprd01...
When I said, "you", I meant you as a programmer. Your code needs to
examine
each block def for nested blocks, then multiply by the parent's count.
--
----
Ed
----
"Wade" <wnederveld@preinnewhofdonotreply.com> wrote in message
news:41d45559$1_3@newsprd01...
Ed,
Thanks for you input.
I think (just my opinion) it would be easier on the user if the
program
would count the nested blocks inside each block. What if the user
didn't
know how many blocks were in block "A" (like a new employee or if
you
received a drawing from someone outside the company). What if your
drawing
consisted of blocks A-Z, and blocks 1-99 each of which had anywhere
from
0
to 2 or 3 nested blocks (and maybe a couple had blocks that were
nested
3
or
4 levels deep - i.e. a faucet block inside a sink block inside a
building
block) - of course a drawing this complicated is very unlikely.
What
you
suggest would work, it just might be harder if the drawing were very
complicated or the user was unfamilar with the blocks in the
drawing.
"Ed Jobe" <not.edljobe@hotmail.com> wrote in message
news:41d43635$1_1@newsprd01...
Do you need to physically count nested blocks? Shouldn't it just
be
a
multiple of how many times its inserted? e.g. if block A contains
2
of
block
B and block A is inserted 30 times, then there will be 60 of block
B.
--
----
Ed
----
"Wade" <wnederveld@preinnewhofdonotreply.com> wrote in message
news:41d434fb_3@newsprd01...
Unfortuately, no, at least not yet.
Does anyone else know how?
"gizmowiebe" <nospam@address.withheld> wrote in message
news:20768832.1104413940191.JavaMail.jive@jiveforum1.autodesk.com...
Thx Wade,
That codes works, but do you know how I can change it to add
blocks
nested
in another block
|
|
|
| Back to top |
|
 |
|
|
|
|