PropertyEditorGlobal
PropertyEditorGlobal
(OP)
I'm hoping someone here can help with me with an issue I'm having with this macro.
I have a large number of part files (~200) that I wish to add the property named "Weight" to. The value for this will be the mass calculated by SolidWorks.
The problem I'm having is that in defining the properties to add via the macro I don't know what to enter for the value of this Weight property. For instance, if I have a part open called Part1, when I choose the mass in the drop-down list it is "SW-Mass@@Default@Part1.SLDPRT". However, this is obviously specific to the filename of the part which is open, but I need the code which will update depending on the filename of the open file - I hope that all makes sense!
These parts have already been created which is why I am using this macro, the template has been corrected so any future parts will automatically include the weight.
The Propa-gator program looks as if it may be able to do what I need but my boss wouldn't pay for a program which we would only need to use once on these files then probably not need to use again. Any other macros/methods to achieve this which I am not aware of would also be good!
Thanks for any help
I have a large number of part files (~200) that I wish to add the property named "Weight" to. The value for this will be the mass calculated by SolidWorks.
The problem I'm having is that in defining the properties to add via the macro I don't know what to enter for the value of this Weight property. For instance, if I have a part open called Part1, when I choose the mass in the drop-down list it is "SW-Mass@@Default@Part1.SLDPRT". However, this is obviously specific to the filename of the part which is open, but I need the code which will update depending on the filename of the open file - I hope that all makes sense!
These parts have already been created which is why I am using this macro, the template has been corrected so any future parts will automatically include the weight.
The Propa-gator program looks as if it may be able to do what I need but my boss wouldn't pay for a program which we would only need to use once on these files then probably not need to use again. Any other macros/methods to achieve this which I am not aware of would also be good!
Thanks for any help






RE: PropertyEditorGlobal
weight = """SW-Mass@" & partno & ".SLDPRT"""
PROP = swModel.AddCustomInfo3(configuration_name, "Weight", swCustomInfoText, weight)
RE: PropertyEditorGlobal
RE: PropertyEditorGlobal
RE: PropertyEditorGlobal
"""SW-Mass@" & partno & ".SLDPRT""" is exactly what I was needing. This will save me hours going through hundreds of files and fixing them manually.
Thanks again Boilerbrad, have a star on me!
RE: PropertyEditorGlobal
RE: PropertyEditorGlobal
The only problem I have now is that the macro doesn't like speech marks and will fail when it is run. I don't know how I managed to get Boilerbrad's code to work the first time as it wouldn't work on the second attempt. I can, however, use the SolidWorks Task Scheduler instead which doesn't appear to have any problems.
As you may have guessed I'm not very up to speed on the API side of SolidWorks...
Thanks both Boilerbrad and Corblimeylimey anyway!
RE: PropertyEditorGlobal