Ethan Kinney

SelectByID2 woes....

Discussion created by Ethan Kinney on May 24, 2019
Latest reply on May 28, 2019 by Ethan Kinney

Ok, so if you read the SelectByID2 doc:

 

http://help.solidworks.com/2018/english/api/sldworksapi/solidworks.interop.sldworks~solidworks.interop.sldworks.imodeldocextension~selectbyid2.html

 

It has this line under remarks:

If a string is passed that matches an object name but whose case does not match exactly, then this method could return false. For selection of dimensions, the Name parameter must be fully qualified.

Notice the word "could" in that statement.

Never paid much attention to that line till today...

 

I just switched to a new laptop and loaded up a custom vb.net program to run with Solidworks. On my old machine, worked just fine. However on this new machine, it would not select the specified feature. Everything was identical code wise from the old machine to the new one. Turns out, I had never passed the feature name through with the correct case.

 

String passed: "Flange1@RST_PILLOWBLOCK-1@RST_PillowBlock"

Correct String: "Flange1@RST_PILLOWBLOCK-1@RST_PILLOWBLOCK"

Notice the subtle difference?

 

My question is, why was the api able to take the wrong case for the feature name on my old machine, and process it just fine, but could not do the same for the new one? I understand that I should have had it correct in the first place. But for sanity sake I just want to know why.

 

Previous machine: Dell M4800

Current machine: HP ZBook G5

 

Both are running SW2018 sp3.0

 

I would expect that if i pull the same lever, the same thing should happen every time: https://xkcd.com/242/

 

Any thoughts?

Any way to set a parameter to ignore case?

Outcomes