×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

API Rumination

API Rumination

API Rumination

(OP)
Folks,

Somewhat of a philosophical question.

Since Custom Property names are case sensitive regarding capture via VB &
VBA does anyone have a nice clean way of "looking past" the case of a
property to grab the value regardless of how it was defined originally
(example: Cost, cost, COST,etc). var1 =
ModelDoc.GetCustomInfoValue(ConfigName, "COST") would miss the prop Cost.

I have a method I use but feel its somewhat clunky (read slow). The
philosophical part of this is that if one used a software tool to define the
custom props at part creation they would all be uniform case and the problem
is solved, but alas we all know there are always exceptions!

Thoughts.... ruminations?

Guy Edkins
Managing Partner
Delta Group Ltd

gedkins@deltagl.com
www.deltagl.com

RE: API Rumination

Just one more data validation problem.  Seems like most of the effort in programming goes to validation and error control, not to the actual process.

I may make you feel, but I can't make you think.

RE: API Rumination

well, the props are case insensitive, but only to a degree.
You can have a "material" property, OR a "MaTeRiAl" property, but NOT a "material" AND a "MaTeRiAl" property.

So this is no different than any other text validation:
force the case of the text on both the needed, and the stored property, and see if they are an exact match.

RE: API Rumination

(OP)
Hmmmmm, Am I missing something. In the following call the two fields (description are different)? i.e. the call would miss getting the value if it were description (all lower case) I must have taken a stupid pill this morning as I am sure that the answer is simple.

var1 = ModelDoc.GetCustomInfoValue(ConfigName, "DESCRIPTION")
var1 = ModelDoc.GetCustomInfoValue(ConfigName, "Description")

Guy Edkins
Managing Partner
Delta Group Ltd

gedkins@deltagl.com
www.deltagl.com

RE: API Rumination

I tried, and was unable to make 2 props with the same letters but different capitalizations.

I entered a value for "Description", and clicked the "Modify" button to save it.

I then Started typing "DESC", clicked the mouse on the value box, entered a value, and watched the "Modify" button change to an "ADD" button. I then tried tricking it, and mouse-clicked back on the "Name" field, and finished typing in "ription" .. by the time i hit the "n", I watched the "ADD" button change to a "Modify" button.

RE: API Rumination

(OP)
Yes its an interesting problem, when you attampt to create props in SW it won't let you have as you say two props of the same name with different case. But the API call sees the (or doesn't see) Description as different from DESCRIPTION which is the pain.

Guy Edkins
Managing Partner
Delta Group Ltd

gedkins@deltagl.com
www.deltagl.com

RE: API Rumination

Look up the following keywords in VB help:

StrConv
LCase
UCase

You could probably write a subroutine to compare string values (i.e. chack to see if values of two stringsare the same when both are forced lowercase)

I may make you feel, but I can't make you think.

RE: API Rumination

gedkins,

To further expand on TheTick's idea, you could write a routine that loads all of the custom properties and their values into an array, then deletes all the custom properties from the document and finally resaves the custom properties but using the LCase, UCase, etc functions to modify their names to whatever designation you desire.

Regg

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources