Custom properties

Hello

Is there a way to sort or rearrange the custom properties of a PRT or ASM file?

It would be so much easier to find a property in the list if they were listed alphabetically.

Thank you in advance for your answers

I don't think so, however, you can organize them through the form manager

1 Like

Hello

maybe by making a part family, import the PPs, sort them, update the model and delete the family afterwards. OK, it's a hack, but it can work, to try on a copy just in case. 

Otherwise, the PP manager is very useful.

1 Like

In the idea of @a.leblanc, you can copy-paste PPs into XL, sort them, delete them in the room and paste them back from XL.

It's still a hack.

Maybe one of our macro-mad developers would be able to automate this for us...

2 Likes

Thank you for your answers, I wasn't precise enough in the question, we use PDM so it's not possible to go through the form editor and use a form.

I had already considered the XLS solution but it forces me to use all our document templates, being a subcontractor we use different templates depending on the client, which means that we have to do the handling for each template:(

Hello

With a macro and a string comparator, it should do it. I don't have the pc at hand but it's largely doable. To help, I had made a tutorial on exporting pps. Basically it's the same except that they have to be stored in a second table. 

1 Like

Thank you Yves, I'll try as soon as possible.

Hello

It may be a bit late, but here is a piece of code in C# that allows you to take the custom properties of the active configuration, sort them alphabetically and then display the result.

ModelDoc2 swModel = null;
swModel = ((ModelDoc2)(swapp.ActiveDoc));
CustomPropertyManager PropMgr = null;
ConfigurationManager swConfigMgr;
Configuration swConfig;
swConfigMgr = swModel.ConfigurationManager;
swConfig = swConfigMgr.ActiveConfiguration;
			
int nNbrProps;
int j;
object[] vPropNames;
string valOut;
string resolvedValOut;
string msg = string.Empty;
int custPropType;
List<string> ListeProp = new List<string>();

PropMgr = swConfig.CustomPropertyManager;

// Récupérer le nombre de propriétés personnalisées dans la configuration active
nNbrProps = PropMgr.Count;

// Récupérer le nom de la propriété personnalisée
vPropNames = (object[])PropMgr.GetNames();

// Récupérer le nom de la variable et la valeur assignée pour chaque propriété personnalisée
for (j = 0; j <= nNbrProps - 1; j++)
{
    PropMgr.Get2(vPropNames[j].ToString(), out valOut, out resolvedValOut);

    ListeProp.Add(vPropNames[j].ToString() + " ==> " + resolvedValOut.ToString());
}
            
ListeProp.Sort();
            
foreach (string element in ListeProp)
{
    msg = msg + element + "\n";
}
			
MessageBox.Show(msg);

Kind regards

1 Like

And here's the executable to see what it looks like.

Kind regards


listpropsw.zip

Info on the subject in my tutorials:

http://tutoriel.solidworks.free.fr/crbst_168.html

Thanks Alain, however in the list are the properties probably default to Solidworks but not our properties in the file.

We have specific properties that we use with PdmWorks but they don't appear, neither in "Edit List" nor in the property file, which seems logical.

Thank you Roger, as soon as I have a little time I take a closer look, I unfortunately couldn't visualize your exe, it's systematically removed by our anti-virus and I can't prevent it (internal instruction ).