I’ve got the basics down, but now looking to do something more complex, and unsure if it’s possible. I have imported a flat shape (a pcb), and I can extrude this out. What I want to do however is to rotate it on its axis, and then extrude it down the z-axis (not directly out from the surface). Is this possible, and if so, how?

1 point

I use OpenSCAD all the time. What do you mean by “then extrude it down the Z axis”? Happy to help. Just don’t know what you mean here.

permalink
report
reply
1 point

Thank you! So, you can get a regular 2D shape and use the linear_extrude() function to extrude out at 90 degrees from the object. They refer to in in the docs as the equivalent of pushing playdoh through a press. And from the docs ‘In OpenSCAD Extrusion is always performed on the projection (shadow) of the 2d object xy plane and along the Z axis; so if you rotate or apply other transformations to the 2d object before extrusion, its shadow shape is what is extruded.’

So the Z axis is no related to what I see on the screen, but is in direct relation to the original 2D image. If I were to first rotate the 2D image by 90 degrees, and then extrude, the extrusion would be on the Z axis relative to the 2D object, but the X axis relative to the rest of the project (if that makes sense).

What I want it to extrude on the absolute Z axis of the total project, regardless of the angle of rotation of the 2D object. To put it another way, if I were to have a square on the 2D, and I rotated it 30 degrees before extruding, I would not want a cube to be formed, but rather would want a rhombohedron.

permalink
report
parent
reply
1 point

You’ll want to leverage hull! First linear extrude your PCB shape just to make it 3D, you can do something like 0.00001 then rotate to your desired angle. Make this a module then call it twice, once at wherever you want it and once more but translated on the z-axis by however high you want to “extrude”. Wrap these two up in a hull and you’re good to go!

permalink
report
parent
reply
2 points

That’s awesome, thank you so much!

permalink
report
parent
reply
2 points

Note that this will always be convex, if your 2d shape has “holes” you’ll want to get a bit more creative, I like to do a difference to create the “negative” as a 3D shape, do the same exercise as above but translate slightly higher and lower and use ‘difference’ to create your final shape

permalink
report
parent
reply
1 point

I’ve done something like that with a multmatrix transformation. There is an example of doing a skew transformation like that in the OpenSCAD user manual. This works with any 3D shape, not just extrusions. So you could transform a cube into a parallelepiped.

permalink
report
parent
reply
1 point

hull() between 2 cubes would be my strategy for rhombo

permalink
report
parent
reply

ErgoMechKeyboards

!ergomechkeyboards@lemmy.world

Create post

Ergonomic, split and other weird keyboards

Rules

Keep it ergo

Posts must be of/about keyboards that have a clear delineation between the left and right halves of the keyboard, column stagger, or both. This includes one-handed (one half doesn’t exist, what clearer delineation is that!?)

i.e. no regular non-split¹ row-stagger and no non-split¹ ortholinear²

¹ split meaning a separation of the halves, whether fixed in place or entirely separate, both are fine.
² ortholinear meaning keys layed out in a grid

No Spam

No excessive posting/“shilling” for commercial purposes. Vendors are permitted to promote their products/services but keep it to a minimum and use the [vendor] flair. Posts that appear to be marketing without being transparent about it will be removed.

No Buy/Sell/Trade

This subreddit is not a marketplace, please post on r/mechmarket or other relevant marketplace.

Some useful links

Community stats

  • 398

    Monthly active users

  • 534

    Posts

  • 4.3K

    Comments