Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

Change Material of Parts with Feature Studio

Abhishek_KAbhishek_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_kopplowmartin_kopplow Member Posts: 602 PRO
    edited January 5

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

Sign In or Register to comment.