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.
New FeatureScripts - Variable Suite and Plate Suite
Alex_Kempen
Member Posts: 248 EDU
in General
Hello all,
I'm extremely happy to be finally sharing my latest and greatest FeatureScript projects. Earlier, less complete versions of each of these were demoed at the Onshape workshop in early August - the fully finished versions are now public and available for use.
Variable Suite
https://cad.onshape.com/documents/d33530b06909083111cf1770/w/5be0429e68b3332e158a3559/e/963c20a96586623733457a41
Variable Library
The variable library feature makes it possible to quickly import variables from one part studio to another. This makes it easier than ever to set and use global variables without having to mess around with feature studios or code. It can be used to build large libraries of variables which can be used by your entire team, or to quickly define a few variables which can then be parametrically used across several part studios in a project.
Variable Hole
The variable hole feature utilizes variables to transfer entire hole definitions. This makes it possible to create variables which can then be used to instantly define an entire hole, including information like counterbore/countersink, standard, hole type, tap size/depth, and so on. And thanks to my variable library feature, it's easy to setup and use these variables across an entire project or organization.
Variable Properties
Variable Properties behaves similarly to the Variable Hole feature, making it possible to create variables which can be used to quickly define part color and material type.
Plate Suite
https://cad.onshape.com/documents/2c2b49357f3f1a232881256a/w/6258e1943ecedc8606542dd7/e/68778048129306d291c7bb9c
Plate Extrude
The plate extrude feature allows users to quickly extrude flat geometry. The plate extrude feature can be used as a standalone feature, or it can be used in conjunction with other plate features. Useful options include the ability to select a plate plane to extrude off of, symmetric up to behavior, and the ability to extrude adjacent faces as separate parts.
Plate Tab
The plate tab feature serves as an alternative to the plate extrude feature which creates plates centered around single holes. This can be used to create tabs which connect to existing geometry, or to quickly create simple linkages from scratch. Useful options include the ability to use variables from the variable hole feature, as well as the ability to define start and end conditions for tabs.
Plate Hole
The plate hole feature can be used to quickly add holes to plates created by a plate extrude or plate tab feature. Holes can be defined manually or using a hole variable created by a variable hole feature. Useful options include being able to arbitrarily flip the side of the plate holes originate from, the ability to quickly add holes to existing features, and the ability to add new geometry to existing plates without interfering with any existing geometry.
Plate Fillet
The plate fillet feature makes it easy to quickly fillet plates. Useful options include the ability to fillet an entire plate at once, the ability to select faces and edges to exclude, and the ability to add full round fillets to the sides of plates with a single click.
Oh, and for those curious, here are some stats:
21 different feature studios
~50 unique custom error messages
~3,800 lines of code
~way to much of my free time
Thanks for reading, and I hope you find them useful!
Alex Kempen
I'm extremely happy to be finally sharing my latest and greatest FeatureScript projects. Earlier, less complete versions of each of these were demoed at the Onshape workshop in early August - the fully finished versions are now public and available for use.
Variable Suite
https://cad.onshape.com/documents/d33530b06909083111cf1770/w/5be0429e68b3332e158a3559/e/963c20a96586623733457a41
Variable Library
The variable library feature makes it possible to quickly import variables from one part studio to another. This makes it easier than ever to set and use global variables without having to mess around with feature studios or code. It can be used to build large libraries of variables which can be used by your entire team, or to quickly define a few variables which can then be parametrically used across several part studios in a project.
Variable Hole
The variable hole feature utilizes variables to transfer entire hole definitions. This makes it possible to create variables which can then be used to instantly define an entire hole, including information like counterbore/countersink, standard, hole type, tap size/depth, and so on. And thanks to my variable library feature, it's easy to setup and use these variables across an entire project or organization.
Variable Properties
Variable Properties behaves similarly to the Variable Hole feature, making it possible to create variables which can be used to quickly define part color and material type.
Plate Suite
https://cad.onshape.com/documents/2c2b49357f3f1a232881256a/w/6258e1943ecedc8606542dd7/e/68778048129306d291c7bb9c
Plate Extrude
The plate extrude feature allows users to quickly extrude flat geometry. The plate extrude feature can be used as a standalone feature, or it can be used in conjunction with other plate features. Useful options include the ability to select a plate plane to extrude off of, symmetric up to behavior, and the ability to extrude adjacent faces as separate parts.
Plate Tab
The plate tab feature serves as an alternative to the plate extrude feature which creates plates centered around single holes. This can be used to create tabs which connect to existing geometry, or to quickly create simple linkages from scratch. Useful options include the ability to use variables from the variable hole feature, as well as the ability to define start and end conditions for tabs.
Plate Hole
The plate hole feature can be used to quickly add holes to plates created by a plate extrude or plate tab feature. Holes can be defined manually or using a hole variable created by a variable hole feature. Useful options include being able to arbitrarily flip the side of the plate holes originate from, the ability to quickly add holes to existing features, and the ability to add new geometry to existing plates without interfering with any existing geometry.
Plate Fillet
The plate fillet feature makes it easy to quickly fillet plates. Useful options include the ability to fillet an entire plate at once, the ability to select faces and edges to exclude, and the ability to add full round fillets to the sides of plates with a single click.
Oh, and for those curious, here are some stats:
21 different feature studios
~50 unique custom error messages
~3,800 lines of code
~way to much of my free time
Thanks for reading, and I hope you find them useful!
Alex Kempen
CS Student at UT Dallas
Alex.Kempen@utdallas.edu
Check out my FeatureScripts here:
Tagged:
6
Comments
Variable library is pretty outside the box
Learn more about the Gospel of Christ ( Here )
CADSharp - We make custom features and integrated Onshape apps! Learn How to FeatureScript Here 🔴
If instead of having one feature, the user were to create variables using our variable feature and your custom features would create the cube and import all the variables (getting them using the getAllVariables function), you'd have two benefits: editing the variables via the variable table and being able to configure the part studio and configure the variable values. That would let the user set up a configured design, consisting of multiple part studios, controlled by a single configured set of variables.
Learn more about the Gospel of Christ ( Here )
CADSharp - We make custom features and integrated Onshape apps! Learn How to FeatureScript Here 🔴
Learn more about the Gospel of Christ ( Here )
CADSharp - We make custom features and integrated Onshape apps! Learn How to FeatureScript Here 🔴
You launched them! I'm excited to use them. Thanks
I also experimented with a version which allows users to cache variables to a hidden parameter. This has the benefit of allowing users to then suppress any created variables (since their values are now saved inside a hidden parameter directly), resulting in marginally better performance. However, this breaks my other variable features since types don't behave as expected when added to a parameter using editing logic, which seems like a bug. Type casting custom types (such as enums) inside editing logic also doesn't seem to work, which is rather strange.
Learn more about the Gospel of Christ ( Here )
CADSharp - We make custom features and integrated Onshape apps! Learn How to FeatureScript Here 🔴
The problem is that the hole variable definition requires you to define the end type, and if I attempt to define a through-hole variable but then override it to be blind, it also overrides all the custom dimensions I dropped in. Looks like this might be because you're using the official hole feature lookup tables? I'd prefer the hole definition to by default not allow changes to the shape, but allow changes to end conditions; if you're overriding more than that you really should be using a different hole variable, in my opinion. I'd approach this by defining a local input for end type and depth, then merging that into the hole variable. I can probably make a "pull request" on my copy by the weekend if that helps.
Also, trying to define a countersunk blind hole variable throws an error for me, though simple and counterbored blind holes work fine. I think definition.useTipDepth on line 100 of variableHole.fs isn't being set, and your 50 error messages didn't catch it
PhD, Mechanical Engineering, Stanford University
I'm surprised the hole editing logic is overriding your custom input parameters since the passed in lookup table should be set to custom, which should prevent any of the fields from being overridden. If the standard table of the hole variable is not custom, then it doesn't surprise me if it does override your fields to enforce whatever standard was selected.
I was moderately aware of the hole depth problem, but I didn't try to implement any sort of solution for it since the scope quickly expands once you start trying to figure out what to define locally vs globally. I agree that setting the end condition locally makes sense, but it gets murky when you consider that blind in last is an end condition option. I could use advanced conditional visibility to make the local depth options appear/disappear if blind in last is enabled in the hole variable, but that's been something I've been trying to actively avoid with the hole variable feature since it can cause weird things when the underlying variable is changed. It's also annoying for tapped holes since the tapped conditions might also need to update based on the chosen depth, and even setting them so they can be enabled is weird due to the default visibility settings of the hole feature. Accordingly, I'm definitely open to something like you've proposed, but I'm not sure there's a good solution that works well for it.
I'm wondering if one could make a "hole library" feature that assembles a lookup table from hole variables defined in the part studio, then when using the hole variables you just choose to use your alternate lookup table instead of the standard Onshape hole table.
PhD, Mechanical Engineering, Stanford University
In regards to the issue you've been having, I think I've successfully added a fix. Basically, it now updates the oldDefinition to keep the hole table standardization logic from triggering and overriding stuff unnecessarily. I'll need to do some further testing, but it should be in the next update alongside some other cool stuff I've been tinkering with.
Thanks for the responsiveness, looking forward to that update!
PhD, Mechanical Engineering, Stanford University
The automated option is very nice!
Of course, it was an expensive use. I traced several trim profiles, measured, then grabbed the measurements with the library feature. I'm not sure of a better way to do something like that without it creating a small derive chain, especially if I want the profiles to be sketch driven instead of variable driven.
Learn more about the Gospel of Christ ( Here )
CADSharp - We make custom features and integrated Onshape apps! Learn How to FeatureScript Here 🔴
I've just pushed an update to my Variable library feature which adds a bit of new functionality. Notably, it is now once again possible to import variables from CSV files. There is also now an option to add descriptions to variables when they are being created. These descriptions can be seen in studios which are using said variables via a custom table feature.
A template sheet which can be used to generate a valid CSV file for importing variables can be found here:
https://docs.google.com/spreadsheets/d/1k5xZ5Lqxz4xRqVlRQ4j5USSUi_MWBjeumz-F2teNtok/edit#gid=0
Note that importing from a CSV file can be somewhat finicky - variables must have unique names and should always start in the leftmost column.
You can find my variable suite here:
https://cad.onshape.com/documents/d33530b06909083111cf1770/w/5be0429e68b3332e158a3559/e/d329c12b1b5b5ddb643bccc2
As always, I hope you find these features useful!