API Write to custom properties to Custom tab and NOT Config Specific Properties

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
Answers 7
PK
PK 2018-01-12 Best Answer
AB
AB 2018-01-12

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

comment imagecomment image
SA
SA 2018-01-12

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.

comment imagecomment image
JW
JW 2018-01-12

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

comment imagecomment imagecomment imagecomment image
JW
JW 2018-01-12

Sorry, realised I branched this is the wrong place, thread rolls on into this one

Cheers

SA
SA 2018-01-13

I looked at the other thread.  I see Deepak is helping you out so you will not need any further help from me.

JW
JW 2018-01-16

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