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.

Suggestions on approach for fully parametric model

eric_schimelpfenigeric_schimelpfenig Member Posts: 75 EDU
Hello all! I'm a new OnShape user, but not so new to CAD.

In the past I've built parametric models in other modelers like Inventor and Fusion. In most of those I load up the model in the beginning with a lot of variables that I want to reference later on as I model each part.

Here's my first "real" OnShape model:

https://cad.onshape.com/documents/43d856d66fd0c29bbe2b8830/w/b501db5c0fb256fbfc1ced5c/e/8f5c282ac7a8fa8ff3ec26f9

This is a dovetailed shipping crate. The idea is that I want to be able to punch in some dimensions and other variables and have a crate built to my exact dimensions on the fly. Thanks to OnShape, it's actually working reliably (not my experience in other modelers)

I did it by drawing all of my parts in this part studio:

https://cad.onshape.com/documents/43d856d66fd0c29bbe2b8830/w/b501db5c0fb256fbfc1ced5c/e/73bb0f71302ddfee1b1bd58f

I just laid them all out flat and drew each one. This was done because it appears that it's the only way to have master variables that every part can reference. As you can see in the timeline all of my variables are first. This is where I go when I'm about to cut out a new crate. Once the model recalculates I can check it in the assembly tab. From there I can email out a drawing if I need and export the STEP files for each part and bring them into my CAM software.

This all works really well, great in fact.... However I can't help but think that my approach might have been a little off... It seems to me that OnShape really wants you to design each part as a separate part file and then combine each part into an assembly. This makes logical sense to me, but where I got a little stuck was on how to reference those master variables that I want.

I'd love to hear from some of you the pros and cons to the approach I took here. I'm about to start building a fully parametric cabinet and I'm going to take the same approach. I'm wondering if I should change before I get too deep on that one.



Best Answer

«1

Answers

  • john_mcclaryjohn_mcclary Member, Developers Posts: 3,936 PRO
    An neat trick to have a global variable list is to create a featurescript, call it globals.
    Inside the script add all your variables and calcs.

    Then in every partstudio you can insert this FS on the top of the tree.

    If you want to override a value Onshape allows you to have multiple variables with the same name, and the next usage will read from the last modified value.


  • brucebartlettbrucebartlett Member, OS Professional, Mentor, User Group Leader Posts: 2,141 PRO
    Did you consider using Configurations?
    Engineer ı Product Designer ı Onshape Consulting Partner
    Twitter: @onshapetricks  & @babart1977   
  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    edited June 2018
    Very nice work so far.

    (a) As  @brucebartlett said definitely configurations next.  This can be added on top of your existing work to save starting over.

    If you've not used them before here is the introduction:-

    (b) My preference would be to model those parts in the same studio (as you have) but to draw them in their assembled positions rather than flat.  This would make it much easier to see if they fit together without errors and would allow them to be dropped into an assembly as a crate.  The only mates required would be a group mate, accomplished with a single "box select" of all the parts

    (b and a half) For the CAM you could either reference off a seperate assembly with the parts laid flat or add an additional configuration along the lines of "Show assembled" or "Show Flat". 

    (c) Do you mind if I plagiarize your work  :p

    Cheers,

    Owen S.
    Business Systems and Configuration Controller
    HWM-Water Ltd
  • eric_schimelpfenigeric_schimelpfenig Member Posts: 75 EDU
    edited June 2018
    @brucebartlett Thanks for the suggestion, I started looking at configurations. I think that's what I'm going to need to implement next. Right now nearly my whole model is driven by those variables. Is it OK to use configurations to drive the variables (which in turn drive the sketches). I'm thinking on my next model I'll start with some configurations up front so I can have less variables (and more powerful configurations) Are configurations limited to the scope of a single part studio? IE I can't have a configuration table that alters multiple part studios, can I?

    @john_mcclary Ok, so there is a way to have global variables. I didn't want to dive into featurescript programming on my first, second or even third time out modeling in a new system. I feel like it's important to really understand the basics before you start programming on top of something. That doesn't look hard though, that being said I'm not the best coder!

    @owen_sparks I'm glad I wasn't too far off in thinking that modeling all of the parts in the same part studio was the way to go. The way I approached the fit problem was to rough in the parts and at a very early stage get them assembled. This was especially helpful as the 6 sided crate only has 4 unique parts so assembling them early on really let me visualize them together. That being said it was a bit of a pain to have to switch back and forth between part studio and assembly. I only recently discovered "edit in context" which is helpful.

    Here's a question for you: There's really not way to "assemble" in part studio is there? Other than referencing sketches and such on op of each other and drawing that way? 

    Also, plagiarize away! This design is a hack I've done on top of someone else's hack :)
  • philip_thomasphilip_thomas Member, Moderator, Onshape Employees, Developers Posts: 1,381
    Carry on - you're all doing fine.
    (love these threads)
    Owen - please tell Eric how Onshape is spelt! :)


    Philip Thomas - Onshape
  • john_mcclaryjohn_mcclary Member, Developers Posts: 3,936 PRO
    lolz
  • eric_schimelpfenigeric_schimelpfenig Member Posts: 75 EDU
    Hey everyone, thank you SO MUCH. I'm going to get into playing with configurations first, and then get into featurescripts second. I feel like featurescript is a huge rabbit hole, one that I want to go down, but I figure I should probably learn configurations fist. 

    I may start on this little 3D printable battery holder I made:

    https://cad.onshape.com/documents/6d302d8e837059f0dee43fb3/w/3cdec4859f17e789b14b3ccc/e/9b56eb5b0750b2c4f9d49fff

    I could put some options in there for battery amount and size (I've already done that, but with variables)


  • eric_schimelpfenigeric_schimelpfenig Member Posts: 75 EDU
    Ok, here's a question for you all:

    I've started playing with configurations.. I wish I knew about these before I got deep into my crate model (and this battery holder). It's exactly what I was looking for: Variables with Min/Max, suppression sets, and table configurations.

    Here's where I'm a little fuzzy:

    I can implement these configurations into my part studio:

    https://cad.onshape.com/documents/43d856d66fd0c29bbe2b8830/w/b501db5c0fb256fbfc1ced5c/e/73bb0f71302ddfee1b1bd58f

    But as you can see, my parts aren't assembled here, they're assembled in an "assembly"

    https://cad.onshape.com/documents/43d856d66fd0c29bbe2b8830/w/b501db5c0fb256fbfc1ced5c/e/8f5c282ac7a8fa8ff3ec26f9

    I did this because it seems like that's what assemblies should be used for... Assembling things :)

    In my part studio it looks like it will be hard/impossible to really assemble the crate like i want, due to lack of joints and such...

    So here's the question about workflow:

    These crates are a base. I often add things to them like latches, feet, handles, and interior padding. It seems to me that the best workflow would be to insert a crate into an assembly, and configure it's dimensions when I drop it into an assembly. From there I could drop in other accessories. The problem is that if I drop it in now, it's flat....

    So am I doing the right workflow here or is there a better way? It seems like I want to be able to do more assembly in part studio...
  • john_mcclaryjohn_mcclary Member, Developers Posts: 3,936 PRO
    Use your assemly to connect your parts. I'd make all the odds and ends in separate part studios. Then add all the parts into the assembly

    You can then use in-context to add your holes for your accessories. 

    You don't want your part studio to have too many features because it becomes harder to edit, and can slow things down. Because it will need to generate the whole studio every edit
  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    edited June 2018
    Hi all, sorry I'm late to the party.

    I'll start with stating that @john_mcclary is a far more experienced engineer than me, with superior design and CAD skills that I'll not get close to matching anytime soon, so by default you should always believe him over me.  That said I'm going to disagree with him here.  :p

    But as you can see, my parts aren't assembled here, they're assembled in an "assembly"
    I did this because it seems like that's what assemblies should be used for... Assembling things :)
    That's not wrong, but it could be more right! Assemblies can indeed be used to assemble things but so can Partstudios.  What assemblies have a monopoly on is movement, ie slider mates and the like.  There is nothing wrong with assembling things in Partstudios, in fact I'd encourage it...

    There are two techniques I'd get to grips with here:-

    (a) Transform by mate connector, this will allow you to snap parts together in a partstudio in much the same way as you do in an  assembly.

    (b) Don't model them flat in the first place! You can place a sketch on any flat surface you care to. (Part, default plane or custom plane).  As such assuming we model the base of the crate first, we can draw the side of the crate on the edge of he base.  This allows us to project the geometry of the base onto the side without having to draw everything from scratch.

    We can then transform them from assembled to flat in a feature we can suppress with a config to get an auto flat pattern...

    So here's the question about workflow:

    These crates are a base. I often add things to them like latches, feet, handles, and interior padding. It seems to me that the best workflow would be to insert a crate into an assembly, and configure it's dimensions when I drop it into an assembly. From there I could drop in other accessories. The problem is that if I drop it in now, it's flat....

    So am I doing the right workflow here or is there a better way? It seems like I want to be able to do more assembly in part studio...
    Yes, I'd do as much as I could in the PS, with the aim of a single group mate being added in the assy just to keep things together.  I'll do an example doc after this post.  (This advice will probably change when we have assembly configurations.)

    So am I doing the right workflow here or is there a better way? It seems like I want to be able to do more assembly in part studio...
    In my mind what you've got is a great start but there are better ways.

     General rules of thumb:-
    (i) This aint SolidWorks so model things that are geometrically related to each other in the same partstudio and in their relative positions.
    (ii) Model extra components that are not related in a new PS (for performance as there is no need to regenerate them each time the model rebuilds)
    (iii) Only model one of each unique part in a PS, add duplicates in the Assy (this way they're seen as instances of the same part not individual parts).

    OK example file on its way later.

    oh and with regard to this:-

    Philip-Thomas:-
    Owen - please tell Eric how Onshape is spelt! 
    I'm soooo torn.  On one hand we have a respected member of the staff of the Software we use, whose time we appreciate, making a perfectly reasonable request.  On the other hand I'm British and genetically programmed take the pi$$ at every available opportunity.  o:)

    So I'll leave the choice up to Erio.  Either bend the knee and conform to "Onshape"  :'( or join the revolution (currently of one) and we'll convert the all the users to the "right thinking, far more mighty sounding OnShape" community.  B) Your call.

    Cheers,

    Owen.
    (Off to draw a box.)
    Business Systems and Configuration Controller
    HWM-Water Ltd
  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    OK I got a little carried away.

    So here is the document;-
    clicky

    The premise is the same, we want a crate, we want to see it either assembled or flat, and we want it parametric.

    Excuse that lack of joints / tabs, this waffle is more concerned with the method rather than the detail.

    (1) It's drawn with the pieces assembled as mentioned in earlier post:


    (2) We can uncheck the "build duplicate parts" to just show unique parts


    (3) We can select the "flat" option to lay all the parts out for cutting. (The spacing shouldn't overlap as it's parametric but the layout isn't intelligent.) 



    (4) We can Add accessories, in this case feet...


    (5)... or Castors


       (6) We can edit the appearance.  

    This is a bit of a workaround.  Configs have a native method to set appearance that is awesome, other than the fact it requires all configurations to be set.  (So if we have variables like our width etc the config has to be set for each value a user might set. )  OS are aware of this and are working on it and such is the calibre of the work they do they supplied a custom feature to use in the mean time, hence the "Set Color" in the tree.

    Continued in new post...  
    Business Systems and Configuration Controller
    HWM-Water Ltd
  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    edited June 2018
    Waffling resumed...

    Now this is where it gets really interesting!! 

    OK, so far we have a nice parametric crate with some extra twidely bits, but if we want to use it we still have to set a bunch of values each time...

    If we have a some favourite settings for this crate we could make duplicates of the tab and leave the options filled in, or remove the variables from the front and have a pick list for the user to select from, but then it's not universal anymore. Meh.

    So, did you know you can configure configurations with configurations? 


    @ilya_baran mentioned this at the beginning and it went straight over my head; only now have I just woken up.

    Let me demonstrate:-
    All the above is in the "universal Crate Builder" partstudio of the sample doc.  Further along is a "Specific Crate Builder" PartStudio.  This has a single derive of one of the crates from the first studio, and it drives the configurations from the first PS from its own Configuration Table.

    The premise is we're doing a bank job, and we want some specific crates for different purposes.
    (1) A suitable size to carry off some gold.
    (2) A smaller portable crate for diamond heists
    (3) Something to transport unconscious security guards.

    (7) We don't want to have to do all that from scratch so let's set up some favourites as configurations:-


    (8) We're nice robbers, we don't want the guard to suffocate, so we can add custom features (in this case air holes) to just one configuration.


    (9) Finally we can drop one of each into an assembly with just a couple of clicks.


    The instance tree is a mess as I've not used sub assemblies.  Ooops.

    Nested configurations are potentially mind-blowing in scope and are hands down my favourite update to OS since it started.  So to any OS folks about a heartfelt thank you for all your inspiration and perspiration.

    @philip_thomas, if you're still lurking on this thread is it possible to derive and configure parts using FS?  Being able to select nothing but a sketch vertex and having a configured part appear from one custom feature would take this to the next level.  (Our own company/user specific version  of standard content if you will.)

    Hope some of that is of interest to folks,

    Cheers,

    Owen Sparks.


    Business Systems and Configuration Controller
    HWM-Water Ltd
  • john_mcclaryjohn_mcclary Member, Developers Posts: 3,936 PRO
    Good stuff @owen_sparks
  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,212
    @owen_sparks
    Take a look at https://cad.onshape.com/FsDoc/library.html#module-instantiator.fs -- it's exactly for bringing in configured part studios via FS.
    We're also working on a FeatureScript-related improvement to make this type of thing even more flexible, but that's as much as I'll say until we release it :smile:
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • eric_schimelpfenigeric_schimelpfenig Member Posts: 75 EDU
    Wow @owen_sparks thanks so much for digging in!

    I'm really torn about the right solution here.... I went back and re-worked my crate so that I had each unique part in a separate part studio. This had the immediate effect of making each part much faster to recalc, and also it's a LOT easier to debug parts as the history is much shorter for each part.

    The downside is that I don't have those universal variables which I know I could do with FeatureScript, but I'm just not there yet on hacking Onshape, I really want to get good at using the "the way it is" first.

    The other very minor downside is that now I have to configure each part as I bring it into an assembly. Not that hard, but still an extra thing I have to do.

    The more I think about this the more I think the ideal solution would be (for me) is this:

    You create all of your parts in separate part studios, but your ASSEMBLY can have variables that you can reference in each part studio. This way when you bring a part into an assembly, it matches up a variable in that part with a variable in your assembly. If you assembly calls for #Width to be 30in, and the part has the same variable but it's currently set to 20in, it would be changed automatically.

    Doing it this way would let me design other parts I could swap in, like a different lid (which I intend to do).

    I'm essentially doing this now, but the variables live in each part, and if I'm not careful they can get out of sync.

    Not to hijack my own conversation, but this is really getting me thinking about the right way to build this in Onshape:

    This is a soundproof phone booth that I built (am building) out of 80/20. The next version is going to be parametric. I'm wondering what would be the best way to approach this one.... There's a lot going on here...


  • john_mcclaryjohn_mcclary Member, Developers Posts: 3,936 PRO
    I made a quick video showing what I mean about featurescript global variables.
    have a look, hope it helps. Sorry for the rambling, I didn't script it out :smile:

    https://www.youtube.com/watch?v=vEGsP-ftDGM&feature=youtu.be
    I just uploaded it and I'm on my way to a ball game, so can't wait to post this when it's done uploading. If you can't see it, give it a minute to process.
  • emagdalenaC2iemagdalenaC2i Member, Developers, Channel partner Posts: 863 ✭✭✭✭✭
    edited June 2018
    @eric_schimelpfenigIf you work a lot with aluminum profiles, you may want to create a macro in FeatureScript like the one we show in this video

    The text and audio are in spanish but i think you can figure it out 
    https://www.youtube.com/watch?v=aCjkPs2fGp0&t=505s
    Un saludo,

    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
  • emagdalenaC2iemagdalenaC2i Member, Developers, Channel partner Posts: 863 ✭✭✭✭✭
    The interesting part of the video starts at 2:00 minutes
    Un saludo,

    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
  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    Nice vid @john_mcclary.  More please 😀
    Business Systems and Configuration Controller
    HWM-Water Ltd
  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    @emagdalenaC2C, wow that's exactly where I wanted to be in a year's time. Excellent work.

    Owen S.
    Business Systems and Configuration Controller
    HWM-Water Ltd
  • emagdalenaC2iemagdalenaC2i Member, Developers, Channel partner Posts: 863 ✭✭✭✭✭
    Thanks
    Actually it is an old FeatureScript (26 feb. 2017) and we will create a new release soon that will include:
    • Add material to all the parts created
    • Add appearance to all the parts created
    • Add custom properties to all the parts (Length of the profiles, etc.)
    • Add a custom part number to all the parts (like profile code + length)
    Un saludo,

    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
  • eric_schimelpfenigeric_schimelpfenig Member Posts: 75 EDU
    Hey all! Sorry for the long delay, I got busy working on some other projects. I did a big update based on what I learned from you all. Rather than type out a big novel, I captured it in this video:

    https://youtu.be/iaCfeuH2TzI
  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    edited June 2018
    @eric_schimelpfenig

    Great video and thanks for the insight into your thought process, interesting stuff.

    When assembly configs are released this will get easier!

    In the mean time:-

    (1)  At the 5 minute mark you talk about "a configuration of a configuration".  This is exactly one of the points I was intending to get across in my post above  :)  It's only for the Partstudio, but in the assembly you then call the "configuration of a configuration" so you drop all the parts in in one go. Demo file above.

    (2) I agree on the simplicity of debug with one part per PS, but fundamentally disagree that this is what OS want you to do. 

    Geometrically related parts in one studio modelled off each other parametrically (for ease), and geometrically unrelated parts modelled separately (for performance) is the message we see from the devs.

    (3) If you have some I'd love to see some photos of the cut parts and have an appreciation of how long they take to cut.  (I'm in the early stages of learning a bit of CNC work.)

    All the best,

    Owen S.
    Business Systems and Configuration Controller
    HWM-Water Ltd
  • eric_schimelpfenigeric_schimelpfenig Member Posts: 75 EDU
    Ok, this is related, but a different project:

    I'm rebuilding this in Onshape:

    http://www.digitallyfabbed.com/#/x-table/



    It's a little more complex than the crate. Basically the way it works is that there are two X's on either side. They're actually made of of 6 parts, 3 of which are unique. (I just laminate and glue them together.

    Then there are three identical horizontal stretchers that are double laminated plywood (two parts mirrored) and there are two stretchers that are underneath the table top.

    I started modeling it here:

    https://cad.onshape.com/documents/c8e505f1a9fd03ee50066c27/v/8b066aeec9a070e09ebfa955/e/c1aa61811a031ea11a0a2413

    Based on what I learned from the crate I followed your suggestion @owen_sparks (And others) in that I modeled the three parts that are unique, copied them and mated them together. This works great and totally makes sense to me.

    Here's what I'm thinking is the right way to go from here:

    Start a new part studio for the horizontal stretchers (the three on the bottom) and model those. Do the same for the top two stretchers, and one for the top. Then assemble it all in an assembly?

    Does that seem like a good approach?

    I can't imagine that making every part in one part studio is the right way to go here...
  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    edited June 2018
    Hi @eric_schimelpfenig

    (1) Great video, thanks very much for putting it up.

    Love the approach.

    I was wondering how you'd set up the 3D toolpath.  I was initially wondering if a 2.5D method would be "less good but good enough", but having recently made the switch myself from Vectric to a certain orange and grey themed bit of software I love what you've done there.  Nice work sir.

    Begs the question though of why not build it parametrically in that other software and have associative toolpaths?

    (2) With regard to the bench.

    Love it.

    Some of the advice on the forum falls under "generally accepted good practice" and other times it's "here's what I like to do based on what I've learned so far".  

    Start a new part studio for the horizontal stretchers (the three on the bottom) and model those. Do the same for the top two stretchers, and one for the top. Then assemble it all in an assembly?
    For me this is exactly how I wouldn't do it.  (So partly personal preference but mostly accepted practice.)  These parts are very much geometrically related.  Tenons, mounting holes, part lengths, all relate to each other so in my mind 100% model them together.

    Here is a dumbed down example:-



    The whole thing is driven by one layout sketch:- 



    If we change the sketch all the parts rebuild in one go.

    Here we have a depth of cut into the stringer driven by how thick the existing leg is using "up to face".  Sure we could set up a variable, frig it to be global and design in an empty studio but that's waaaay harder and way more likely to introduce a numpty error if we forget to transfer a change to the other part.



    Here we're creating a countersunk hole in the leg and a pilot hole in the stretcher in one feature, and driven from one sketch point:-



    When projects get more complicated then by all means split them up, but for something with a low face count (simple extrusions like this) then I'd have no reservations about having a feature tree with 100 features generating 50 parts in one studio.

    Add some configurations and we're really cookin'

    Hope some of that is of interest,

    Owen S.


    Business Systems and Configuration Controller
    HWM-Water Ltd
  • eric_schimelpfenigeric_schimelpfenig Member Posts: 75 EDU
    In this example it's simple and I totally get what you're saying. The real X legs, just the two legs themselves are 39 features. So far one stretcher is 26.

    So I sorta did what you said but in a different way...

    What I did was draw the X legs in one part studio and assembled them. Then for that stretcher that you drew I just used the sketch from the X legs that has the slots in a new part studio (IE I referenced the sketch from the original X legs). Now the two part studios are geometrically related and react to one another but to me it's a bit cleaner.

    Where this is going to fall off the rails a tiny bit is that I'm still going to have to marry all of these parts back together as one model. I'm thinking I'll do that in an assembly. I will have to alter some variables across a few part studios to work together though...
  • eric_schimelpfenigeric_schimelpfenig Member Posts: 75 EDU
    edited June 2018
    Ok, I've had some time to fool with this more and I think I'm honing in on a good workflow here:

    https://cad.onshape.com/documents/c8e505f1a9fd03ee50066c27/w/f7f3d2dbcefb2407d741fc15/e/0c3c739c3cb1644ea30ba4c5

    If you check the "Master Parts" tab I'm modeling all of the parts in context so that they have geometric relation to one another. There's lots of copies of parts that go into the "real" model so I'm just doing one of each in this part studio.

    An example is that X leg. It's 3 unique parts, but it takes 6 parts total to make one leg. So what I'm doing is taking those parts for the X leg and making an assembly with them. I'm doing the same with the stretcher which is just two of the same part glued together. That stretcher is also an assembly.

    Then, in the "master assembly" tab I'm marrying all of the sun assemblies together.

    So far this seems to be working really well. It's not an obvious workflow at first, but it's working now. I've got more work to do to this table, I'll post if anyone wants to see when it's done.

    I think this is the "right" way to do this. As someone who's an avid SketchUp user, I can't help but think that mashing up Part Studio and Assembly into one tab would be awesome.. But, I'm trying to learn the right way to do it here before I go re-inventing a product :)
  • philip_thomasphilip_thomas Member, Moderator, Onshape Employees, Developers Posts: 1,381
    Philip Thomas - Onshape
Sign In or Register to comment.