Change Material of Parts with Feature Studio

Abhishek_K
Abhishek_K Member Posts: 2 ✭

We have code that can update multiple material types at once. However, there's a bug in the software: if a material type is changed manually for an item, the code won't be able to update that item later.

and If we try to change appearance with same code then it works fine. Is it an BUG ?!

Here is code

FeatureScript 2543;
import(path : "onshape/std/common.fs", version : "2543.0");
annotation { "Feature Type Name" : "mm1", "Feature Type Description" : "Cube by SCG" }
export const mm = defineFeature(function(context_a is Context, id is Id, definition is map)
precondition
{
// Define the parameters of the feature type
annotation { "Name" : "Select Part", "Filter" : EntityType.BODY, "MaxNumberOfPicks" : 5 }
definition.part_list is Query;

}


{
    // Define the function's action

    
    println(definition.part_list);
    
    setProperty(context_a, {
                "entities" : definition.part_list,
                "propertyType" : PropertyType.APPEARANCE,  //MATERIAL,
                "value" : color(0, 0, 1)  //material("ABS", 0.11 * gram / centimeter ^ 3)

            });

});

Answers

  • martin_kopplow
    martin_kopplow Member Posts: 1,642 PRO
    edited January 2025

    It might be due to assigning is not the same as editing.