Time to revisit SVG path to LDraw conversion?


RE: Time to revisit SVG path to LDraw conversion?
#6
(2022-12-13, 6:39)Lasse Deleuran Wrote: What are the missing capabilities of svg2ldraw, since we want to start over again?

If you just want the points, you can convert the line types 3 and 4 to their corner points.

SVG2LDraw

I know people have previously been talking about "Delauney triangulations" and such, but that doesn't really make sense for the 4-sided polygons that LDraw allow for. So it must be something else that people yearn for - it is just not captured in the Issues and requests.

Is svg2ldraw the same as svg2dat? It could simply be that I had forgotten there were two different utilities out there. But now I am remembering that I once tried to use svg2ldraw and couldn't get past uploading the source file.

Trying again just now, I have some better luck, and I can offer at least some thoughts/observations:
  • As has been said before, the triangulation seems very non-intuitive: lots of spidery mesh with many very thin triangles, for example. There are also many extra vertices added, often at seemingly arbitrary places.
  • Because of this, it wouldn't be as simple as converting 3 and 4 lines to corner points, because you'd also have to clean up the extra ones.
  • So, I do think it would be good to return only the nodes from the svg file itself: endpoints of straight segments, and any nodes added to Bezier segments. Generating the mesh could be a user-selected option.
  • Perhaps a more interactive way to adjust the interpolation of Bezier points? Would it be trivial to implement a slider? I'm also not quite sure what "points per 100 pixels" means in relation to LDraw—I would be thinking more in terms of either maximum angle between segments, or approximating the 16/48-sided resolution of curved LDraw geometries.
  • The program does not seem to recognize inner rings of an svg path (for example, it renders the letter 'o' as a solid circle, not a hollow ring).

Can the program only handle whole files, or would I be able to copy the SVG code of a single element in Inkscape and work with that alone?

Here is a file I used for testing (change .txt to .svg) so you can see what I mean. In this file, most of the letter paths have already been hand-simplified in Inkscape, but any letters that are repeated have not (e, a, i, r, G). I used a setting of 200 to simplify the curves before I approached what I'd consider an acceptable resolution, which feels like a lot.


Attached Files
.txt   4162p1q.txt (Size: 54.5 KB / Downloads: 2)
Reply
« Next Oldest | Next Newest »



Messages In This Thread
RE: Time to revisit SVG path to LDraw conversion? - by N. W. Perry - 2022-12-14, 4:21
RE: SVG... - by Franklin W. Cain - 2022-12-15, 14:53
RE: SVG... - by Orion Pobursky - 2022-12-15, 15:38

Forum Jump:


Users browsing this thread: 1 Guest(s)