Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

From what I have seen so far, OpenScad is the closest to how I would like to build my objects.

The two main differences to how I want to work are:

1: I want to use a web-based solution. I don't like to install software. I just want to open a website. No matter if I am on Linux, Android or iOS - it should just work.

2: Instead of the SCAD language, I want to use Python.





I saw a programatic Web cad tool before, took a moment to find it (and along the way I found a few others). Caveat: of these I have only used Onshape, and I tend to use it via the graphical interface.

- First up Onshape is web based, but is actually programmable behind the scenes (and all documents are scripts under the hood). This is used to let you write plugins it for it.

- The one I was thinking of used to be called KittyCAD but has since been renamed: https://zoo.dev/ (looked at it briefly but it was in very early stages then).

- https://www.fornjot.app/ is a work in progress CAD engine that can compile to WASM. Written in Rust (so big plus for me there, I have switched from C++ to Rust for most things).

There are a few python cad things already as well: SolidPython, PythonSCAD and CadQuery. FreeCAD is also scriptable in python. Due to the large size, python really isn't suitable for embedding in wasm though.


For the core of my engine, I just need to build some basic mesh tools like mesh(), combine(), intersect(), difference(). Everything else, common objects like cube(), sphere(), disk() and common operations like move() and rotate() is then simple.

SolidPython: This seems to rely on OpenScad. I think a solution without dependencies will fare better in the long run.

PythonSCAD: This also seems to be heavily interwoven with OpenScad.

CadQuery: This might be interesting. I will probably start with some code for mesh(), combine(), intersect(), difference() that I write myself and then look into libraries like this one and evaluate if it makes sense to swap out my own for one of them. But I have the feeling they will not match my preferred architecture closely enough.

What do you mean by "Due to the large size, python really isn't suitable for embedding in wasm"? In what regard is Python "big"?


Python is big in the sense that your wasm bundle with the CPython runtime and a bunch of the standard library are going to be several MB most likely. Just libpython.so in my system is 8.7 MB for example. The standard library is an additional 56 MB.

Yes, you can compress and strip down unused parts, but it will still not be a fast loading page if you want to provide a reasonable coding experience for the user to write python in. And it will eat server bandwidth, not a big deal if it is just you self hosting for yourself, but if you want to make this a public service that does matter.


8.6 MB - wow!

There must be way more in there than just running Python code.

I once implemented a small subset of PHP in PHP (just enough to run the code I wanted it to run) and it took me 320 lines of code. The file (gloriously named php.php) was less than 10k in size.

Still, loading 8.7 MB is kinda ok. It takes about 2s on my pretty normal home connection.

Indeed, https://pyodide.org/en/stable/console.html loads a wasm that is 8.7 MB.

It also loads "python_stdlib.zip" which is 2.42 MB. Maybe that is the whole standard lib in compressed form? I wonder why they publish a zip. Browsers natively support all kinds of nice compression.

I guess there are leaner implementations than CPython?

https://pyscript.net loads a file "mircopython.wasm" that is 434 KB.


Not seen web-based python CAD but IMO any time spent going too deep into OpenSCAD is wasted if you plan to do really complex things: it is limited. You might find Replicad useful if you combined it with some wasm Python thing.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: