Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- 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_kozak
Member Posts: 38 ✭✭
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.
6
Best Answer
-
3dcad Member, OS Professional, Mentor Posts: 2,475 PROI was told this is a known issue and will be fixed in next updates. But issue is only with sketch pattern not part/face pattern.//rami5
This discussion has been closed.
Answers
Thanks
@lougallo I think I reported this a few "years" back as well.
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)
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.
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
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
True. That works fine as well. But you cannot do it selectively. Still pretty useful!
Then, in a second, later sketch, reference the center points of those circles and make larger circles from them. (I use the center-point-circle tool 3 times to make this next image, once at each of the centers):
Then I go back to sketch 1 and I change the 3x to a 5x:
The only problem here is that I had to open sketch one, find the actual place where it said "3x" inside that sketch, double click it, and then replace the 3 with a 5. Instead of doing all that, it would be easier if there was a variable that stored the number I wanted to use which I could change easily. This has nothing to do with the philosophy of a cad program. Any time I can go find a place which takes a number input (which can be changed at any time) that place should also accept a variable.
I'm sure someone is looking at this last image that has 3 large circles and 2 small circles (which of course looks goofy and undesirable) and is thinking "ah, its good we don't allow this" but you're wrong--you do allow this, just not with a variable, which is what we are requesting in this thread.
I agree that any number should be able to replace with variable. But in this case, why are you using two sketches for those circles? I would also consider doing the pattern as face/feature pattern and keep the sketch as simple as possible.
in the pic below, I created two cylinder features, and created a circular pattern on the smaller cylinder driven by configuration variables to cut the teeth.
After playing around with it for a while, I believe it has a problem with the fact that the result of the operation is a length. If I make WallLength a number, and divide by the integer 16, it works.
Is there any way around this, or am I missing something?
#WallLength/16in doesn’t work, but
#WallLength/(16in) does
I believe the first case is applying “in” to the result of #WallLength/16. It’s my understanding #WallLength/16 is invalid.
Would it be possible to provide an option to convert the pattern into "normal" geometry? Then it wouldn't be a pattern anymore and people can remove constrains, modify stuff etc. at will. The pattern would in this case more be a template that allows to rapidly produce geometry that can then manually be fine tunes.
That way the patterns would have a very defined behavior as long as they are patterns - and could thus also be parameterized.
So people have the choice - leave patterns patterns as a parametric feature or just use them as a template, convert them to plain geometry and modify at will.
I used several sketches as basis for a loft and manually changed the pattern count in all sketches. It worked perfectly, changing the numbers was really all I had to do, the loft adapted as expected! As long as one has to do this manually in a lot of sketches it is super tedious though - but it shows that it works as long as one doesn't manually remove constaints etc. and keeps the patterns as patterns.
Would be so good to be able to use a variable or change the value as part of a configuration!.