How to get the assigned material name from a part document using Soldiworks document manager api?

How to get the assigned material name from a part document using Soldiworks document manager api ?

#solidworksapi #Solidworkdocumentmanagerapi #material

The only way that I can find to do this is if the material is already a custom property in the file. If you want file specific data, you’ll have to use the Solidworks API instead.

Here’s the code snippet that gets the evaluated/resolved values for general custom properties with Document Manager.

dmDoc.GetAllCustomPropertyNamesAndValues(out var vNames, out var vTypes, out var vLinkedTo, out var vValues);

string[] sNames = (string[])vNames;
int[] sTypes = (int[])vTypes;
string[] sLinkedTo = (string[])vLinkedTo;
string[] sValues = (string[])vValues;


for(int i=0; i < sNames.Length; i++)
{
    Console.WriteLine($"{sNames[i]}: {sValues[i]} [{sTypes[i]}]");
}

thanks @BigCrazyAl

I already aware of this way. If the material is part of custom property we cand do that. But in my case material is not part of custom property but I need just name of the material using Solidworks document manager api only. I knew , how to get it via native Solidworks api.

I need to know via document manager api and material not part of custom property

I think that’s a limitation of the document manager api. It cannot access feature tree or model information to my knowledge.