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: 1,990 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.
Production Engineer
HWM-Water Ltd

Comments

  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 888
    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 of FeatureScript \ Onshape Inc
  • owen_sparksowen_sparks Member, Developers Posts: 1,990 PRO
    Wow, quick response, info on future enhancements and an immediate workaround.  This is why we love you guys.

    Thanks Illya.

    Cheers,

    Owen S.
    Production Engineer
    HWM-Water Ltd
  • owen_sparksowen_sparks Member, Developers Posts: 1,990 PRO
    Hello again.

    Works like a charm, thanks again :+1:



    Cheers,

    Owen S.
    Production Engineer
    HWM-Water Ltd
  • sebastian_glanznersebastian_glanzner Member Posts: 86 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: 888
    Not yet, but we have plans for resetting properties so they can be controlled by FS.
    Ilya Baran \ Director of FeatureScript \ Onshape Inc
  • sebastian_glanznersebastian_glanzner Member Posts: 86 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: 1,990 PRO
    Very Nice.

    Owen S.
    Production Engineer
    HWM-Water Ltd
  • MBartlett21MBartlett21 Member Posts: 1,415 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 FS (My FS's have "Official" beside them)
  • MBartlett21MBartlett21 Member Posts: 1,415 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 FS (My FS's have "Official" beside them)
  • richard_marcusrichard_marcus Member Posts: 10 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.
Sign In or Register to comment.