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.
patterns in assembly configurations
steven_van_luchene848
Member Posts: 122 PRO
Hi,
I Can't seem to figure out how to adjust patterns to the assembly configurations.
I've included a simplified example here
seems the variable studio variables with the same name as the configuration variables get overwritten,
so far so good.
But variables that are later derived from these "overwritten" variables don't...?
as the number of bars in the grid and the spacing between them is a function of the height or width of the grid. this then doesn't change as shown in the picture below. the bars of the grid change effectively, but the grid doesn't expand.
Is there a better way or workaround?
thanks!
I Can't seem to figure out how to adjust patterns to the assembly configurations.
I've included a simplified example here
seems the variable studio variables with the same name as the configuration variables get overwritten,
so far so good.
But variables that are later derived from these "overwritten" variables don't...?
as the number of bars in the grid and the spacing between them is a function of the height or width of the grid. this then doesn't change as shown in the picture below. the bars of the grid change effectively, but the grid doesn't expand.
Is there a better way or workaround?
thanks!
0
Best Answer
-
MichaelPascoe Member Posts: 1,989 PRO
Yes, this is possible. Before we go further, you need to decide what you want your driving parameter to be. Total width and height, spacing between bars, or bar widths. It can be any 2 combinations of these, but all 3 at the same time will over-constrain unless they are the exact right numbers. I suggest Total width and bar width as the spacing between is easier to adjust than the size of the bars in the real world. Unless you want the total width to be the driving parameter and the spacing between to equal the bar spacing.
Personally, I would throw all of this into a single part studio so I could use more tools: feature variables, pattern along curve, custom features, etc... For me, assemblies are a pain to work with because I want theme to have all the same functionality as a part studio; they are worth it if you need to use the BOM or have large scale projects.
Assuming you want the gaps to be as close as possible to the bar widths, but still vary to fit the over all size of the grid. You can do this which takes advantage of math functions within the feature input box. You could use roundToPrecision() but I used ceil() instead with will round it up to the nearest whole number.
Note I removed all variables in the variable studio except the bar size.
Quantity calculation
ceil(#heightGrid/(#sizeBar*2))
Spacing calculation
(#heightGrid - #sizeBar)/ ((ceil(#heightGrid/(#sizeBar*2)))-1)
Place both of these inside your assembly pattern and you should be good to go.
https://cad.onshape.com/documents/de5523855733346e4095f92d/w/fbf477c3ec61e6d1170b5eb9/e/b...
Learn more about the Gospel of Christ ( Here )
CADSharp - We make custom features and integrated Onshape apps! Learn How to FeatureScript Here 🔴0
Answers
Are you intentionally trying to override? Why not use different names to keep things clear and simple. You could also throw in some ternary conditional operators if you want to be able to use both and switch between them.
Ternary conditional operatiors + configurations + variable studio
UseDefaultQty? DefaultQty: QtyLearn more about the Gospel of Christ ( Here )
CADSharp - We make custom features and integrated Onshape apps! Learn How to FeatureScript Here 🔴
Thanks for the quick reply.
You've lost me. ternary conditional operators?
the real application is a shelving unit which uses rollers on its shelf surface.
customers can change the width of this shelving to their specs. only thing they have to worry about is the width of the shelf, the system should be able to generate a shelving with the max number of rollers that their specific chosen width will accomodate.
anyway, back to the example:
so the only input available is width and height of the grid (through a config variable)
using the width/height config variable I can then calculate the distance between the beams to be as close to a desired value and stil get an even distribution.
This calculation is done in an number of formulas in the variable studio (as i don't see any other way) the input however is done through a config variable, which, to my knowledge isn't available to the variable studio (allthough it seems to override the variable studio variable with the same name) So yes, I am intentionally trying to get this value overwritten. challenge is, the overwritten value isn't used in later formulas in that same variable studio.
did you have a look at the example?
here's the link again:
https://cad.onshape.com/documents/3a8ab0d673782bfca533c900/w/37e4e9fbded6346ebfef801a/e/7aef2fcc51d641191a71013f
thanks again!
PS: I should definately look into those ternary conditional variables, seems like a neat trick.
Here is an improvement request that would allow what you are trying to do:
https://forum.onshape.com/discussion/21188/variable-studio-measured-variables#latest
Ternary conditional operators are extremely helpful for creating variable patterns and models. They are a short hand version of the "if then statement" that you can use directly in the Onshape input boxes within features or variables. Here is a quick guide on how to use them:
In this tutorial gif, you can see how to change the quantity of a pattern based on the diameter variable. If the diameter is less than 2in, use qty of 6. If the diameter is not less than 2in, use qty of 4.
Learn more about the Gospel of Christ ( Here )
CADSharp - We make custom features and integrated Onshape apps! Learn How to FeatureScript Here 🔴
very inspriring. thanks!
I'm guessing getting all of the calculations in 1 ternary conditional operator would prove tricky, no?
in the example of the grid:
you have
x number of bars,
x-1 number of spaces between bars.
distance from center tot center between bars = (dimension of bar+ space between)
width(1000)
dimension of bar = (25)
number of spaces between bars = number of bars-1
distance to divide=1000-25=975
minimim distance center-center bar: 100
number of spaces= floor(975/100)=9
number of bars= 9+1
space between bars center-center= (975/9)
so starting from 1000 as a config input, i would need these results (9+1) as a number (number of bars) and (975/9) as a length (step of the lineair pattern) to further use as variable.
does this make sense?
Regards,
Steven
PS i've also tried a workaround (inspired by skeleton modelling in several other CAD programs) where one would use a sketch or "dummy part" (seperate part studio loaded into the assembly) to be used as a skeleton/ framework to create instances of a part or subassembly using the "replicate" command
allthough promising, replicate doesn't take mate connectors or sketch geometry as seed and only works in 1 plane. I guess this could also be used to generate a more complex pattern instead of just linear or circular repetitions.
Yes, this is possible. Before we go further, you need to decide what you want your driving parameter to be. Total width and height, spacing between bars, or bar widths. It can be any 2 combinations of these, but all 3 at the same time will over-constrain unless they are the exact right numbers. I suggest Total width and bar width as the spacing between is easier to adjust than the size of the bars in the real world. Unless you want the total width to be the driving parameter and the spacing between to equal the bar spacing.
Personally, I would throw all of this into a single part studio so I could use more tools: feature variables, pattern along curve, custom features, etc... For me, assemblies are a pain to work with because I want theme to have all the same functionality as a part studio; they are worth it if you need to use the BOM or have large scale projects.
Assuming you want the gaps to be as close as possible to the bar widths, but still vary to fit the over all size of the grid. You can do this which takes advantage of math functions within the feature input box. You could use roundToPrecision() but I used ceil() instead with will round it up to the nearest whole number.
Note I removed all variables in the variable studio except the bar size.
Quantity calculation
ceil(#heightGrid/(#sizeBar*2))
Spacing calculation
(#heightGrid - #sizeBar)/ ((ceil(#heightGrid/(#sizeBar*2)))-1)
Place both of these inside your assembly pattern and you should be good to go.
https://cad.onshape.com/documents/de5523855733346e4095f92d/w/fbf477c3ec61e6d1170b5eb9/e/b...
Learn more about the Gospel of Christ ( Here )
CADSharp - We make custom features and integrated Onshape apps! Learn How to FeatureScript Here 🔴