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: 1,173
    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 \ VP, 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, Developers Posts: 398 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: 1,173
    Not yet, but we have plans for resetting properties so they can be controlled by FS.
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • sebastian_glanznersebastian_glanzner Member, Developers Posts: 398 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 :)
    <div>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)
                    });
    
        });
    </div><div><br></div>
  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    Very Nice.

    Owen S.
    Business Systems and Configuration Controller
    HWM-Water Ltd
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,034 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 - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,034 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 :)
    <div>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)
                    });
    
        });
    </div><div><br></div>
    @ilya_baran

    Maybe you could merge this change into yours?
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • richard_marcusrichard_marcus Member Posts: 17 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: 8
    edited March 2020
    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,646
    @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,646
    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: 43 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: 1,173
    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 \ VP, Architecture and FeatureScript \ Onshape Inc
  • monroe_weber_shirkmonroe_weber_shirk Member Posts: 94 EDU
    Is there any option for resetting the properties of a part in a part studio? I'm setting the properties in FeatureScript and I manually played with the color of a part and now can't find a way to undo that. 
  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565
    @monroe_weber_shirk

    The "Reset all" button does exactly what you want. This will reset all properties at once (so if you don't want everything reset you'll need to redo those), but it's the one way to completely remove manually-set properties (including color), so after that you'll see your FS properties shining through. 


Sign In or Register to comment.