Mechanical Interface (Envelope) Drawing

Played around a little to make a simple mechanical drawing for folks making planks and other accessories. There are ways to import OpenSCAD into FreeCad, for example, but that looks too hard (for me). Next approach was to make the XY plane projection in the SCAD file, then export that as a DXF. This worked pretty well (you have to export using the GUI menu after rendering).

module project() {
  projection() 
    translate([0,0,10])
      children();
}

// print_3d();
//case_top();
//case_bottom();
display_together();

// tests to make 2D XY DXF file:
//project() { case_top(); }
//project() { case_bottom(); }

I was planning to use something like QCAD or LibreCAD to make the dimensions, but decided it would be easier to just use KiCad (I think). For one, some of the key features you’d need specified (like Pin 1 of the connectors) isn’t specified in SCAD. So added a couple layers User.1 and User.2 to the board stack and made a first attempt, to see how it works.

It’s not too bad, although there are still some shortcomings about dimensions in KiCad, especially the lack of bulk editing of certain parameters (like # decimals of precision). Some can me bulk edited, like font size and style.

But then I realized, you guys are about to make a new, final, case design. That would render this whole exercise pointless. So for now, I’m just going to toss this out there as a concept and once the dust has settled a “final” envelope drawing can be wrapped up.

BTW, I think it would be helpful to put a reference point in the OpenSCAD file that corresponds to a reference in the KiCad file. I did some eyeballing trying to line the imported DXF file up with the PCB design, so it’s not going to be perfect.

3 Likes

By the way, I got a chuckle out of the SCAD variable name butt_hole.

2 Likes

You might want to mention that BOSL2 is a prerequisite for running the SCAD files.

2 Likes

Nice work!

I feel like something is mirrored or 90 degrees. T he programming header should be opposite the 10P, and the bootloader button should more or less be centered under the “top” of the display.

1 Like

You’re correct. I didn’t realize the rotation until I imported the top DXF and realized I had to rotate it. The bottom DXF I didn’t go back and rotate. I think I’ll do the rotations and offsets in OpenScad so that it exactly matches KiCad and there is no need to move / rotate. Right now I was indexing off the holes which seems like reasonable datum.

Your team works in mm, correct? I hope so :sunglasses:

Yes, except trace sizes I guess.

2 Likes

Okay, so I figured out the desired link between SCAD and KiCad designs. More on that later. I was fat, dumb, and happy, not necessarily in that order. Then I decided to do just “one last thing”… add the side views to show the USB and AUX connector details, and I got confused.

The side projections I was making in SCAD just didn’t match what I was holding in my hand. Then it finally hit me, maybe the enclosure I have is an older or newer version than the SCAD file I’m using.

BusPirate5REV10-v0.scad
BusPirate5REV8-v10.scad

I had assumed my enclosure was the rev10-v0 flavor, based only on the fact that I remember using rev 10 when building firmware. In hindsight, that was probably a faulty conclusion.

My enclosure is a semi-translucent white color. The conflicting feature that jumps out at me are the sidewalls of the enclosure. The walls of the physical enclosure in my hand are flat, with chamfers on the top and bottom. The SCAD design (both rev10-v0 and rev8-v10) appears to have flat sides, but recessed. I say “appear” because there’s a chance I’m doing something wrong in SCAD.

1 Like

the scad render looks like the chamfers are using negative values, thus the weird behavior?

2 Likes

Doh! I think this has come up before. It is an OpenSCAD version or BOSLII version issue. Early on someone asked me to fix it for their (older) version of OpenSCAD and I sad no, which I rarely do.

My versions:

  • OpenSCAD: 2021.01
  • BOSLII: master @ ~ July 27, 2023
  • Model: BusPirate5REV10-v0.scad

Maybe that helps?

3 Likes

I am just now coming to the same realization. I think I have the correct versions, but maybe I’m doing some initialization wrong. I’m working on that right now.

1 Like

Okay, I checked versions.
I was using 2024 version of OpenSCAD.
Downgraded to 2021.01, no change.

I just randomly pulled the main branch of BOSL2.
It appears to be about a year ahead of your branch.
I’ll downgrade that next and test it.

1 Like

Openscad is great, I like the reproducibility and manageability of parametric modeling. When you add in big libraries like BOSL stuff gets brittle though.

image

I was wrong, the correct file is BusPirate5REV8-v10.scad. The next version is with the loose nuts in the bottom, it was just a prototype.

That would be my next step as well.

1 Like

Found it. There was a change to BOSL2 on 27 Jun 2022 in commit 8373b2db3813ffed3a40d808da58dcb0dd138e84 which changed the behavior of the diff("mask") command. One should no longer use the "mask" argument. Based on my testing, this is the exact commit where the Bus Pirate SCAD file “breaks”. Here is an issue I found which led me down this path. It might be important to check this conclusion because I am not familiar with BOSL2.

But, it is simple to fix. Just removing the two instances of this diff() command to not have any arguments, things work as expected with the latest versions of both OpenSCAD and BOSL2.

That render is using reasonably up-to-date versions, and uses the minor change to the scad file above.

OpenSCAD

version 2024.04.12 (git dfa7855cf)

BOSL2

Merge: 82a13f9 4d95f81
Author: Revar Desmera <revarbat@gmail.com>
Date:   Sun Oct 13 02:09:55 2024 -0700
    Merge pull request #1489 from adrianVmariano/master
    rounded prism anchor improvements
3 Likes

Nice, so I just remove “mask” on line 185 and 305? I can push a fix if that’s it.

3 Likes

Yes. Post must be at least 20 characters, so I’ll say it again. Yes.

2 Likes

Also I downloaded the even latest bleeding edge OpenScad 2024.10 and it works as well. Some folks might be using the 2024 versions because they recently made an update that results in really fast rendering.

4 Likes

Nice job, folks! Love the cooperative tracking down of this. :slight_smile:

1 Like

Thanks! I updated both versions (with and without insert nuts) and pushed to github.

1 Like

Okay, pushed a repo with the mechanical envelope drawing code and notes about how to implement it. There are a few different ways to do it, none is perfect.

In the process of doing this, I found one very slight mismatch between the center of the push button switch and the center of the enclosure hole.

When you’ve wrapped up the final enclosure, give me a heads up and I’ll do any tweaking to the mechanical dimension layers, and regenerate the XY projections as necessary.

2 Likes