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.

Duplicate feature parameter's'

Toshimichi_OdaToshimichi_Oda OS Professional Posts: 29 ✭✭

Error occurred, but I do not think it is not an error.

       Duplicate feature parameter's'

I use duplicated name of inner parameter of array, but names of two arrays are different.
It is not serious for me because I am good to change the name.



annotation { "Feature Type Name" : "My Feature" }
export const myFeature = defineFeature(function(context is Context, id is Id, definition is map)
    precondition
    {
        annotation { "Name" : "Widgets", "Item name" : "Widget", "Item label template" : "#myParameter" }
        definition.myWidgets is array;
        for (var widget in definition.myWidgets)
        {
            widget.arrayItem is string;
        }
        
        annotation { "Name" : "Widgets", "Item name" : "Widget", "Item label template" : "#myParameter" }
        definition.myWidgets2 is array;
        for (var widget in definition.myWidgets2)
        {
            widget.arrayItem is string;  // when change to "widget.arrayItem2", no error
        }

    }
    {
    });


Maybe namespace of each item of array is not exist .

Comments

  • lanalana Onshape Employees Posts: 618
    @Toshimichi_Oda
    This sounds like na error on our side. Thank you for pointing it out.
  • Toshimichi_OdaToshimichi_Oda OS Professional Posts: 29 ✭✭
    Thank you.
    I feel good about usability of FS.
  • Alex_KempenAlex_Kempen Member Posts: 197 EDU
    @lana Is this actually a bug on Onshape's end? I always assumed it was just a part of strict unique parameter naming requirements, as described via the last line of the documentation on array parameters:
    Note that inner parameter names must be unique across the entire feature (even though they are not stored directly on the definition map).
  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,068
    @Alex_Kempen
    Yes, this is more of a known limitation than an outright bug.
    Ilya Baran \ Director, Architecture and FeatureScript \ Onshape Inc
  • Toshimichi_OdaToshimichi_Oda OS Professional Posts: 29 ✭✭
    @lana , @ilya_baran, thank you.

    I see it is a limitation than an outright bug.

    The limitation is a little hassle only in programming,
    but no problem for using feature written in FS.
    So I think it is not serious.



  • Toshimichi_OdaToshimichi_Oda OS Professional Posts: 29 ✭✭
    On second thought, it is strange for programming.

    In precondition, I make the same two preconditions to be made to a function.
    One is out of array, another is with in array-loop.
    annotation { "Feature Type Name" : "testCallPredicate1" }
    export const testCallPredicate1 = defineFeature(function(context is Context, id is Id, definition is map)
        precondition
        {
            stringPredicate1(definition);  //out of array
        }
        {
        });

    annotation { "Feature Type Name" : "testCallPredicate3" }
    export const testCallPredicate3 = defineFeature(function(context is Context, id is Id, definition is map)
    precondition{}
    {});

    annotation { "Feature Type Name" : "testCallPredicate2" }
    export const testCallPredicate2 = defineFeature(function(context is Context, id is Id, definition is map)
        precondition
        {
            annotation { "Name" : "Widgets", "Item name" : "Widget", "Item label template" : "#str" }
            definition.myWidgets is array;
            for (var widget in definition.myWidgets)
            {
                stringPredicate1(widget);  // within array-loop  // Error!
                // stringPredicate2(widget);  // no error!
            }
        }
        {
        });

    predicate stringPredicate1(definition)
    {
        annotation { "Name" : "str" }
        definition.str is string;    
    }
    predicate stringPredicate2(widget)
    {
        annotation { "Name" : "str" }
        widget.str is string;    
    }

    stringPredicate1(widget) causes Error.
    But stringPredicate2(widget)  has no error.
    And using 'definition' instead of 'widget' has no error.
     
            for (var definition in definition.myWidgets)
            {
                stringPredicate1(definition);  // no error!
           }

    I think that it is strange for program.


Sign In or Register to comment.