VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Aggravating SelSet issue

7 REPLIES 7
Reply
Message 1 of 8
dragnsbld
308 Views, 7 Replies

Aggravating SelSet issue

Here's a piece of the code:
strRailLine = rstDelTbl.Fields("RailLine").Value

intCode(0) = 0
varCodeVal(0) = "TEXT"
intCode(1) = 8
varCodeVal(1) = strRailLine & " Line"
ss.Select acSelectionSetAll, , , intCode, varCodeVal

Yes everything before this is correct..... NO the code doesn't produce a SelectionSet. Yes the required objects are there.
FYI this is for 2k4 so I ca insure it's usability in the newer and older CAD system.
Any ideas why? Message was edited by: Dragnsbld
7 REPLIES 7
Message 2 of 8
Anonymous
in reply to: dragnsbld

Hi Dragnsbld,
you say everything is correct
objects are on that layer
but you don't get a sel set

that tells me that *POSSIBLY* you *think* everything is correct but *maybe*
something isn't!
:-)

in my experience (limited as it is) if everything is correct, I *will* get a
selection set....

first thing that comes to mind is, what is the data type of your field
"RailLine"?
if a char type, what is the size (number of characters)

are you sure you don't have extra "empty characters" in the return?
does Len(strRailLine) return what you'd expect?

do you maybe need a trim on that string?

Set oLyrCheck = oDoc.Layers.Item( strRailLine & " Line")
that returns a layer?

otherwise I'm at a loss, it looks like it *should* work

have you restarted acad?

sometimes repeated runs during debugging will return erroneous results

hth
mark


wrote in message news:5976150@discussion.autodesk.com...
Here's a piece of the code:
strRailLine = rstDelTbl.Fields("RailLine").Value

intCode(0) = 0
varCodeVal(0) = "TEXT"
intCode(1) = 8
varCodeVal(1) = strRailLine & " Line"
ss.Select acSelectionSetAll, , , intCode, varCodeVal

Yes everything before this is correct..... NO the code doesn't produce a
SelectionSet. Yes the required objects are there.
FYI this is for 2k4 so I ca insure it's usability in the newer and older CAD
system.
Any ideas why?

Message was edited by: Dragnsbld
Message 3 of 8
dragnsbld
in reply to: dragnsbld

Well the len does return the right number of char's.
To test this you can replace the strRailLine & " Line" with any text you want that matches one of your layers in the drawing. For some reason this does not like to return anything in the SS. I redim the 2 variables early as this is contained in a Do..Loop to get all the items I need that are on various Layers and are only text. But it still fails at the first attempt. I could understand if it failed later but not in the first attempt.

To make it worse if I remove 1 or the other I get the SS to fill with that particular filtered set. I just can't get them both at the same time and that is what I need to maintain speed. Message was edited by: Dragnsbld
Message 4 of 8
dragnsbld
in reply to: dragnsbld

Well I figured out the problem. On a whim I changed the "text" filter to "mtext" and now I am working. I missed this when I was looking at the DXF Reference/Enitities section, looking for a reason that my code was failing me.

So yes Mark this was an Id10t error. Thanks for the input it made me retrace everything and find the culprit (me).

Russ
Message 5 of 8
Anonymous
in reply to: dragnsbld

FWIW here is a quicker way to look at the DXF codes.

Paste lisp below on command line, pick an entity.
(entget(car(entsel)))

Gary
Message 6 of 8
ryan
in reply to: dragnsbld

Great tip, thanks Gary.
Message 7 of 8
Anonymous
in reply to: dragnsbld

🙂
Glad you figured it out...
it's always those times when I *know* everything is "right" but it still
don't work that get me
mark

wrote in message news:5976227@discussion.autodesk.com...
Well I figured out the problem. On a whim I changed the "text" filter to
"mtext" and now I am working. I missed this when I was looking at the DXF
Reference/Enitities section, looking for a reason that my code was failing
me.

So yes Mark this was an Id10t error. Thanks for the input it made me retrace
everything and find the culprit (me).

Russ
Message 8 of 8
Anonymous
in reply to: dragnsbld

By including a list (lisp list that is) of "application IDs" just before the
closing parenthesis you can get it to also dump the Xdata, if any.
It's usually quicker than looking up the codes in DXF help.

Standard codes only:
(entget(car(entsel)))

Standard codes + Xdata:
(entget(car(entsel)) '("appid_1" "appid_2" "etc") )

Gary

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost