Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape, CAD, maker project and design.

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.

Variables in Patterns

thomas_kozakthomas_kozak Member Posts: 38 ✭✭
edited July 2016 in Community Support
Is it not possible to use a variable as the number of repetitions in a pattern?  When I create a circular pattern I can define it using a variable, but the variable is replaced with a static number once the pattern is finalized.  At that point it won't accept a variable any more.

Best Answer


  • thomas_kozakthomas_kozak Member Posts: 38 ✭✭
    Thanks!  I hadn't thought to try a face pattern, which is a suitable workaround for what I'm trying to do in this case.
  • juanpintomjuanpintom Member Posts: 2
    Hi all!, what about this bug? I need to use a #variable on number of repetitions (3x) :S

    Thanks :)
  • juanpintomjuanpintom Member Posts: 2
    Hi all!, what about this bug? I need to use a #variable on number of repetitions (3x) 

  • richard_gainrichard_gain Member Posts: 1
    Hi I'm trying to grid a parametric grid of circles and have run into this problem as well. Any progress on this bug? Thanks, Richard Gain
  • florianflorian Member, OS Professional, Configurations EVP Posts: 88 PRO
    I think this still needs fixing. It can't be that hard.

    @lougallo I think I reported this a few "years" back as well.

  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, Configurations EVP Posts: 312
    edited July 13
    For this case we recommend the linear pattern feature. Within that feature, Face pattern, Body pattern, and Feature pattern will all do the job.

    Sketch patterns are extremely flexible. They generate a set of sketch entities and constraints, but after that, you can remove any constraint, add more constraints, or even delete the patterned entities. Unfortunately, this means changing the pattern count to a smaller number, then back to the same number, will destroy any such changes and leave you with a different model!

    Doing that change with a variable would violate one of the core principles of Onshape's architecture, deterministic regeneration, which means than the same feature tree will build the same way every time, regardless of what steps you took to create it (and that it will stay that way eternally through all versions of Onshape!). This is something which is demonstrably absent in other CAD systems, but is a critical component of any system which has real-time collaboration, and will also be a key piece of Onshape's upcoming implementation of configurations.

    The linear pattern and circular pattern features are less flexible in this extent, but are fully deterministic so it's safe to dynamically control it with a variable in your feature tree.

    (To be clear, this doesn't mean we'll never be able to control sketch patterns with a variable. It just means that to do so, we need to change the internal representation of sketch entities and sketch patterns so that this information is not destroyed, which would be a reasonably large change that we haven't prioritized)
  • florianflorian Member, OS Professional, Configurations EVP Posts: 88 PRO
    Thank you very much @kevin_o_toole_1 for the great answer.

    I first thought it would still be impossible, as I need to pattern a sketch vertex. But with the help of a zero offset surface and a 3D spline (wich is a straight line if you select only two vertices) you can pattern it and use the endpoint of the patterned spline as the vertex later. Here is the example:

    …It is great to hear that my designs will be the same in a few years time, even if the underlying feature logic changes.
  • emagdalenaC2CemagdalenaC2C Member, Developers, Configurations EVP Posts: 169 ✭✭✭
    Hi @florian

    Do you know that you can create an array feature of a sketch??

    A sketch, a variable or an extrude are all features that you can use in your arrays.

    Take a look of this sample https://cad.onshape.com/documents/556785024e8ea12b4ff1a004/w/45110c3cc4d2d6e8047223c3/e/969f8e15e7ed8c4f45eb16b6
    Un saludo,                                                                                                                   Perfil en LinkedIn Averigua a quién conocemos en común
    Eduardo Magdalena
    C2i Change 2 improve
    Optimización de procesos

    ☑ ¿Por qué no organizamos una reunión online?
    Selecciona el día y la hora que más te interese
    C2C Close 2 Circle™
    Consulting Partner de Onshape

  • florianflorian Member, OS Professional, Configurations EVP Posts: 88 PRO

    True. That works fine as well. But you cannot do it selectively. Still pretty useful!
Sign In or Register to comment.