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.


"For Each" feature in Onshape?

maximilian_schommermaximilian_schommer Member Posts: 32 ✭✭
This could be an improvement request or feature script thought, but I've been noticing that there are a few features that I have to set up multiple times, when really I'm doing the same thing. For example, I need to make a new feature for every "Fill Surface" call, even if I want to use the feature on a hundred individual curves. Is there a way anyone could think of to create a "For Each" macro, that can take any feature and simply apply it individually to selections? I haven't thought this through and there might be problems with handling a lot of edge cases (like, what if a feature requires multiple inputs, like an array parameter) but I figured there might be a way to pass those into a nested array parameter. 

Does anyone have ideas, or would this be a useful tool?



  • Options
    konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    I think of it from time to time after I made Parameter pattern feature based on applyPattern() function. It works as "for each" or "map" high level function but only maps feature list through an array of numeric parameters (values of prevously defined variables). But in the cases like yours we should map a feature list through the list of query parameters. I may be wrong but the easiest solutions on OS side for this looks like to allow built in features to take variables of query type as query parameters. If it was possible we could made query object arrays with custom features, assign them to variables and map feature lists on this arrays with feature pattern.
Sign In or Register to comment.