Auto-generate parts?


Auto-generate parts?
#1
From discussions in the parts tracker, I learned that there are different streams of how people like parts to be authored. The streams I identified so far are:
1. Use as many primitives as possible.
2. Make sure there are no manifold issues like t-junk.
3. Accept manifold issues if this leads to fewer faces.

Those streams often contradict each other because for instance using primitives often leads to manifold issues because even the most standard primitives like the studs bring them along. Placing a stud that is open on top of a box (as done for the most standard LDraw parts like 3001.dat) produces vertexes for the stud that are not connected to any vertexes of the box at all.

As such I was wondering whether it would make sense to be able to automatically generate parts from CAD files, such that I can use the full power of the CAD system, which could make sure to produce a manifold structure. This structure can then automatically be converted and we would receive a part that has a perfect manifold structure and as such should not cause any rendering issues.

The downside of this approach is that those automatically generated parts would not use any primitives at all.

If you are interested in the approach, feel free to have a look at https://github.com/schiele/stl2ldraw, which currently is an early working prototype.

This includes an example of part 3001 in https://github.com/schiele/stl2ldraw/blo.../test.scad, which gets translated into an STL file by OpenSCAD. In the next step, the tool translates this into an LDraw dat file.

The tool currently has the following features:
- Reads binary and ascii STL files.
- Merges very close vertexes that would not produce visual differences but might cause non-manifold structures.
- Warns about incorrect normal vectors in the STL files and corrects them.
- Warns about detected non-manifold structures but does not correct them:
  - degenerated faces (faces spanning no area, meaning all points on one line)
  - open edges
  - ambiguous edges
- Merges adjacent triangles on the same plane to convex quadrilaterals.
- Generates lines for sharp edges (more than 25 degrees angle) and open edges.
- Generates optional lines for soft convex edges (less than 25 degrees angle). For concave edges, they are not generated since they would never be visible by their concave nature anyway.

I do welcome your feedback and suggestions.
Reply
RE: Auto-generate parts?
#2
The benefit of using prims is that you don't have to reinvent the wheel every time, which is most true for big chunks of parts. The forced use of boxes might be questionable, rects - especially when they are rotated and rounding errors start kicking in even more - but the use of rounded prims is unbeatable. This is most true for prim substitution in viewers such as LDView.

First time I used modern CAD tools such as Solidwork I learned it the hard way how important Marc Klein's modelisation tips are and that a possible substitution of code with prims has to be planed in advanced:

http://marc.klein.free.fr/lego/parts/modelise.html

when converting a STL to the low-res LDraw ecosystem:

http://marc.klein.free.fr/lego/stl2dat/stl2dat.html

w.
LEGO ergo sum
Reply
« Next Oldest | Next Newest »



Forum Jump:


Users browsing this thread: 1 Guest(s)