User avatar
scruss
Posts: 3328
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: OpenSCAD

Sat Aug 24, 2019 6:01 pm

Gavinmc42 wrote:
Sat Aug 24, 2019 10:48 am
What else is there that will run on Pi's?
Inkscape for 2D to G-code.
g-code is incredibly machine-specific, so make sure that the plugin knows about your machine.

I know people who swear by gcmc - G-Code Meta Compiler or bCNC if their hardware is driven by grbl. The cheap 3018-PRO routers use grbl and seem to be absurdly popular.
… PLA, ABS = 3D printer = slicer.
OctoPrint 3d printer controller runs well on a Raspberry Pi, and it has a slicer plugin that can run either the Cura steamengine slicer or slic3r as backends. The Cura 3.x version for Raspberry Pi 4 posted elsewhere on the board will slice directly to an OctoPrint instance, which helps avoid the horrors of building either of the slicers.
… CNC Lathe, Mill.
I don't know of good tool-pathing software that runs as a user application on a Raspberry Pi. Ed Nisley might, though, and his blog is always full of new CNC things he's tried.
I have not used OpenSCAD much, will it help?
If you've ever used any other CAD package and are expecting WYSIWYG, probably not. OpenSCAD is similar to the C programming language, except that variables can't be changed at runtime. It's basically a package for combining CSG primitives, so this code:

Code: Select all

difference() {
                           cylinder(r = 10, h = 4);
    translate([ 4, -4,  0])cylinder(r =  6, h = 4);
}
results in this 3D output:
openscad.png
openscad: difference of cylinders
openscad.png (11.88 KiB) Viewed 913 times
It's not for everyone, but I use it for work sometimes, making customizable assistive tech devices. That particular one is a really simple demo part for showing trainee occupational therapists how quickly parts can be customized and manufactured.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

User avatar
Gavinmc42
Posts: 4552
Joined: Wed Aug 28, 2013 3:31 am

Re: OpenSCAD

Sun Aug 25, 2019 1:08 am

Thanks Scruss, bookmarked those links.
gmmc and bCNC look very useful and Ed has taught me a new word - Ubiety.

OpenSCAD reminds me of Povray, Pi's have made me more comfortable with coding ;)
It has been some time since I use TurboCNC on FreeDOS on a 800MHz Via mini PC.
Time to get back to making stuff using Pi's.
It is so much easier now than 10 years ago.
Seems like everyone has 3D printers and there is more software.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
HermannSW
Posts: 2787
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: OpenSCAD

Thu Dec 12, 2019 9:22 pm

scruss wrote:
Mon Aug 12, 2019 7:00 pm
Direct AppImage link:
https://files.openscad.org/snapshots/Op ... f.AppImage
Thanks, I downloaded the appimage and had to google what to do with it.
Only "chmod a+x OpenSCAD-2019.01.13-armhf.AppImage" and then "./OpenSCAD-2019.01.13-armhf.AppImage" and it ran.

I will need to install on Pi3 or higher for real use, I started on the Pi2B of my WoodenBoardPi. It did need nearly 2 minutes to render the not that complex stepper PT camera system, which takes only few seconds in OpenSCAD.net in my Linux laptop browser:
https://tinyurl.com/t7kyfug
After rendering completed, rotating and moving the scene in GUI works immediately.

The 7" display of WoodenBoardPi is 18bit only, so the screenshot taken with raspi2png looks interesting, but not really usable.
(I have not done much with OpenSCAD, but really like it -- in the share URL source file I learned how to pass parameter to module [module StepMotor28BYJ(angle)] and use that to turn the motor shaft of one of the 28BYJ-48 stepper motors)
Attachments
snapshot.png
snapshot.png (120.66 KiB) Viewed 735 times
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

User avatar
HermannSW
Posts: 2787
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: OpenSCAD

Sat Dec 14, 2019 2:35 pm

Ihave to partially correct my statements.
The Pi was a Pi3B (a02082), and not Pi2B.
What did cost 1:42min was clicking on 2nd from left "Render" button.
I have no idea what that does exactly, because when I start the appimage, and then double click the last file I had worked with (the stepper PT camera ssystem), then it does take only 17 seconds from that point in time until the appimage got started AND the whole scene is displayed. Doing so reports 2 secconds redering time only.
So what is the difference between 1:42min taking Render button versus 2 seconds rendering on program startup?
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

User avatar
scruss
Posts: 3328
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: OpenSCAD

Sat Dec 14, 2019 9:23 pm

The two seconds is a thrown-together preview rendering: it uses a good-enough approximation of polygons for screen use. Boolean operations such as difference() will look awful: try

Code: Select all

difference() {
    cylinder(d=10, h=5);
    cylinder(d= 5, h=5);
}
and preview will show a partially-filled cylinder.Hitting F6 will render the hollow cylinder properly.

OpenSCAD optimization's a bit of an art. 2D operations such as hull() or minkowski() can be really quick, but as soon as you try it to use those as 3D operators things really slow down. So the trick is to create as many forms as 2D shapes and use extrude() or rotate_extrude() wherever you can. OpenSCAD models can be vast memory hogs: the i7 desktop I use for 3D work has 32 GB of RAM, and careless coding can wipe all of it out.

If your code is animating parts, you might like OpenSCAD's animation step function. It flicks thrugh thrown-together animations quickly so you hardly notice the misrendering.

Update: I took a look at the code. Your circle smoothness is set kind of high ($fn=32). Best not to set any of the $f* variables and let OpenSCAD size appropriately. Also, there are a few variable definitions that are over-written: OpenSCAD's variables don't work the same way as most traditional programming languages. More like Lisp, OpenSCAD variables are evaluated once and can't change.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

User avatar
HermannSW
Posts: 2787
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: OpenSCAD

Tue Dec 17, 2019 12:48 am

scruss wrote:
Sat Dec 14, 2019 9:23 pm
The two seconds is a thrown-together preview rendering: it uses a good-enough approximation of polygons for screen use. Boolean operations such as difference() will look awful: try

Code: Select all

difference() {
    cylinder(d=10, h=5);
    cylinder(d= 5, h=5);
}
and preview will show a partially-filled cylinder.Hitting F6 will render the hollow cylinder properly.

OpenSCAD optimization's a bit of an art. 2D operations such as hull() or minkowski() can be really quick, but as soon as you try it to use those as 3D operators things really slow down. So the trick is to create as many forms as 2D shapes and use extrude() or rotate_extrude() wherever you can. OpenSCAD models can be vast memory hogs: the i7 desktop I use for 3D work has 32 GB of RAM, and careless coding can wipe all of it out.
Thank you for that detailed information!
I now understand the difference between preview and render.
But your simple example demonstrates that in general it is dangerous and wrong go assume that preview shows anything similar to the real model -- there should be a warning.
If your code is animating parts, you might like OpenSCAD's animation step function. It flicks thrugh thrown-together animations quickly so you hardly notice the misrendering.
Good that you mention this feature -- that is the reason I got interested in OpenSCAD application.
For "normal" OpenSCAD work, OpenSCAD.net was "good enough" for me.
I did want to use the appimage's animation feature, that is not available in OpenSCAD.net.
This demo is what I want to animate in OpenSCAD:
Image
Update: I took a look at the code. Your circle smoothness is set kind of high ($fn=32). Best not to set any of the $f* variables and let OpenSCAD size appropriately. Also, there are a few variable definitions that are over-written: OpenSCAD's variables don't work the same way as most traditional programming languages. More like Lisp, OpenSCAD variables are evaluated once and can't change.
I did copy two OpenSCAD files from thingverse together to get my OpenSCAD file (see the two URLs at top of my file):
https://tinyurl.com/t7kyfug

You are right that the warnings should be addressed.

Can you please tell me why the preview shows the colors I want ...
Image

... while after pressing "Render" button the colors are gone?
Image
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

User avatar
scruss
Posts: 3328
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: OpenSCAD

Tue Dec 17, 2019 1:23 am

HermannSW wrote:
Tue Dec 17, 2019 12:48 am
But your simple example demonstrates that in general it is dangerous and wrong go assume that preview shows anything similar to the real model -- there should be a warning.
There is - if you try to export model geometry before rendering it. Preview is just a preview, and isn't the primary purpose of OpenSCAD.
This demo is what I want to animate in OpenSCAD:
Image
Hmm, you'll have to find a way to map values of $t to the complex motion. Failing that, you can set variable values from the command line and have it render each frame to a new file.
I did copy two OpenSCAD files from thingverse together to get my OpenSCAD file (see the two URLs at top of my file):
https://tinyurl.com/t7kyfug
… You are right that the warnings should be addressed.
Note, though, that they do no harm. All that happens is that the variables are set to the later definition in the file.
Can you please tell me why the preview shows the colors I want ...
... while after pressing "Render" button the colors are gone?
OpenSCAD is for producing 3d geometries. It only understands colour in preview mode. When you render and export, though, all that's left is the geometry: the library it uses to do all the CSG work discards all colour. If you need colour, use FreeCAD or Blender
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

User avatar
scruss
Posts: 3328
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: OpenSCAD

Wed Feb 19, 2020 2:54 pm

btw, I just found an AppImage for OpenSCAD 2019.05 for Raspberry Pi here:
https://github.com/koendv/openscad-raspberrypi

I've tested it to the "seems to work" level on a Raspberry Pi 4.
2019.05 gives you SVG import, which is a lot less hassle than faffing about with flattened-to-line-segments DXF files.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

Return to “Raspberry Pi OS”