×
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

Custom Properties API -"AddCustomInfo3"

Custom Properties API -"AddCustomInfo3"

Custom Properties API -"AddCustomInfo3"

(OP)
I am trying to modify an API that adds custom property data to
parts. I use :-

   For m = 0 To 3
    retval = Part.AddCustomInfo3("", MyProp(0, m), 30, MyProp(1, m))
  
Next m

Which works if the custom property did not previously exist. What do I have to do overwrite an existing value?

RE: Custom Properties API -"AddCustomInfo3"

Get the existing properties:

strNumber = Part.CustomInfo2("", "Number")

throw this into a form field if you like. Then delete the old property:

retval = Part.DeleteCustomInfo2("", "Number")

The create the property again:

retval = Part.AddCustomInfo3("", "Number", swCustomInfoText, txt_number.Text)

Jason

RE: Custom Properties API -"AddCustomInfo3"

You are correct in the observation that AddCustomInfo3 does not overwrite custom properties.

Usually what I do is write a subroutine to first check for the property, then add or change (using "ModelDoc2::CustomInfo2") as needed.  It's also OK to double-up, add first and and then overwrite.

I could be the world's greatest underachiever, if I could just learn to apply myself.
http://www.EsoxRepublic.com-SolidWorks API VB programming help

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