×
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 Body2.MaterialPropertyValues2 can't unset

API Body2.MaterialPropertyValues2 can't unset

API Body2.MaterialPropertyValues2 can't unset

(OP)
I am writing a program to scrub-out all face- and body-specific colors.  Faces seem to go OK, but boides are a no-go.

I've tried everything I can think of.

If a body's color has never been set, Body2.MaterialPropertyValues2 returns "Empty".  This means the body uses the part file's properties.  Once this has been set, there is no way to set it back to empty via API. (same effect as "Remove color" by menu picks).

Body2.MaterialPropertyValues2=Empty 'does not do the trick


TIA
Tick

"Great ideas need landing gear as well as wings."--C. D. Jackson
http://www.EsoxRepublic.com

RE: API Body2.MaterialPropertyValues2 can't unset

TheTick

What do you mean by "Body2.MaterialPropertyValues2=Empty"?

Do you write the word Empty?

Regards

RE: API Body2.MaterialPropertyValues2 can't unset

(OP)
That's one of the ways I tried in my VB program (though substituting "Body2[" with the object variable name).

I've tried many things: Empty Keyword, a variant set to Empty, various other null values.  Nothing returns the body material to "same as part material".

RE: API Body2.MaterialPropertyValues2 can't unset

Have you tried "" (empty string)?

I don't know if you can set an array empty without a proper command (that is, by assigning an "empty value" to the variable).

Try:

retval = Component2.RemoveMaterialProperty2 ( config_opt, config_names)

Good Luck

RE: API Body2.MaterialPropertyValues2 can't unset

(OP)
I'll try the empty string.

I've been assigning various values such as Empty, Nothing, Null, etc. to a variant "retVar" and then calling swBody.MaterialPropertyValues2 = retVar

Also tried swBody.MaterialPropertyValues2 = (retVar)

How would one use Component2.RemoveMaterialProperty2 in a .SLDPRT?

RE: API Body2.MaterialPropertyValues2 can't unset

Not so much a programming issue, but remember there is some interesting interdependency logic between face and body color in SW.  Sometimes you think you got everything only to find someone else tweaked a face.

I was - and he did. So at least I didn't get coal.....
OK, OK, It's a reference to my holiday sig. "Be naughty - Save Santa a trip..."

RE: API Body2.MaterialPropertyValues2 can't unset

(OP)
The removal of face colors is working fine.  The program traverses all faces of each body and removes color, then works on the bodies.

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