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.

Variable Fillet FS

tabetha_bulnestabetha_bulnes Member, HON-TS Posts: 4 PRO
I am trying to use a variable fillet in my featurescript. I have found that the issue was in the vertexsettings array. I tried to duplicate the std fillet code that contains the vertexsettings but I still receive an error. Can you please help me understand where the issue is with the vertexsettings array? When I use the show code function and review OS Variable Fillet I see that our vertexsettings are mostly identical so I am not sure where the issue is within the vertexsettings. 

FeatureScript 1135;
export import(path : "onshape/std/geometry.fs", version : "1135.0");

const POSITIVE_EDGE_BOUNDS =
{
            (unitless) : [0, 0.5, 1]
        } as RealBoundSpec;
        
        const VR_BLEND_BOUNDS =
{
    (meter)      : [0, 0.005, 500], //allows zero
    (centimeter) : 0.5,
    (millimeter) : 5.0,
    (inch)       : 0.2,
    (foot)       : 0.015,
    (yard)       : 0.005
} as LengthBoundSpec;

const T_BLEND_BOUNDS =
{
    (meter)      : [0, 00005, 500], //allows zero
    (centimeter) : 0.5,
    (millimeter) : 0.5,
    (inch)       : 0.2,
    (foot)       : 0.015,
    (yard)       : 0.005
} as LengthBoundSpec;

const FILLET_RHO_BOUNDS =
{
    (unitless) : [0.0, 0.5, 0.99999]
} as RealBoundSpec;



annotation { "Feature Type Name" : "T-Variable Fillets" }
export const TVarFill = defineFeature(function(context is Context, id is Id, definition is map)
    precondition
    {
        
        annotation { "Name" : "Entities to fillet",
                    "Filter" : ((ActiveSheetMetal.NO && ((EntityType.EDGE && EdgeTopology.TWO_SIDED) || EntityType.FACE))
                                || (EntityType.EDGE && SheetMetalDefinitionEntityType.VERTEX))
                        && ConstructionObject.NO && SketchObject.NO && ModifiableEntityOnly.YES,
                    "AdditionalBoxSelectFilter" : EntityType.EDGE }
        definition.entities is Query;
        
         annotation { "Name" : "Tangent propagation", "Default" : true }
        definition.tangentPropagation is boolean;

        annotation { "Name" : "Cross section", "UIHint" : "SHOW_LABEL" }
        definition.crossSection is FilletCrossSection;

        annotation { "Name" : "Radius" }
        isLength(definition.radius, BLEND_BOUNDS);

        if (definition.crossSection == FilletCrossSection.CONIC)
        {
            annotation { "Name" : "Rho" }
            isReal(definition.rho, FILLET_RHO_BOUNDS);
        }
        else if (definition.crossSection == FilletCrossSection.CURVATURE)
        {
            annotation { "Name" : "Magnitude" }
            isReal(definition.magnitude, FILLET_RHO_BOUNDS);
        }


        annotation {"Name" : "Variable fillet"}
        definition.isVariable is boolean;

        if (definition.isVariable)
        {
            annotation { "Name" : "Vertices", "Item name" : "vertex",
                        "Driven query" : "vertex", "Item label template" : "[#vertexRadius] #vertex" }
            definition.vertexSettings is array;
            for (var setting in definition.vertexSettings)
            {
                annotation { "Name" : "Vertex", "Filter" : ModifiableEntityOnly.YES && EntityType.VERTEX && ConstructionObject.NO && SketchObject.NO,
                            "MaxNumberOfPicks" : 1 ,
                            "UIHint" : "ALWAYS_HIDDEN" }
                setting.vertex is Query;

                annotation { "Name" : "Radius", "UIHint" : "MATCH_LAST_ARRAY_ITEM" }
                isLength(setting.vertexRadius, VR_BLEND_BOUNDS);

                if (definition.crossSection == FilletCrossSection.CONIC)
                {
                    annotation { "Name" : "Rho", "UIHint" : "MATCH_LAST_ARRAY_ITEM" }
                    isReal(setting.variableRho, FILLET_RHO_BOUNDS);
                }
                else if (definition.crossSection == FilletCrossSection.CURVATURE)
                {
                    annotation { "Name" : "Magnitude", "UIHint" : "MATCH_LAST_ARRAY_ITEM" }
                    isReal(setting.variableMagnitude, FILLET_RHO_BOUNDS);
                }
            }
        }
            
        

    }
    {
        
         debug(context, definition.vertexSettings);       

opFillet(context, id + "fillet1", {
        "entities" : definition.entities,
        "tangentPropagation" : true,
        "crossSection": definition.crossSection,
        "radius": definition.radius ,
        "rho" :definition.rho,
        "magnitude": definition.magnitude,
        "defaultsChanged" : false, 
        "isVariable" : definition.isVariable, 
        "vertexSettings": definition.vertexSettings
});

    });

Comments

  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,411
    @tabetha_bulnes
     Could you post a screenshot of the error that is happening?  Is it an error at regen time, or an error in the Feature Studio?  In either case it may help to open the console (by pressing the button that looks like a check mark between two curly braces, at the top right of the page)

    Also, there is a handy "code" box that you can paste code into on this forum to make it more readable.  Just click the paragraph icon to the right of the bullets icon while writing your forum post, and click the "code" option in the dropdown.  A yellow box will show up that you can paste your code into!

    // It will then show up like this!

    Jake Rosenfeld - Modeling Team
  • tabetha_bulnestabetha_bulnes Member, HON-TS Posts: 4 PRO
    @Jake_Rosenfeld

    I have added the code below that produces a Regen error. As soon as I select the first vertex point I receive the Regen error. 

    https://cad.onshape.com/documents/89ea5b04ab0d940258f2c284/w/9a648584769c66b27bffe8e4/e/a7fbeb90da4045975014fb1d
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,411
    @tabetha_bulnes

    Is it possible to make the document public instead of just link shared?  I don't see anything in the console, which is a little suspicious, so I would like to make my own copy to play around with and diagnose.
    Jake Rosenfeld - Modeling Team
  • tabetha_bulnestabetha_bulnes Member, HON-TS Posts: 4 PRO
    @Jake_Rosenfeld
    I have made the file public now. Thank you for your help! :) 
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,411
    edited September 9
    @tabetha_bulnes

    The operation is failing because the "smoothTransition" field needs to be supplied to opFillet.  It should be a boolean, and corresponds to that same field in the fillet dialog.  It looks like this is not documented, so I will log something to improve that!
    Jake Rosenfeld - Modeling Team
  • tabetha_bulnestabetha_bulnes Member, HON-TS Posts: 4 PRO
    @Jake_Rosenfeld
    That did it! Thanks! You guys are awesome! :smiley:
Sign In or Register to comment.