4 ms·
For triangles only the intersection case matters. General Polygons could be a bit more complicated. As long as the object is watertight, it's easier. I recentl
by bayesian_horse 7y ago
For triangles only the intersection case matters. General Polygons could be a bit more complicated. As long as the object is watertight, it's easier.
I recently ran into similar problems to be solved in Python, because I am trying to build a replacement for OpenSCAD by duct-taping together various Python packages. Shapely is quite useful for 2D geometry (like intersection and stuff). PyMesh is extremely useful for 3D meshes, but hard to build.
There are some non photorealistic rendering (NPR) options for Blender, many of them implemented in Python. I don't know if they can output SVG data currently.
ThreeJs has an SVG engine, meaning a backend that outputs SVG.
- sitkack 7y ago> build a replacement for OpenSCAD I am very interested in this.
- williamaadams 7y agoThere was quite a lot of openscad replacement going on in 2011. I even made a lua based alternative.
- bayesian_horse 7y agoMy first attempt was using the Blender API, you can take a look at https://github.com/akloster/blender-vraag https://github.com/akloster/blender-vraag Currently I am trying to reimplement the "construct" part with Pymesh and Shapely, but I haven't published it yet.
- tapia 7y agoHave you tried python-occ? http://www.pythonocc.org/ http://www.pythonocc.org/
- bayesian_horse 7y agoThank you for the suggestion. I hadn't seen that yet. From a cursory look it's not completely what I am looking for, but maybe it can be useful. One of the problems for me is that I am sort of stumbling into this "CAD" thing from a coding perspective. CAD programs like Fusion 360° or FreeCAD seem a bit too complicated for me, and through my grappling with the concepts I am reinventing some concepts/tools. Particularly I want to develop 3D printed objects the same way I would do data science: Start with Jupyter notebooks, iterate, maybe end up with parametric Python scripts.
- jonititan 7y agopython-occ may be particularly well suited. They have ipywidgets to look at the models. https://www.youtube.com/watch?v=ieX_GC1sdrQ https://www.youtube.com/watch?v=ieX_GC1sdrQ https://github.com/tpaviot/pythonocc-core/blob/master/src/Display/WebGl/jupyter_renderer.py https://github.com/tpaviot/pythonocc-core/blob/master/src/Di...
- bayesian_horse 7y agoI have only taken a cursory look. So far a lot of the links are dead and it's a bit hard to see examples of the API.
- jonititan 7y agoI certainly agree with that. It has seen more work recently from the BIM side. http://www.pythonocc.org/ http://www.pythonocc.org/ has examples but the most recent work is really demos using it as a part of other projects. https://pure.tue.nl/ws/files/119667686/20190402_Krijnen.pdf https://pure.tue.nl/ws/files/119667686/20190402_Krijnen.pdf https://link.springer.com/article/10.1007/s42496-019-00007-4 https://link.springer.com/article/10.1007/s42496-019-00007-4 https://arxiv.org/pdf/1810.10795.pdf https://arxiv.org/pdf/1810.10795.pdf The difficulty for a lot of CAD systems is the NURBS type line geometry interactions. https://en.wikipedia.org/wiki/Non-uniform_rational_B-spline https://en.wikipedia.org/wiki/Non-uniform_rational_B-spline
- jononor 7y agoHave you tried Cadquery for FreeCAD? Allows you to build your models in Python