Hi,
I have been trying to write a macro to update custom properties but am stuck because I have some properties that only exist at the Custom level and not in configurations. When using the AddCustomInfo3 method I see it is possible to specify the destination configuration but in this case I'm not sure what that is or if it even exists.
If I leave it blank i.e.
Value = swModel.AddCustomInfo3 ("", "Description", swCustomInfoText, "")
the macro populates all configs tabs and the custom tab.
Is there a config name for the top level custom properties?
Thanks
SolidworksApi macros
Have you tried just Add3?
2015 SOLIDWORKS API Help - Add3 Method (ICustomPropertyManager)
I would recommend using the CustomPropertyManager(string cfg) object and then use it to edit information for a specific configuration or pass a blank string as an argument for the global custom property table. Once you have the editor, use Set2 or Add3 depending on if the property already exists.
2016 SOLIDWORKS API Help - ICustomPropertyManager Interface
2016 SOLIDWORKS API Help - ICustomPropertyManager Interface Members
Edit:
Solidworks recommends not using that as well
As Peter and Alex have eluded to AddCustomInfo3 is an obsolete call. It only works IF the custom property does not already exist. If you want to use obsolete calls then you would want to use ModelDoc.CustomInfo2 (Configuration, FieldName)
Destination configuration is the name of the configuration that appears in the configuration tab.
Ok, thanks all, will look into the new calls.
The reason for using those calls was that I stumbled across a macro from another thread and it seemed like a good starting point:
https://forum.solidworks.com/thread/30255 - File Copy (Modified).zip
This has much of the functionality I was after but it populates both Custom & Configuration Specific Tabs
I'm looking, as an example to populate/update the Custom Tab with say "Description"
But don't want it to appear on any of the Configuration Specific ones
As such I was hoping that there is a way to achieve this.
It seems that if you leave the config field blank it populates all configuration specific custom properties and the document level custom properties.
I'm hoping to populate document level custom properties and NO configuration specific custom properties
Hope this makes more sense
Sorry, realised I branched this is the wrong place, thread rolls on into this one
Cheers
I looked at the other thread. I see Deepak is helping you out so you will not need any further help from me.
Thanks Solid Air, yes I think Deepak has got me up an running here and I've been making a bit of progress with this.
Cheers