Export/import of custom properties

Hello

Is there a macro that allows you to import or export custom properties on parts or assemblies in one go via Excel? At cadware this macro is called PRP XLS.

Hello

Not to my knowledge, maybe in myCADtools.

However, here is an example of code (in c#) to retrieve all the custom properties of a part or an asm and write the result to a csv file.

ModelDoc2 Part;
Part = ((ModelDoc2)(swApp.ActiveDoc));

CustomPropertyManager PropMgr = null;
ConfigurationManager swConfigMgr;
Configuration swConfig;
swConfigMgr = Part.ConfigurationManager;
swConfig = swConfigMgr.ActiveConfiguration;

int nNbrProps = 0;
int j = 0;
object[] vPropNames = null;
string valOut = string.Empty;
string resolvedValOut = string.Empty;
string saveLog = string.Empty;
int custPropType = 0;

PropMgr = swConfig.CustomPropertyManager;

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

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

// On récupére 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);
	custPropType = PropMgr.GetType2(vPropNames[j].ToString());
	
	saveLog = vPropNames[j].ToString() + ";" + resolvedValOut.ToString();
	
	// On écrit ce résultat dans un fichier csv
	string FicLog = Application.StartupPath + "\\Resultat.csv";
	StreamWriter Flux = new StreamWriter(FicLog, true);
	Flux.Write(saveLog + "\n");
	Flux.Close();
}

Kind regards

If you have the myCADTool tools you can turn to BatchProperty cf attached image


pr_sentation_des_utilitaires_2016_1_page_23.png
1 Like

Thank you for your answers:) Indeed, the Batch Properties seems to be similar to the PRP XLS macro.

 

Hello

FYI, you can extract in Excel all the properties of the files contained in a folder with the SmartBom tool.

You can reimport the properties from the Excel file with Intergration

 

Integration: