Selection Set Filter

Selection Set Filter

Anonymous
Not applicable
3,568 Views
74 Replies
Message 1 of 75

Selection Set Filter

Anonymous
Not applicable
I am trying to collect all the dimensions in my -refedit session...

My code follows...

---snip---

Dim ssetObj As AcadSelectionSet

ssetObj = objAcad.SelectionSets.Add("SS1")

ssetObj.Select(AcSelect.acSelectionSetA ll, , , "0", "DIMROTATED")

Dim S1 As AcadDimRotated

For Each S1 In ssetObj
MsgBox(S1)
Next S1

---snip---

It seems pretty simple...can anyone see what's going wrong or maybe have a better way?

All cards and letters appreciated!


I solved my earlier REFEDIT open and closing issues by using the following code (in case anyone can use it)...

objAcad.ActiveDocument.SendCommand("(setq EN1 (entlast)) ")

objAcad.ActiveDocument.SendCommand("(command ""-refedit"" & ""(cadr EN1)"" & vbCr & ""ok"" & vbCr & ""a"" & vbCr & vbCr) ")

DimStyleAdjust() '<-- THIS IS THE SUB WHERE I NEED TO PUT MY DIMENSION SELECTION SET STUFF

objAcad.ActiveDocument.SendCommand("(command ""refclose"" ""S"") ")


ROCK ON...TALK 'ATCHA LATER...keep those cards and letters coming!
0 Likes
3,569 Views
74 Replies
Replies (74)
Message 2 of 75

Anonymous
Not applicable
(So no one is confused, this is VB.NET code, and the Set statements are not needed).

Consult the the VBA/Active Developer's help for how to building the arguments needed to get a filtered selection.

You don't pass the entity type as a string to Select. You have to construct two arrays (one holding the DXF codes and the other holding the values) and pass that to Select().

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009
http://www.acadxtabs.com

wrote in message news:5895846@discussion.autodesk.com...
I am trying to collect all the dimensions in my -refedit session...

My code follows...

---snip---

Dim ssetObj As AcadSelectionSet

ssetObj = objAcad.SelectionSets.Add("SS1")

ssetObj.Select(AcSelect.acSelectionSetA ll, , , "0", "DIMROTATED")

Dim S1 As AcadDimRotated

For Each S1 In ssetObj
MsgBox(S1)
Next S1

---snip---

It seems pretty simple...can anyone see what's going wrong or maybe have a better way?

All cards and letters appreciated!


I solved my earlier REFEDIT open and closing issues by using the following code (in case anyone can use it)...

objAcad.ActiveDocument.SendCommand("(setq EN1 (entlast)) ")

objAcad.ActiveDocument.SendCommand("(command ""-refedit"" & ""(cadr EN1)"" & vbCr & ""ok"" & vbCr & ""a"" & vbCr & vbCr) ")

DimStyleAdjust() '<-- THIS IS THE SUB WHERE I NEED TO PUT MY DIMENSION SELECTION SET STUFF

objAcad.ActiveDocument.SendCommand("(command ""refclose"" ""S"") ")


ROCK ON...TALK 'ATCHA LATER...keep those cards and letters coming!
0 Likes
Message 3 of 75

Anonymous
Not applicable
first, you tell the OP to post to the vba group. then, you don't answer
their question telling them to look somewhere else. unfortunately, there's a
bit more to it. here is an example in vba to do what the OP wanted. if you
need it ported to vb.net let me know.

Public Sub Test()
Dim GroupCode(0) As Integer
Dim DataValue(0) As Variant
Dim oSS As AcadSelectionSet
Dim oEntity As AcadEntity
Dim oDimRotated As AcadDimRotated

On Error Resume Next
'delete any previously existing selection set
ThisDrawing.SelectionSets("SS1").Delete
'create the desired selection set
Set oSS = ThisDrawing.SelectionSets.Add("SS1")

'define the parameters for selecting objects
GroupCode(0) = 0
DataValue(0) = "DIMENSION"
'populate the selections set
ThisDrawing.SelectionSets("SS1").Select acSelectionSetAll, , , GroupCode,
DataValue

For Each oEntity In oSS
If TypeOf oEntity Is AcadDimRotated Then
Set oDimRotated = oEntity
MsgBox oDimRotated.Measurement
End If
Next oEntity
End Sub


"Tony Tanzillo" wrote in message
news:5895925@discussion.autodesk.com...
(So no one is confused, this is VB.NET code, and the Set statements are not
needed).

Consult the the VBA/Active Developer's help for how to building the
arguments needed to get a filtered selection.

You don't pass the entity type as a string to Select. You have to construct
two arrays (one holding the DXF codes and the other holding the values) and
pass that to Select().

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009
http://www.acadxtabs.com

wrote in message news:5895846@discussion.autodesk.com...
I am trying to collect all the dimensions in my -refedit session...

My code follows...

---snip---

Dim ssetObj As AcadSelectionSet

ssetObj = objAcad.SelectionSets.Add("SS1")

ssetObj.Select(AcSelect.acSelectionSetA ll, , , "0", "DIMROTATED")

Dim S1 As AcadDimRotated

For Each S1 In ssetObj
MsgBox(S1)
Next S1

---snip---

It seems pretty simple...can anyone see what's going wrong or maybe have a
better way?

All cards and letters appreciated!


I solved my earlier REFEDIT open and closing issues by using the following
code (in case anyone can use it)...

objAcad.ActiveDocument.SendCommand("(setq EN1 (entlast)) ")

objAcad.ActiveDocument.SendCommand("(command ""-refedit"" & ""(cadr EN1)"" &
vbCr & ""ok"" & vbCr & ""a"" & vbCr & vbCr) ")

DimStyleAdjust() '<-- THIS IS THE SUB WHERE I NEED TO PUT MY DIMENSION
SELECTION SET STUFF

objAcad.ActiveDocument.SendCommand("(command ""refclose"" ""S"") ")


ROCK ON...TALK 'ATCHA LATER...keep those cards and letters coming!
0 Likes
Message 4 of 75

Anonymous
Not applicable
"Steve" wrote

>> first, you tell the OP to post to the vba group. then, you don't answer
>> their question telling them to look somewhere else.

There's plenty of people here that can offer help, and being too lazy to read the docs to find what you need is something I don't execuse. It's all right there in the docs. And there's plenty of helpful folks here that can point the OP to existing posts or a search term that will find what he needs.

You can try as much as you want to make others look bad, but if you think what truly motivates you isn't plainly obvious, think again.


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009
http://www.acadxtabs.com
0 Likes
Message 5 of 75

Anonymous
Not applicable
Huh? what the hell is your problem?

The guy posts in the .NET group, you tell him to go post in the vba group.
he posts in the vba group and you tell him to go look at the documentation.
what the hell kinda help is that? i think he probably had a good idea that
was an option all along.

i posted an answer while you posted your opinion.

as far as who is looking bad, right about now, i'd say you are more than one
up on me in that category.

i had no intention of trying to make you look bad [you're doing a damn good
job of that on your own].



"Tony Tanzillo" wrote in message
news:5898660@discussion.autodesk.com...
"Steve" wrote

>> first, you tell the OP to post to the vba group. then, you don't answer
>> their question telling them to look somewhere else.

There's plenty of people here that can offer help, and being too lazy to
read the docs to find what you need is something I don't execuse. It's all
right there in the docs. And there's plenty of helpful folks here that can
point the OP to existing posts or a search term that will find what he
needs.

You can try as much as you want to make others look bad, but if you think
what truly motivates you isn't plainly obvious, think again.


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009
http://www.acadxtabs.com
0 Likes
Message 6 of 75

Anonymous
Not applicable
>>what the hell kinda help is that
Good help? He was first directed to the proper group and then to where he could immediately find a sample to learn
from instead of waiting for you to post the same code that has been posted here ad nauseum... He was even told
what was wrong with his code!

Advice on learning to use the help menu is not an opinion - it's invaluable!

"Steve" wrote in message news:5898725@discussion.autodesk.com...
Huh? what the hell is your problem?

The guy posts in the .NET group, you tell him to go post in the vba group.
he posts in the vba group and you tell him to go look at the documentation.
what the hell kinda help is that? i think he probably had a good idea that
was an option all along.

i posted an answer while you posted your opinion.

as far as who is looking bad, right about now, i'd say you are more than one
up on me in that category.

i had no intention of trying to make you look bad [you're doing a damn good
job of that on your own].



"Tony Tanzillo" wrote in message
news:5898660@discussion.autodesk.com...
"Steve" wrote

>> first, you tell the OP to post to the vba group. then, you don't answer
>> their question telling them to look somewhere else.

There's plenty of people here that can offer help, and being too lazy to
read the docs to find what you need is something I don't execuse. It's all
right there in the docs. And there's plenty of helpful folks here that can
point the OP to existing posts or a search term that will find what he
needs.

You can try as much as you want to make others look bad, but if you think
what truly motivates you isn't plainly obvious, think again.


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009
http://www.acadxtabs.com
0 Likes
Message 7 of 75

Anonymous
Not applicable
>> i posted an answer while you posted your opinion.

You handed him a fish.

I told him where to find, and how to catch fish.

Posting answers showing basic/common tasks that have already been shown in posts here hundreds of times over and easily available via a search; pointing him to answers that are already clearly illustrated in the docs, is helping him learn how to find answers himself, rather than catering to someone's childish sense of self-importance.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009
http://www.acadxtabs.com
0 Likes
Message 8 of 75

Anonymous
Not applicable
you have your way, i have mind. guess that's why i have never gotten
anything from what you seem to post.



"Tony Tanzillo" wrote in message
news:5899061@discussion.autodesk.com...
>> i posted an answer while you posted your opinion.

You handed him a fish.

I told him where to find, and how to catch fish.

Posting answers showing basic/common tasks that have already been shown in
posts here hundreds of times over and easily available via a search;
pointing him to answers that are already clearly illustrated in the docs, is
helping him learn how to find answers himself, rather than catering to
someone's childish sense of self-importance.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009
http://www.acadxtabs.com
0 Likes
Message 9 of 75

Anonymous
Not applicable
>>you have your way, i have mind. guess that's why i have never gotten
anything from what you seem to post. <<

That's only because most of it is over your head.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009
http://www.acadxtabs.com
0 Likes
Message 10 of 75

Anonymous
Not applicable
why do you seem to begrudge everything anyone else does as if "well, it's
not my idea therefore it wrong". others have their way of doing things that
i guarantee does not fit into your little world. just because i show someone
how to fish does not guarantee they'll be able to catch any fish. i may have
to keep showing them and showing them until one day they get it; hopefully.
it's the same way with people trying to program maybe for the first time. or
it's not something they do on a regular basis.

i see these forums as an extension to a classroom setting. so let me ask
you, if you had paid good money to attend a class and you ask the instructor
a question; he told you nothing about the answer instead he just says to
look in the manual. would you find that an acceptable teaching method? i
think i would promptly ask for a refund quite frankly. the whole point of
going to the class, in person, is to get specific help on a particular
subject from someone who is suppose to know something about the subject.

that's the way i think most people view these newsgroups; as a means of
getting specific help to a particular problem. while it may be true they
have not even looked at the help docs the first time, i don't know that and
it's not my place to judge.

i have freely choosen to participate in the newsgroup by providing whatever
help i can short of writing the entire application for them. if i don't have
any help to offer then i refrain from the thread. i think that anyone could
go to any newsgroup and respond with "go look at the help documentation". if
that's all they get then why bother going to a newsgroup in the first place?

attempting to belittle me only solidifies your insecurities not only as a
programmer but as a teacher of the subject you claim to know. it's obvious
that good communication skills should not ever appear on your resume.

i posted a viable answer and the only thing you have posted is hatred toward
my posting.

if there is something wrong with the code i posted then please let all of us
know what it is. I can take it but your pansy tirades don't bother me.
otherwise, do us all a favor and shut the hell up!




"Tony Tanzillo" wrote in message
news:5899199@discussion.autodesk.com...
>>you have your way, i have mind. guess that's why i have never gotten
anything from what you seem to post. <<

That's only because most of it is over your head.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009
http://www.acadxtabs.com
0 Likes
Message 11 of 75

jbooth
Advocate
Advocate
"if you had paid good money to attend a class and you ask the instructor a question; he told you nothing about the answer instead he just says to look in the manual. would you find that an acceptable teaching method?"


Unfortunately, this is exactly how students are treated in university level courses. If you can't do the research on your own, you don't deserve the degree you are working for.

Or at least, that's "their" opinion on it...

I'm not choosing sides here, but I feel I need to address the sample you posted. The original poster is trying to modify a specific block table (noted by the use of REFEDIT), and your sample code will select objects in the active drawing's modelspace blocktable only.

I don't really know if a specific blocktable can be specified when using the AcadSelectionset object. I think it defaults to modelspace, meaning it has no use to modify block definitions.

Someone feel free to correct me if I'm wrong though. 😉
0 Likes
Message 12 of 75

Anonymous
Not applicable
You seem to be stuck on your own failure to see the obvious, which is that there is plenty of learning material already here, available to anyone that needs it.

However, in spite of that you chose to chastise me for encouraging someone to take matters into their own hands and find it, and in the process also learn how to find what they need when they need it, and without having to ask questions that have been asked and answered many, many times over, or wait for someone like you to answer one of them, yet one more time.


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009
http://www.acadxtabs.com
0 Likes
Message 13 of 75

Anonymous
Not applicable
the answer is not in the help files. of course you'd figured that out if you
had actually looked instead of attempting to minimize me.

i seriously doubt the user would have figured it out without actual help
from another user. we know you sure didn't figured it out. it's so simple
but you're trying your best to turn it into rocket science.

as far as other posts are concerned, big deal. you have wasted 10 times more
time trying to degrade me than i spent writing that bit of code from
scratch. i write code from memory faster than you can look it up.

i am stuck however. stuck on why you insist on badgering users on this
newsgroup when they disagree with your particular point of view. there was
nothing wrong with your answer. it was, in my humble opinion, not good
enough.





"Tony Tanzillo" wrote in message
news:5899825@discussion.autodesk.com...
You seem to be stuck on your own failure to see the obvious, which is that
there is plenty of learning material already here, available to anyone that
needs it.

However, in spite of that you chose to chastise me for encouraging someone
to take matters into their own hands and find it, and in the process also
learn how to find what they need when they need it, and without having to
ask questions that have been asked and answered many, many times over, or
wait for someone like you to answer one of them, yet one more time.


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009
http://www.acadxtabs.com
0 Likes
Message 14 of 75

Anonymous
Not applicable
>>the answer is not in the help files
Here is the help section on Filtered Selection Sets. If you look
in the code sample section - there are 3 full samples using filters.

[code]
Use Filter Lists to Define Selection Set Rules


Filter lists are composed of pairs of arguments. The first argument identifies the type of filter (for example, an object), and the second argument specifies the value you are filtering on (for example, circles). The filter type is a DXF group code that specifies which filter to use. A few of the most common filter types are listed here.

DXF codes for common filters

DXF code
Filter type

0
Object Type (String)

Such as “Line,” “Circle,” “Arc,” and so forth.

2
Object Name (String)

The table (given) name of a named object.

8
Layer Name (String)

Such as “Layer 0.”

60
Object Visibility (Integer)

Use 0 = visible, 1 = invisible.

62
Color Number (Integer)

Numeric index values ranging from 0 to 256.

Zero indicates BYBLOCK. 256 indicates BYLAYER. A negative value indicates that the layer is turned off.

67
Model/paper space indicator (Integer)

Use 0 or omitted = model space, 1 = paper space.


For a complete list of DXF group codes, see Group Code Value Types in the DXF Reference.

The filter arguments are declared as arrays. The filter type is declared as an integer and the filter value as a variant. Each filter type must be paired with a filter value. For example:

FilterType(0) = 0 'Indicates filter refers to an object type
FilterData(0) = "Circle" 'Indicates the object type is "Circle"
Specify a single selection criterion for a selection set

The following code prompts users to select objects to be included in a selection set, but only adds the selected object if it is a circle:

Sub Ch4_FilterMtext()
Dim sstext As AcadSelectionSet
Dim FilterType(0) As Integer
Dim FilterData(0) As Variant
Set sstext = ThisDrawing.SelectionSets.Add("SS2")
FilterType(0) = 0
FilterData(0) = "Circle"
sstext.SelectOnScreen FilterType, FilterData
End Sub
[/code]
0 Likes
Message 15 of 75

Anonymous
Not applicable
"Steve" wrote

>> the answer is not in the help files. of course you'd figured that out if you
had actually looked instead of attempting to minimize me. <<

I'm not minimizing you, you're minimizing yourself.

ActiveX and VBA Developers Guide >
Create and Edit AutoCAD Entities >
Work with Selection Sets >
Define Rules for Selection Sets >
Use Filter Lists to Define Selection Set Rules


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009
http://www.acadxtabs.com


i seriously doubt the user would have figured it out without actual help
from another user. we know you sure didn't figured it out. it's so simple
but you're trying your best to turn it into rocket science.

as far as other posts are concerned, big deal. you have wasted 10 times more
time trying to degrade me than i spent writing that bit of code from
scratch. i write code from memory faster than you can look it up.

i am stuck however. stuck on why you insist on badgering users on this
newsgroup when they disagree with your particular point of view. there was
nothing wrong with your answer. it was, in my humble opinion, not good
enough.





"Tony Tanzillo" wrote in message
news:5899825@discussion.autodesk.com...
You seem to be stuck on your own failure to see the obvious, which is that
there is plenty of learning material already here, available to anyone that
needs it.

However, in spite of that you chose to chastise me for encouraging someone
to take matters into their own hands and find it, and in the process also
learn how to find what they need when they need it, and without having to
ask questions that have been asked and answered many, many times over, or
wait for someone like you to answer one of them, yet one more time.


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009
http://www.acadxtabs.com
0 Likes
Message 16 of 75

Anonymous
Not applicable
as you have pointed out, the answer that i posted is no where to be found in
the help file. i do appreciate you confirming what i said.

now go away and come back when you have something useful to say to the
group.


"Tony Tanzillo" wrote in message
news:5899986@discussion.autodesk.com...
"Steve" wrote

>> the answer is not in the help files. of course you'd figured that out if
>> you
had actually looked instead of attempting to minimize me. <<

I'm not minimizing you, you're minimizing yourself.

ActiveX and VBA Developers Guide >
Create and Edit AutoCAD Entities >
Work with Selection Sets >
Define Rules for Selection Sets >
Use Filter Lists to Define Selection Set Rules


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009
http://www.acadxtabs.com


i seriously doubt the user would have figured it out without actual help
from another user. we know you sure didn't figured it out. it's so simple
but you're trying your best to turn it into rocket science.

as far as other posts are concerned, big deal. you have wasted 10 times more
time trying to degrade me than i spent writing that bit of code from
scratch. i write code from memory faster than you can look it up.

i am stuck however. stuck on why you insist on badgering users on this
newsgroup when they disagree with your particular point of view. there was
nothing wrong with your answer. it was, in my humble opinion, not good
enough.





"Tony Tanzillo" wrote in message
news:5899825@discussion.autodesk.com...
You seem to be stuck on your own failure to see the obvious, which is that
there is plenty of learning material already here, available to anyone that
needs it.

However, in spite of that you chose to chastise me for encouraging someone
to take matters into their own hands and find it, and in the process also
learn how to find what they need when they need it, and without having to
ask questions that have been asked and answered many, many times over, or
wait for someone like you to answer one of them, yet one more time.


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009
http://www.acadxtabs.com
0 Likes
Message 17 of 75

Anonymous
Not applicable
"Steve" wrote

>> as you have pointed out, the answer that i posted is no where to be found in
the help file. i do appreciate you confirming what i said. <<

Whether or not whatever rank-amateur garbage you posted in your 'answer' is in the docs, or not, is not the point.

What the OP needed, is in the docs.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009
http://www.acadxtabs.com
0 Likes
Message 18 of 75

Anonymous
Not applicable
"Steve" wrote:

"the answer that i posted is no where to be found in
the help file"....

First it was "the answer is not in the help file"....

Now, it is "the answer that I posted [is not in the help file]...

IOW, you're too much of a coward to admit you're wrong, even when it's as plain as day. To avoid having to do that, you retreat into semantics.

More importantly, everyone here reading this can see that, and see you for what you are.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009
http://www.acadxtabs.com
0 Likes
Message 19 of 75

Anonymous
Not applicable
talk about stuck! i've moved on since there's no point in trying to reason
with a third grader.

i posted a perfectly good answer and you have done nothing but make pansy
attempts to degrade my answer. you just hate that you're baiting another
user with your half-baked answers didn't work.

you live for others to beg for your help instead of willingly offering it.
you simply can't accept that someone other than yourself can offer help on
this newsgroup. it's all about you isn't Tony?

get lost, i'm too busy helping others who appreciate it.



"Tony Tanzillo" wrote in message
news:5900769@discussion.autodesk.com...
"Steve" wrote:

"the answer that i posted is no where to be found in
the help file"....

First it was "the answer is not in the help file"....

Now, it is "the answer that I posted [is not in the help file]...

IOW, you're too much of a coward to admit you're wrong, even when it's as
plain as day. To avoid having to do that, you retreat into semantics.

More importantly, everyone here reading this can see that, and see you for
what you are.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009
http://www.acadxtabs.com
0 Likes
Message 20 of 75

Anonymous
Not applicable
no it's not ...

the OP wanted to create a filter selection set with rotated dimensions and
iterate through the selection for info specific to a rotated dimension. that
is not in the docs, period.

their attempt was to use 0 and "DIMROTATED" which will not work. you first
have to create a selection set of DIMENSIONs and then iterate through that
looking for TypeOf "DIMROTATED" and cast that object to an AcadDimRotated
object. while it is not rocket science it is not in the help documents.

now you can twist this entire conversation around and think that you're
proving something to yourself maybe, but your simply wasting your time and
my quite frankly.



"Tony Tanzillo" wrote in message
news:5900736@discussion.autodesk.com...
"Steve" wrote

>> as you have pointed out, the answer that i posted is no where to be found
>> in
the help file. i do appreciate you confirming what i said. <<

Whether or not whatever rank-amateur garbage you posted in your 'answer' is
in the docs, or not, is not the point.

What the OP needed, is in the docs.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009
http://www.acadxtabs.com
0 Likes