Asking for a tutorial: Snap-fit electronics enclosure

A place to share learning material: written tutorials, videos, etc.
probono
Posts: 42
Joined: Wed Dec 28, 2016 10:16 pm

Asking for a tutorial: Snap-fit electronics enclosure

Postby probono » Sat Aug 05, 2017 1:05 am

I hope I am allowed to ask for a tutorial, which I think could become a "killer application" for FreeCAD for many 3D printer owners: Snap-fit electronics enclosures. At the same time this would provide an exellent learning opportunity for new FreeCAD users, and a comparison for how to achieve the same result as with another commonly used application, Fusion 360, with FreeCAD.

I found this execllent three-part tutorial which almost made me switch to Fusion 360 but I really want to use FreeCAD: Would someone be willing to "transcribe" this 1:1 into FreeCAD, i.e., show all the exact steps for FreeCAD in a YouTube video? I might then even write it up like in the tutorial above for it to be linked in the FreeCAD documentation.
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Asking for a tutorial: Snap-fit electronics enclosure

Postby NormandC » Sat Aug 05, 2017 1:49 am

Hello probono,
probono wrote: Sat Aug 05, 2017 1:05 am I hope I am allowed to ask for a tutorial
I would say of course!

This is an amazing series of tutorials. Actually the whole knowledge base looks impressive (of course it will take me some time to go through all of it). I bookmarked the 3D Hubs website a couple of years ago, they didn't have this material back then.

This is most certainly a project to be done using the PartDesign workbench. Those who are interested in creating videos using mainly that workbench (I'm counting myself in that group) are facing a dilemma: 0.17 brings unprecedented changes to the PartDesign workbench. But it is not quite ready to be released yet. So what version to use, the current 0.16 release or 0.17? I would tend to wait for the 0.17 release as the changes will be very beneficial to enclosure design. Quite honestly, the more I test 0.17-dev and the less I'm interested in continuing to use 0.16.

On the other hand, this video of an Arduino enclosure was made in 0.16.

phpBB [video]
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Asking for a tutorial: Snap-fit electronics enclosure

Postby NormandC » Sat Aug 05, 2017 2:36 am

I've now gone through the three-part tutorial. I have to say that Fusion seems to have very nice tools and a simple work flow.

I don't see any major problems doing the same thing in FreeCAD, specifically in 0.17 (although I'm not completely sure how rotating/moving the top body to add the live hinge should be dealt with). But it might be slightly more involved than in Fusion. There are 3 things that Fusion has and FreeCAD doesn't that stand out:

  • External geometry can be used directly in sketches. I'll admit this is something that I miss a lot in FreeCAD.
  • The mid-plane tool automatically placed between two selected faces. Very nice tool.
  • Pattern along a path. Actually it's not exactly true: the PartDesign workbench does not have this feature, but the Draft workbench has something similar, Draft PathArray.
I noticed that the author applies 3D fillets and chamfers very early in his design, which is not considered good practice in most parametric CAD programs. They should usually be done last.

For now, I'm not saying "dibs" just yet. ;) (My immediate plan is updating the PartDesign Bearingholder Tutorial I which is extremely outdated).
probono
Posts: 42
Joined: Wed Dec 28, 2016 10:16 pm

Re: Asking for a tutorial: Snap-fit electronics enclosure

Postby probono » Sat Aug 05, 2017 12:31 pm

Thanks NormandC for your analyis. It would be awesome to see a tutorial like https://www.freecadweb.org/wiki/PartDes ... torial%20I but for the Snap-fit electronics enclosure I have posted. I'd say, let's go for 0.17 directly and mention it in the beginning.

I really think a lot can be learned from comparing how to do this design in different applications.
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Asking for a tutorial: Snap-fit electronics enclosure

Postby NormandC » Sun Aug 06, 2017 5:45 am

I didn't want to go to bed just yet so... :D
FC017_3DHubs_ElectronicsEnclosure_01.png
FC017_3DHubs_ElectronicsEnclosure_01.png (66.98 KiB) Viewed 7705 times
It's not finished yet!
probono
Posts: 42
Joined: Wed Dec 28, 2016 10:16 pm

Re: Asking for a tutorial: Snap-fit electronics enclosure

Postby probono » Sun Aug 06, 2017 9:03 am

You are the man... can't wait to learn the steps :D thank you so much.
peterl94
Posts: 1001
Joined: Thu May 23, 2013 7:31 pm
Location: United States

Re: Asking for a tutorial: Snap-fit electronics enclosure

Postby peterl94 » Sun Aug 06, 2017 12:34 pm

Looking forward to see how you modeled this! I completed the first tutorial, but it was rather time consuming due to not being able to offset sketches. I see "pipe" features in your tree, so maybe you avoided that issue. Also, for the two enclosure halves, I ended up putting the fillets in the profile sketch and then padding the sketch in two bodies. Is that how you did it too?
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Asking for a tutorial: Snap-fit electronics enclosure

Postby NormandC » Sun Aug 06, 2017 7:37 pm

peterl94 wrote: Sun Aug 06, 2017 12:34 pm it was rather time consuming due to not being able to offset sketches. I see "pipe" features in your tree, so maybe you avoided that issue.
You assume right. Since there is no offset tool in the Sketcher, I decided to use additive and subtractive pipe (sweep) features instead. But in doing so I encountered two bugs.
  1. The PartDesign pipe tools fail if the selected path forms an enclosed profile (in this case I selected the outer perimeter edges of the body - I had to select the edges one by one which is tedious, but not as much as manually creating an offset sketch!). Oddly, there is no problem with a Part Sweep (but then we leave the PartDesign workbench, which I didn't want to). So I had to create an incomplete sweep:
    FC017_ElectEncl_sweep_01.png
    FC017_ElectEncl_sweep_01.png (14.89 KiB) Viewed 7633 times
  2. Working around the first bug made me discover a second. To close the sweep, I created a second sweep, by first selecting the end face of the first sweep; then selecting the round corner edge as path. All went well, this closed the lip. But then I noticed in the Model tree that the second AdditivePipe001 had claimed the first AdditivePipe as child; and I realized that the first AdditivePipe had claimed Pocket, the feature preceding it in the tree, as child as well:
    FC017_ElectEncl_sweep_02.png
    FC017_ElectEncl_sweep_02.png (15.72 KiB) Viewed 7633 times
    This does not conform to the PartDesign ordering scheme which should list all features in a linear manner; only sketches or likewise 2D geometry (Draft objects!) should be claimed as children.
peterl94 wrote: Sun Aug 06, 2017 12:34 pm Also, for the two enclosure halves, I ended up putting the fillets in the profile sketch and then padding the sketch in two bodies. Is that how you did it too?
Yes. I originally started with a sketch similar to the tutorial, then added 3D fillets; but then I created the second Body (BottomEnclosure), and I tried to pad a ShapeBinder made from the top face of the TopEnclosure; it didn't work, ShapeBinder faces are not recognized as 2D profile (I believe @ickby mentioned he's thinking about allowing it which would be very useful!). One useful sketch tool is the new CarbonCopy, which duplicates an external sketch with all constraints; if you do not edit it, it remains linked to the original. Is that what you used? Of course, with the original sketch sans fillets, you end up having to add 3D fillet features to the second body.

I already mentioned that I think doing 3D fillet features early in a design is bad practice, so these sketching issues gave me the final motivation to go back and add fillets directly in the sketch. To be able to constrain the sketch as in the 3D Hubs tutorial, I added 3 construction points circled black in the capture below. These points are constrained to where lines should actually connect if no fillet were present.
FC017_ElectEncl_sketch_01.png
FC017_ElectEncl_sketch_01.png (34.36 KiB) Viewed 7633 times

Constraining such a sketch is a little tricky, in my first try I ended up with a fully constrained sketch but with no way to set the radii of the 4 largest fillets. I may have forgotten to delete some other constraint, I was pretty tired last night. It's probably less problematic if you start from scratch than if you modify an already fully-constrained sketch while being sleep-deprived. :D The trick is to add radius constraints to all fillets early on.

I think it's very useful to make such an exercise in 0.17-dev. From this experience, I plan on creating at least 2 feature requests as well as 2 bug reports on the bug tracker.
peterl94
Posts: 1001
Joined: Thu May 23, 2013 7:31 pm
Location: United States

Re: Asking for a tutorial: Snap-fit electronics enclosure

Postby peterl94 » Sun Aug 06, 2017 9:32 pm

NormandC wrote: Sun Aug 06, 2017 7:37 pm One useful sketch tool is the new CarbonCopy, which duplicates an external sketch with all constraints; if you do not edit it, it remains linked to the original. Is that what you used?
No, I didn't know the dimensions were linked. I enabled the "allow features from another body in the same part" and "create cross-reference" options of the pad feature (both bodies were in a Part). I'm not sure if such cross-references cause problems.
NormandC wrote: Sun Aug 06, 2017 7:37 pm Constraining such a sketch is a little tricky
Yeah, my problem was I kept on getting an unmovable sketch that showed 1 degree of freedom, but I discovered it was because I had used too many symmetric constraints. I ended up constraining it almost exactly the same as you.
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Asking for a tutorial: Snap-fit electronics enclosure

Postby NormandC » Sun Aug 06, 2017 9:45 pm

peterl94 wrote: Sun Aug 06, 2017 9:32 pm I enabled the "allow features from another body in the same part" and "create cross-reference" options of the pad feature (both bodies were in a Part).
I didn't think of that. I didn't create a Part container either. I don't like to add a supplementary level of hierarchy if I can avoid it.

BTW since the original sketch was in another Body, the CarbonCopy would not detect it inside the new sketch, and a "forbidden" symbol would show in place of the mouse pointer when I hovered over a sketch element. But when pressing the CTRL key, you can select a sketch from an exterior body.
peterl94 wrote: Sun Aug 06, 2017 9:32 pm I kept on getting an unmovable sketch that showed 1 degree of freedom, but I discovered it was because I had used too many symmetric constraints.
A thing I recently came to believe is that the actual problem may not be too much use of symmetric constraints, but the fact that the solver does not reliably detect conflicting constraints where symmetric constraints are concerned. I haven't thoroughly tested this, but I believe that you can use as many symmetric constraints as you want if you ensure there are no conflicting constraint by manually deleting them.

Here's one example: create a symmetric constraint between the end points of a horizontal line (a line with an existing horizontal constraint) and the vertical sketch axis. In such a situation, the horizontal constraint becomes a redundant/conflicting constraint, since the symmetric constraint itself ensures horizontality. Yet, the solver does not alert to the redundancy.