0 Replies Latest reply on Nov 28, 2018 5:22 PM by Andrew Currier

    Costing API - How to set material?

    Andrew Currier

      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!