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.
If based Look Up Tables For Configurations
Michael_Ursuliak
Member Posts: 14 ✭
Configurations are powerful and are able to make it very easy to grab a specific part and insert it into your assembly.
However as of right now i think that some improvements can be made in regards to parts that have multiple part numbers and configs.
For example I have a wire duct part that comes in a verity of height width and length combinations.
Too many combinations to put into a single config list. instead i have 3 config inputs. Height, Width, and Length.
Having 3 entries makes it much easier to create your specific part.
However in this method there is no way to attach part numbers to the configured parts.
I propose a logic based Look up table.
for example, if Config input 1 == 1" & Config input == 1.5" & Config input 3 > 5" & Config input 3 < 2" then part number = 12345
Using logic would allow for lots of part numbers to be dynamically addressed based on the users needs.
If i need 7" of wire duct but the wire duct stock only comes in 5" and 10" then i would need the 10" stock number but still use the 7" part in my model.
However as of right now i think that some improvements can be made in regards to parts that have multiple part numbers and configs.
For example I have a wire duct part that comes in a verity of height width and length combinations.
Too many combinations to put into a single config list. instead i have 3 config inputs. Height, Width, and Length.
Having 3 entries makes it much easier to create your specific part.
However in this method there is no way to attach part numbers to the configured parts.
I propose a logic based Look up table.
for example, if Config input 1 == 1" & Config input == 1.5" & Config input 3 > 5" & Config input 3 < 2" then part number = 12345
Using logic would allow for lots of part numbers to be dynamically addressed based on the users needs.
If i need 7" of wire duct but the wire duct stock only comes in 5" and 10" then i would need the 10" stock number but still use the 7" part in my model.
1
Comments
Or if you wanted to you could build that into your code itself. It's worth noting that you can grab any configuration parameters with the getVariable() function. I would personally recommend putting a try silent around that though, since you might not want your feature breaking if it can't find a specific configuration variable.
chadstoltzfus@premiercb.com
I was modeling a configured torsion spring with various parameters including a left-handed and right-handed version of each. I was referencing a McMaster part number, so the LH and RH springs should have different part numbers even if all other specs are the same. What I was looking for could be represented well with a 2-dimensional matrix, like this:
So I ended up making a List Config for the Spring Specs and a Boolean Config for the LH/RH. The LH/RH button controlled a variable called #isRightHanded which is set to 0 or 1, which I used to access two lists of part numbers stored in a nested array, like this
#partNumber = [[9271K223, 9271K355, 9271K403],[9271K224, 9271K384, 9271K446]][#isRightHanded][#listIndex]
This has two lists of part numbers, one for LH, and one for RH. #isRightHanded chooses whether to look at the first or second list (array) of part numbers, and #listIndex, picks which part number to use from that list.I'm trying to figure out what the logic would look like for a table of 150+ part numbers with 3 different configuration variables. Using if - else statements isn't a good option - as the code would wind up being very long.