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.

Configuring Part Property problem (Now FIXED)

owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
edited March 2018 in Using Onshape
Hi folks, I wonder if you can help?

I have a pipe that has two configuration inputs. (Length and colour.)

I can configure the appearance just fine but the configuration takes into account the length and colour options.



The length isn't relevant, so this method fails if the length is set to anything other than the default.

I don't seem to be able to delete the length column from the properties config.

What am I doing wrong?

Thanks for your time.

Cheers,

Owen S.
Business Systems and Configuration Controller
HWM-Water Ltd

Comments

  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 978
    For configuring properties, you currently have to specify all configuration inputs, so you can't delete a configuration input column from the table.  We're working on it.

    The only way you can currently set a color based on one configuration input is by writing a custom feature.  Here's one I whipped together: https://cad.onshape.com/documents/d290e9ee2e626a7b649b4927/w/194d18396c5bc98706ec2624/e/7b2aa285ed0349bc1a9fe1d7 -- you can configure the color parameters.
    Ilya Baran \ Director, Architecture and FeatureScript \ Onshape Inc
  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    Wow, quick response, info on future enhancements and an immediate workaround.  This is why we love you guys.

    Thanks Illya.

    Cheers,

    Owen S.
    Business Systems and Configuration Controller
    HWM-Water Ltd
  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    Hello again.

    Works like a charm, thanks again :+1:



    Cheers,

    Owen S.
    Business Systems and Configuration Controller
    HWM-Water Ltd
  • sebastian_glanznersebastian_glanzner Member Posts: 168 PRO
    For configuring properties, you currently have to specify all configuration inputs, so you can't delete a configuration input column from the table.  We're working on it.

    The only way you can currently set a color based on one configuration input is by writing a custom feature.  Here's one I whipped together: https://cad.onshape.com/documents/d290e9ee2e626a7b649b4927/w/194d18396c5bc98706ec2624/e/7b2aa285ed0349bc1a9fe1d7 -- you can configure the color parameters.
    Nice Feature Script! But it only works with parts that have never been assigned an appearance, so only "new" parts.

    Is there a workaround to overwrite/reset the appearance?
  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 978
    Not yet, but we have plans for resetting properties so they can be controlled by FS.
    Ilya Baran \ Director, Architecture and FeatureScript \ Onshape Inc
  • sebastian_glanznersebastian_glanzner Member Posts: 168 PRO
    Not yet, but we have plans for resetting properties so they can be controlled by FS.
    Sounds very good!

    I also adjusted you FS a little bit, now I can use integer RGB values (0...255)
    And you can set a material name and density :)
    FeatureScript 765;
    import(path : "onshape/std/geometry.fs", version : "765.0");
    
    annotation { "Feature Type Name" : "Set Color" }
    export const setColor = defineFeature(function(context is Context, id is Id, definition is map)
        precondition
        {
            annotation { "Name" : "Bodies", "Filter" : EntityType.BODY }
            definition.bodies is Query;
    
            annotation { "Name" : "Red" }
            isInteger(definition.red, { (unitless) : [0, 128, 255] } as IntegerBoundSpec);
    
            annotation { "Name" : "Green" }
            isInteger(definition.green, { (unitless) : [0, 128, 255] } as IntegerBoundSpec);
    
            annotation { "Name" : "Blue" }
            isInteger(definition.blue, { (unitless) : [0, 128, 255] } as IntegerBoundSpec);
    
    
            annotation { "Name" : "Alpha" }
            isReal(definition.alpha, { (unitless) : [0.0, 1, 1] } as RealBoundSpec);
    
            annotation { "Name" : "Material Name" }
            definition.myMaterialName is string;
    
            annotation { "Name" : "Material Density" }
            isReal(definition.myMaterialDensity, { (unitless) : [0.0, 1, 25] } as RealBoundSpec);
        }
        {
            setProperty(context, {
                        "entities" : definition.bodies,
                        "propertyType" : PropertyType.APPEARANCE,
                        "value" : color(definition.red / 255., definition.green / 255., definition.blue / 255., definition.alpha)
                    });
    
            setProperty(context, {
                        "entities" : definition.bodies,
                        "propertyType" : PropertyType.MATERIAL,
                        "value" : material(definition.myMaterialName, definition.myMaterialDensity * gram / centimeter ^ 3)
                    });
    
        });
    
  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    Very Nice.

    Owen S.
    Business Systems and Configuration Controller
    HWM-Water Ltd
  • MBartlett21MBartlett21 Member Posts: 1,797 EDU
    edited March 2018
    Not yet, but we have plans for resetting properties so they can be controlled by FS.
    When will this be available?
    @ilya_baran
    MB - I make FeatureScripts:View FeatureScripts
  • MBartlett21MBartlett21 Member Posts: 1,797 EDU
    Not yet, but we have plans for resetting properties so they can be controlled by FS.
    Sounds very good!

    I also adjusted you FS a little bit, now I can use integer RGB values (0...255)
    And you can set a material name and density :)
    FeatureScript 765;
    import(path : "onshape/std/geometry.fs", version : "765.0");
    
    annotation { "Feature Type Name" : "Set Color" }
    export const setColor = defineFeature(function(context is Context, id is Id, definition is map)
        precondition
        {
            annotation { "Name" : "Bodies", "Filter" : EntityType.BODY }
            definition.bodies is Query;
    
            annotation { "Name" : "Red" }
            isInteger(definition.red, { (unitless) : [0, 128, 255] } as IntegerBoundSpec);
    
            annotation { "Name" : "Green" }
            isInteger(definition.green, { (unitless) : [0, 128, 255] } as IntegerBoundSpec);
    
            annotation { "Name" : "Blue" }
            isInteger(definition.blue, { (unitless) : [0, 128, 255] } as IntegerBoundSpec);
    
    
            annotation { "Name" : "Alpha" }
            isReal(definition.alpha, { (unitless) : [0.0, 1, 1] } as RealBoundSpec);
    
            annotation { "Name" : "Material Name" }
            definition.myMaterialName is string;
    
            annotation { "Name" : "Material Density" }
            isReal(definition.myMaterialDensity, { (unitless) : [0.0, 1, 25] } as RealBoundSpec);
        }
        {
            setProperty(context, {
                        "entities" : definition.bodies,
                        "propertyType" : PropertyType.APPEARANCE,
                        "value" : color(definition.red / 255., definition.green / 255., definition.blue / 255., definition.alpha)
                    });
    
            setProperty(context, {
                        "entities" : definition.bodies,
                        "propertyType" : PropertyType.MATERIAL,
                        "value" : material(definition.myMaterialName, definition.myMaterialDensity * gram / centimeter ^ 3)
                    });
    
        });
    

    @ilya_baran

    Maybe you could merge this change into yours?
    MB - I make FeatureScripts:View FeatureScripts
  • richard_marcusrichard_marcus Member Posts: 11 EDU
    For configuring properties, you currently have to specify all configuration inputs, so you can't delete a configuration input column from the table.  We're working on it.
    Is there an improvement request tied to this? Looking forward to this update. I'd like to make my part properties not tied to a configuration variable.
  • victor_ragusilavictor_ragusila Member Posts: 4 PRO
    edited March 4
    any update on this? The fact that I cant use the FeatureScript on existing bodies where I modified the appearance is rather disappointing

  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,560
    @victor_ragusila

    If you follow these instructions you can see how to reset part properties:
    https://www.onshape.com/cad-blog/tech-tip-how-to-reset-part-properties-in-onshape

    Unfortunately, color does not show up explicitly in that panel, so you will have to use "Reset all" if you would like to reset the color.

    We will start brainstorming on how to handle this better.
    Jake Rosenfeld - Modeling Team
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,560
    Apologies, it appears that "Reset all" is the only way to reset any property.  I was misinformed about being able to reset individual properties from the dialog.  For now, it appears that appearance follows the same rules as everything else, and is resettable.
    Jake Rosenfeld - Modeling Team
  • sam_parsonssam_parsons Member Posts: 10 PRO
    ilya_baran said:

    We're working on it.
    @ilya_baran , is this still on the horizon?
  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 978
    It's still on our todo list, but we've prioritized other work ahead of it.  Please make a ticket so your vote can count in the prioritization process.
    Ilya Baran \ Director, Architecture and FeatureScript \ Onshape Inc
Sign In or Register to comment.