Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding a value via a Macro to predetermined part properties??

Status
Not open for further replies.

btcoutermash

Industrial
Joined
Feb 2, 2004
Messages
108
Location
US
All,
In all of our part files we have our preset properties that we require users to fill out. The question I had was, using a macro how could I write in a fixed value? The example I am trying to do is, in the part file we have "Revision". So the user needs to fill in something here in the part file properties dialog box. What I wanted to do is when I creat a part run a macro customized for myself that would automatically put in values like "01" into the "Revision" property. I thoight the line below would do that, but is does't. Could anyone give me a pointer on this?

aBool = Part.AddCustomInfo3("", "Revision", 30, "01")
 
AddCustomInfo3 does not overwrite existing properties. Usually I make two calls to set a property: one to add the property if it is not there followed by one to change it if it already was there.

If you don't need a return value, you can write functions as subs by removing parentheses:
Code:
Part.AddCustomInfo3 "", "Revision", 30, "01"

[bat]Honesty may be the best policy, but insanity is a better defense.[bat]
-SolidWorks API VB programming help
 
Or first delete the property than add it.
Code:
Part.DeleteCustomInfo2 "", "Revision"
Part.AddCustomInfo3 "", "Revision", 30, "01"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top