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.

globaly change variable name, search replace

wolfgang_maierwolfgang_maier Member Posts: 39 ✭✭✭
Hello forum,

a variable can be renamed.

Assume the variable is used to defined the size of objects.
With renaming the variable all references to objects must be updated manually.

So, i am missing a global search/replace command for changing all occurrences for that variable.

regards
Wolfgang

Comments

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

    There is currently no functionality in the product to refactor a part studio variable name.

    Please vote on this improvement request so that we can prioritize this enhancement: https://forum.onshape.com/discussion/comment/29018#Comment_29018
    Jake Rosenfeld - Modeling Team
  • lorenz_michelslorenz_michels Member Posts: 4 EDU
    I miss the function that Wolfgang suggests too. I think however that it can be even better than Wolfgang suggests and perhaps it should be divided into two functions:

    1. rename: When renaming a variable (the situation Wolgang describes) it would be nice if OnShape would show a list of items that use that variable. It then would be nice if the user could select the items which have to use the renamed version of the variable. When the user only selects SOME of the items to use the new variable the unselected items will still be using the old version of the variable. In fact the user creates a new variable in this way. If the user selects ALL the items to use the renamed version of the variable, then the user should be able to choose whether to keep the old variable or to delete the old variable (default)

    2. search and replace: A search and replace function for variable names would be nice. This is independent of renaming of a variable.

    I am aware that these two functions overlap with each other, but both have their value.
  • Curt_WelchCurt_Welch Member, csevp Posts: 42 ✭✭
    @lorenz_michels, I think the ability to split one variable into two would be nice, but it is important to keep the simple operations simple.  So if the split option is added, it should be separate from the rename.  Another pop-up menu option for "split into two," which then triggers the complex dialog to define the new name and value, as well as checkboxes for the uses.  But since variables can be used many times in one feature, it is more complex than just a list of features that reference it, but every use of the variable in the feature.  Imagine having a single sketch that used the first variable in 30 locations, but only some of those would be split,  How could you even tell which you needed to change from a simple checkbox list?  Likely you would need to open the sketch and look at each reference to see which needed to be different.  It gets instantly complex fast which means the UI to address it becomes massive amounts of coding or else you take shortcuts, and then it becomes a bad thing to add.

    So first priority, just make rename update all the references (at least all in the same document). I would make the global update the default.  Not even an option.  If you want to make it a new variable with a new name, just do that, add a new variable.  To make that a little cleaner and safe, a "duplicate" function could be added which produced a new variable with the same attributes and a name like "variable_copy".  So you could duplicate, then modify, and not have to accidentally fail to type is the value correctly for exa ple.
Sign In or Register to comment.