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.

Part Appearance. Can we configure it like a feature, not a property?

AlexPittAlexPitt Member Posts: 22 PRO

Hi, (this may be an improvement request - however...)

The fact that part colour/appearance is a property (like meta-data) and not a feature (like extrude height) means that it must be configured in the "configured properties" table.  

For colour stability across a configured part, every permutation must be resolved in this table making the number of rows a factor of the other config tables present in the part studio.  This has the potential to be a huge number of entries.

It would be great if it was possible to configure colour/appearance in an independent table in a similar way to part features.

Kind regards,

Alex Pitt


Fig 1. Two independent tables each with 3 configs. Results in 3x3 = 9 permutations.





Fig 2. In "Configured part properties" (right), each permutaion must be defined in the table to maintain colour stability.



Best Answers

  • AlexPittAlexPitt Member Posts: 22 PRO
    Accepted Answer
    ...so fixed the above by simply adding  a new "Red2" colour config (which did work) and deleted the original faulty "Red" config. (below shows the renamed Red2 colour config). 

    Thanks Neil, this is exactly what I was looking for! I'll try it with some more complex assemblies.


Answers

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 3,180
    edited May 22
    This simple FeatureScript can be used to set a Part's color and then it can be configured:
    annotation { "Feature Type Name" : "Color Part" }
    export const colorPart = defineFeature(function(context is Context, id is Id, definition is map)
        precondition
        {
            annotation { "Name" : "Parts", "Filter" : EntityType.BODY }
            definition.parts is Query;
    
            annotation { "Name" : "Red" }
            isReal(definition.red, POSITIVE_REAL_BOUNDS);
    
            annotation { "Name" : "Green" }
            isReal(definition.green, POSITIVE_REAL_BOUNDS);
    
            annotation { "Name" : "Blue" }
            isReal(definition.blue, POSITIVE_REAL_BOUNDS);
    
            annotation { "Name" : "Alpha" }
            isReal(definition.alpha, POSITIVE_REAL_BOUNDS);
        }
        {
            setProperty(context, {
                        "entities" : definition.parts,
                        "propertyType" : PropertyType.APPEARANCE,
                        "value" : color(definition.red, definition.green, definition.blue, definition.alpha)
                    });
        });

  • AlexPittAlexPitt Member Posts: 22 PRO
    Thanks Neil,
    I'll copy/paste this into a simple doc and have a play. Still a little intimidated by feature script but hopefully this will help me get a grip!
    Much appreciated!
  • AlexPittAlexPitt Member Posts: 22 PRO
    edited May 22
    It works! Except for the first colour config...

  • AlexPittAlexPitt Member Posts: 22 PRO
    Accepted Answer
    ...so fixed the above by simply adding  a new "Red2" colour config (which did work) and deleted the original faulty "Red" config. (below shows the renamed Red2 colour config). 

    Thanks Neil, this is exactly what I was looking for! I'll try it with some more complex assemblies.


  • Cache_River_MillCache_River_Mill Member Posts: 193 PRO
    edited June 15
      
Sign In or Register to comment.