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.

"Feature Name Template": "Name " + Correlative number

emagdalenaC2iemagdalenaC2i Member, Developers, Channel partner Posts: 863 ✭✭✭✭✭
FeatureScript features name is by default "FeatureName " + Correlative number. But can we set the "Feature Name Template" to something like "otherName + Correlative number?


Un saludo,

Eduardo Magdalena                         C2i Change 2 improve                         ☑ ¿Por qué no organizamos una reunión online?  
                                                                     Partner de PTC - Onshape                                     Averigua a quién conocemos en común

Comments

  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646


    I think you're looking for the "annotation" above the call to "defineFeature()".  This feature will show up on the feature list as "Some Other Feature Name 1", "Some Other Feature Name 2", etc.
    Jake Rosenfeld - Modeling Team
  • emagdalenaC2iemagdalenaC2i Member, Developers, Channel partner Posts: 863 ✭✭✭✭✭
    edited March 2017
    Hi

    I think this Featurecript will show up on the Feature list as "Some Other Feature Name", "Some Other Feature Name", etc. without any number
    Un saludo,

    Eduardo Magdalena                         C2i Change 2 improve                         ☑ ¿Por qué no organizamos una reunión online?  
                                                                         Partner de PTC - Onshape                                     Averigua a quién conocemos en común
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646


    ------------



    ------------

    Just tested it out and it shows up as expected (With the correct ascending numbers) on my end.  Is it not working for you?
    Jake Rosenfeld - Modeling Team
  • emagdalenaC2iemagdalenaC2i Member, Developers, Channel partner Posts: 863 ✭✭✭✭✭
    Sorry. Of course, it works. You just change the name of the feature.
    But what I want is to keep that name and use another name for the features created. Like in this example

    annotation { "Feature Type Name" : "Profile Generator C2C", "Feature Name Template" : "Profile (NUMBER) - #profileName"}
    export const profileGenerator = defineFeature(function(context is Context, id is Id, definition is map)
        precondition
        {
            // Define the parameters of the feature type
            
            annotation { "Name" : "Name" }
            definition.profileName is string;
            
        }
        {
            // Define the function's action
        });
    Un saludo,

    Eduardo Magdalena                         C2i Change 2 improve                         ☑ ¿Por qué no organizamos una reunión online?  
                                                                         Partner de PTC - Onshape                                     Averigua a quién conocemos en común
  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565
    edited March 2017
    You can, from within the feature, use setFeatureComputedParameter to set a parameter named, e.g. "index", then access that value in your template string as "#index".

    If you want the behavior you describe, you could have each of your features increment a "counter" context variable via setVariable and getVariable, then set the "index" feature computed parameter to equal your "counter" variable. Alternatively you might have more helpful distinguishing identifier to append to each feature. That's up to you.

    Note that the above will behave slightly differently our normal feature counters. Names like "Extrude 1" and "Extrude 2" are editable, but stay with the feature when you, say, reorder them. Your computed name is not editable, but will dynamically update to display its correct index within the feature list.

  • emagdalenaC2iemagdalenaC2i Member, Developers, Channel partner Posts: 863 ✭✭✭✭✭
    Ok, Thanks

    I will run some test
    Un saludo,

    Eduardo Magdalena                         C2i Change 2 improve                         ☑ ¿Por qué no organizamos una reunión online?  
                                                                         Partner de PTC - Onshape                                     Averigua a quién conocemos en común
Sign In or Register to comment.