checking selection set for similar items

checking selection set for similar items

Anonymous
Not applicable
183 Views
6 Replies
Message 1 of 7

checking selection set for similar items

Anonymous
Not applicable
Hoping some one can give me some insight into how to do this in vb. I'm a
relatively new vb programmer.

I have a selection set of mtext objects. The text string of these objects
is in the following format: (4-EACH) MAPLE TREE

I'm doing a BOM takeoff for all of these labels and what I need to do is
combine the labels of similar items together so that I have a grand total of
each item in the drawing in my output file. For clarification: I have the
following labels in my drawing (4-EACH) MAPLE TREE, (2-EACH) MAPLE TREE,
(9-EACH) MAPLE TREE. In my output file, I don't want to have three separate
lines for the maple tree I only want one: 15 Maple Trees. How can I loop
through the selection set to determine if I have more than one type of item
in the set. I'll have to do some type of string parsing to retrieve the
number and the actual item.

Thanks,

Ryan
0 Likes
184 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
Dear Ryan,

Hmm, something like;

Dim Total as Long

for each mtext in Selectionset
if mtext.text like "MAPLE TREE" then
Total=Total + Clng(mid(mtext.text,2,1)
end if
next mtext

For you to find the rough edges.

wkr, jwk
(Frank will now moan about this did-your-homework-answer polluting the ng 🙂


Ryan Small had the next bright idea:

>Hoping some one can give me some insight into how to do this in vb. I'm a
>relatively new vb programmer.
>
>I have a selection set of mtext objects. The text string of these objects
>is in the following format: (4-EACH) MAPLE TREE
>
>I'm doing a BOM takeoff for all of these labels and what I need to do is
>combine the labels of similar items together so that I have a grand total of
>each item in the drawing in my output file. For clarification: I have the
>following labels in my drawing (4-EACH) MAPLE TREE, (2-EACH) MAPLE TREE,
>(9-EACH) MAPLE TREE. In my output file, I don't want to have three separate
>lines for the maple tree I only want one: 15 Maple Trees. How can I loop
>through the selection set to determine if I have more than one type of item
>in the set. I'll have to do some type of string parsing to retrieve the
>number and the actual item.
>
> Thanks,
>
> Ryan
>
>

--
You ask a silly question, you get a technical answer...
0 Likes
Message 3 of 7

Anonymous
Not applicable
The like operator,,,,, wow!,,,,, I see you did your homework 🙂 Definitely not
criticizing, I had to look it up, but shouldn't it be "* MAPLE TREE" and what
happens if there are (10 each)? Oh, never mind, LEN is a rough edge 🙂
-Josh

jwk wrote:

> Dear Ryan,
>
> Hmm, something like;
>
> Dim Total as Long
>
> for each mtext in Selectionset
> if mtext.text like "MAPLE TREE" then
> Total=Total + Clng(mid(mtext.text,2,1)
> end if
> next mtext
>
> For you to find the rough edges.
>
> wkr, jwk
> (Frank will now moan about this did-your-homework-answer polluting the ng 🙂
>
>
> Ryan Small had the next bright idea:
>
> >Hoping some one can give me some insight into how to do this in vb. I'm a
> >relatively new vb programmer.
> >
> >I have a selection set of mtext objects. The text string of these objects
> >is in the following format: (4-EACH) MAPLE TREE
> >
> >I'm doing a BOM takeoff for all of these labels and what I need to do is
> >combine the labels of similar items together so that I have a grand total of
> >each item in the drawing in my output file. For clarification: I have the
> >following labels in my drawing (4-EACH) MAPLE TREE, (2-EACH) MAPLE TREE,
> >(9-EACH) MAPLE TREE. In my output file, I don't want to have three separate
> >lines for the maple tree I only want one: 15 Maple Trees. How can I loop
> >through the selection set to determine if I have more than one type of item
> >in the set. I'll have to do some type of string parsing to retrieve the
> >number and the actual item.
> >
> > Thanks,
> >
> > Ryan
> >
> >
>
> --
> You ask a silly question, you get a technical answer...
0 Likes
Message 4 of 7

Anonymous
Not applicable
There's only one word for this, and that's "blurk".... that's the sound my
mind makes when i see a question like this. Roughly translated; "hmmm that
shouldn't be that hard to solve. If i had to code this, i would do SOMETHING
like this." I'm only posting this
blurk also in a follow up in the hope that bringing confusion will stimulate
the questionmaker in more intensive thinking which will bring him (or her)
closer to the blessing of solving the problem... And of course for you to
respond 🙂

wkr, jwk

Minkwitz Design had the next bright idea:

>The like operator,,,,, wow!,,,,, I see you did your homework 🙂 Definitely
>not criticizing, I had to look it up, but shouldn't it be "* MAPLE TREE"
>and what happens if there are (10 each)? Oh, never mind, LEN is a rough
>edge 🙂 -Josh
>
>jwk wrote:
>
>> Dear Ryan,
>>
>> Hmm, something like;
>>
>> Dim Total as Long
>>
>> for each mtext in Selectionset
>> if mtext.text like "MAPLE TREE" then
>> Total=Total + Clng(mid(mtext.text,2,1)
>> end if
>> next mtext
>>
>> For you to find the rough edges.
>>
>> wkr, jwk
>> (Frank will now moan about this did-your-homework-answer polluting the
>> ng 🙂

--
You ask a silly question, you get a technical answer...
0 Likes
Message 5 of 7

Anonymous
Not applicable
I had a look through a pile of papers that contains the vb statements and
functions and never saw anything about the LIKE operator. Following your
reply, I went back through this paper collection to see if I had missed it
when I checked the first time, but it wasn't there. I then attempted some
type of string parsing but realized there had to be a better way via a
function similar to (vl-string-search) in lisp.

Ryan

"jwk" wrote in message
news:Xns9050BB8E4aoposhotmailcom@64.124.46.110...
> There's only one word for this, and that's "blurk".... that's the sound my
> mind makes when i see a question like this. Roughly translated; "hmmm that
> shouldn't be that hard to solve. If i had to code this, i would do
SOMETHING
> like this." I'm only posting
this
> blurk also in a follow up in the hope that bringing confusion will
stimulate
> the questionmaker in more intensive thinking which will bring him (or her)
> closer to the blessing of solving the problem... And of course for you to
> respond 🙂
0 Likes
Message 6 of 7

Anonymous
Not applicable
Dear Ryan,

I was stunned when i read your reply because i use the Like operator almost
daily! And still i started up Acad VBA IDE to check if i wasn't going
insane. Choosing help, typing Like in the index, and there it was. So, i
think there's maybe one sheet missing in your pile of paper 🙂 Just try
it. And as some "designer":-) correctly stated, you have to use a wildcard.
Try:

msgbox "a t in theepot is " & ("theepot" like "t*")

wkr, jwk

Ryan Small had the next bright idea:

> I had a look through a pile of papers that contains the vb statements
> and
>functions and never saw anything about the LIKE operator. Following your
>reply, I went back through this paper collection to see if I had missed it
>when I checked the first time, but it wasn't there. I then attempted some
>type of string parsing but realized there had to be a better way via a
>function similar to (vl-string-search) in lisp.
>
> Ryan
--
You ask a silly question, you get a technical answer...
0 Likes
Message 7 of 7

Anonymous
Not applicable
Checked the page numbers, all there! Time for some new documentation.

Ryan

"jwk" wrote in message
news:Xns9051D7D42aoposhotmailcom@64.124.46.110...
> Dear Ryan,
> So, i think there's maybe one sheet missing in your pile of paper 🙂 Just
try
> it.
0 Likes