AnsweredAssumed Answered

Costing API - How to set material?

Question asked by Andrew Currier on Nov 28, 2018

What API methods should I use to set the material of a part, such that the costing API can use this material to generate its analysis?

 

Here's what I'm currently doing:

 

First, set the material of the body/bodies like this:

body.SetMaterialProperty("Default", "solidworks materials.sldmat", materialName);

 

Later, having created the CostAnalysis, get the CostAnalysisMachining for each costing body like this:

CostAnalysis bodyCostAnalysis = (CostAnalysis)costBody.CreateCostAnalysis("--path to machining template--");

CostAnalysisMachining costMachining = (CostAnalysisMachining)bodyCostAnalysis.GetSpecificAnalysis();

 

Now, get the material name:

string costingMaterialName = costMachining.CurrentMaterial

 

Question: Why isn't costingMaterialName equal to materialName?

 

Thanks for any help!

Outcomes