Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

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.

How to create multiple versions of a design based on different variable values?

I've designed a simple filament spool adapter, to allow spools of different brands to rotate smoothly on a standard rod. The two main variables here are `#axisD` and `#spoolD`, the diameters of the rod and the hole in the spool respectively.

I want to create different versions of this for differently sized spools, defined by taking different values for those variables. I guess what I want is to create a parametric subroutine.

I couldn't find a way to do this with the standard OnShape features. Am I missing something? Is this perhaps something featurescript can do?

Thanks!

Best Answer

Answers

  • joe_dunnejoe_dunne Onshape Employees, Developers Posts: 152
    I am pretty sure what you are looking to do, would work as a branch. Each branch will allow you to store different values independently.

    Joe Dunne / Onshape, Inc.
  • shashank_aaryashashank_aarya Member Posts: 265 ✭✭✭
    See the below link for versioning and branching information
    https://cad.onshape.com/help/#versionmanager.htm#kanchor233
    It will help you to create different versions for different configurations. Versions are created as read only as they indicate that the variant of design is final. You can create different workspaces from versions to create editable variants.
    Here are the videos showing how versioning and branching works 
    https://www.onshape.com/videos/creating-versions 
    https://www.onshape.com/videos/branching
    https://www.onshape.com/videos/merging-branches
  • michiel_helvensteijnmichiel_helvensteijn Member Posts: 5 EDU
    edited December 2016
    joe_dunne said:
    I am pretty sure what you are looking to do, would work as a branch. Each branch will allow you to store different values independently.
    See the below link for versioning and branching information
    To clarify: I'm not talking about branching and/or versioning. Branched designs would be disconnected from changes to the original. (I suppose my use of the word 'version' was confusing.)

    I want to have a single place with the fundamental design, containing two parameters (or something like parameters). I would create variants based on different parameter values. Then, if I make changes to the fundamental design, those changes should automatically propagate to all variants. Like I said: a parametric subroutine / procedure / method / function, like in a programming language (which is why I suspect that featurescript might help).

    It would be similar to using a 'Derived' part: changes to the original part propagate to the derived one. A derived part can even be transformed afterwards, and still adapt to changes made to the original. I guess what I want is a 'Derived' feature with parameters that retroactively reassign variable values (or something equivalent).
  • chris_8chris_8 OS Professional Posts: 101 PRO
    See the below link for versioning and branching information
    https://cad.onshape.com/help/#versionmanager.htm#kanchor233
    It will help you to create different versions for different configurations. Versions are created as read only as they indicate that the variant of design is final. You can create different workspaces from versions to create editable variants.
    Here are the videos showing how versioning and branching works 
    https://www.onshape.com/videos/creating-versions 
    https://www.onshape.com/videos/branching
    https://www.onshape.com/videos/merging-branches
    I've read through all those descriptions, and I've been using OS for a couple years now.   Still versioning and branching are not understandable by me.  I'd like branches that I can edit without need to navigate to other workspaces.

    Maybe Versioning and Branching the way OS intends it is needed by some people.   Maybe what I'm imagining as a useful versioning tool would instead create splits in the live feature tree, instead of duplicating entire workspaces.
  • michiel_helvensteijnmichiel_helvensteijn Member Posts: 5 EDU
    mahir said:
    What you want is configurations. Unfortunately, Onshape does not support configurations yet, but you can do something similar by using arrays as variables. Check out the link for a simple example. Changing just the #Config variable to either 0, 1, or 2 will change how the rest of the part studio generates because a different OD and ID will be used.
    Ah. A very useful trick to know, thanks! It will help with my example problem, at least.

    I'm not sure if what you call 'configurations' is what I'm actually talking about though. With the array trick we can still not have multiple variants of an object coexist at the same time.
  • joe_dunnejoe_dunne Onshape Employees, Developers Posts: 152
    You can have different branches of a design referenced into a single assembly at the same time. 

    So if your problem can be represented as separate branches, it would seem to solve your problem?   If you are looking at how to propagate changes to multiple branches.  Consider Merge. 

    Let's say you had 2 branches that were similar, other than a few variable values. Then you wanted to add/remove/edit  features that would "ripple" through both branches.  You can do this by editing one of the branches and making the changes you require. Then use Merge to push those edits into the other branch. Its a manual process. 

    I think the question is how many variations you have. If you only have a few, then branching/merging is a decent workflow. If you have 100s of variation then a table driven approach seems more appropriate.  In SolidWorks this is called table driven configurations. I think it's safe to assume solving this problem is a high priority for Onshape as well. 

    Also I have seen several table driven approaches being tackled using a combination of SwiftCalcs and Onshape together. A SwiftCalc sheet can drive Onshape variables.



    Joe





    Joe Dunne / Onshape, Inc.
  • michiel_helvensteijnmichiel_helvensteijn Member Posts: 5 EDU
    edited December 2016
    joe_dunne said:
    You can have different branches of a design referenced into a single assembly at the same time. 
    Aha. I didn't realize that. And for 'Derived' too, I see. Good to know.
    So if your problem can be represented as separate branches, it would seem to solve your problem?   If you are looking at how to propagate changes to multiple branches.  Consider Merge. 
    ...
    Right. I guess that's indeed the best way to go for now. At least until OnShape improves on this front. I work with git on a daily basis, so I'm not unfamiliar with merge. It's the ability to reference branches in assemblies and derived's that makes this solution feasible.
    I think the question is how many variations you have. If you only have a few, then branching/merging is a decent workflow. If you have 100s of variation then a table driven approach seems more appropriate. In SolidWorks this is called table driven configurations. I think it's safe to assume solving this problem is a high priority for Onshape as well. 
    I see what you mean. That's more or less what I'm after, although for most purposes an actual table would be overkill, and a barrier to use. Instead, I would advocate some simple programming languages constructs on the same level of complexity as variables.

    In this case: Introduce a 'Parameter' feature, which is just a different kind of variable. When the user inserts a part into an assembly, or uses 'Derived' in a part studio, just prompt them for the values of the those parameters. (This could also take the form of a simple checkbox in the Variable dialog.)

    Given the features OnShape already supports, this must be easy enough to implement. It may even be doable with featurescript already, but I haven't looked into featurescript yet.
Sign In or Register to comment.