Question, is there an option in LaserWeb4 to "close vectors"?

Question, is there an option in LaserWeb4 to “close vectors”?
DesignSparkMechanical generates DXF files where each line segment is a separate line segment. So a box is 4 lines, disconnected from each other. The ends are not attached together, and thus cutting inside/outside the lines won’t work.

VCarve as a option for this to “close vectors”, which stitches endpoints that are really close together. But I cannot find this option in LaserWeb4?

(You could argue that this is a problem on the CAD side. If that is your reply, don’t reply at all. As I’m looking for a solution, and it’s not like I can change the CAD package)

Look into the polyline “pedit” command in draftsight (which is free). It can convert short segments into continuous polylines. It’s an extra step, but will help with cleanup.

After quite some tinkering, I found out LaserWeb4 is extremely picky about it’s input format if you want inside/outside cutting.

Pretty much only SVG files from Inkscape I manged to get working. Even clearly properly written SVG files with closed paths from OpenSCAD won’t do it.

Some DXF files it even refuses to load silently.

@Daid_Braam Some people call it “picky”, other say “crap in, crap out”. :wink:

Calling it “picky” was me being nice.

You’ll most likely don’t know me. But in 3D printer “land” I’m known as the creator of “Cura” (CAM for 3D printing), quite some work is put in there to handle not horrible but also not 100% perfect files. Improving the success rate of converting a model from 70% to 99%. Other software packages where extremely picky back then, refusing everything but a perfect file. Guess who won the hearths of the user pretty quick?

Sure, some files will always be crap. But blaming the files instead of the code in this case is lazy IMHO. As these files comply to the DXF standard, and contain the proper data. Compared to the STL “horror” that 3D printing has to handle, it’s nothing. The behavior is black magic for the end user. The file looks fine, loads fine, but doesn’t do anything when processed, with no indication why.

It’s also not documented anywhere how the files should look, so it’s all guess work.

I took a better look in the code, and I think the only way a DXF file can be used for inside/outside/pockets if the file only uses LWPOLYLINE elements that are end-to-end connected. CIRCLE elements most likely also work.
So, no ARC, no SPLINE.

No self respecting CAD package is going to export LWPOLYLINE for a curved line. So I’m willing to state DXF support is broken.

@Daid_Braam I agree with you. DXF and SVG import does not work without hickups.
I would love to have a “combine lines” functions (mainly for DXF) and a “create segmented path” for SVG, which reduces the processing time for toolpaths by 10 or even more (see also

I’m now just wondering where I should invest my time in, like in, my development time. I’m not a huge fan of web technologies (personal preference). So I have the option of trying to improve LW4 or create my own desktop based solution (of which I already have a prototype. Which processes so fast, that I don’t haven have a “Generate” button, it just live updates)

Lightburn has some really great abilities on DXF cleanup (as well as other external vector format cleanup). I know it is a commercial product, but maybe the developer @LightBurn_Software could lend some suggestions in how he approached dxf cleanup function in his software. I know laserweb can be seen as a competitor… but maybe it’s worth a shot asking. I know he has his written for running as native versus web code. Just a thought.

LightBurn supports as much DXF as we possibly can, including full support for their spline format (nurbs), layers, arcs, bulges, nested block insert references, and every other bit of kitchen sink they’ve thrown in there.

For joining, I use a 2d spatial array of buckets and an abstraction query layer to quickly access any shape that starts or ends within a given radius of a point, and try to join shapes that introduce the least amount of “bend” in the path. The code isn’t public, but I’m happy to share the ideas.

It was a lot of work, but it’s wicked fast:

@LightBurn_Software that sounds a lot like the method I used in CuraEngine. (Except for checking the “bend” part)

Note that I’m looking for a CNC milling solution, so LightBurn is not a full solution for me. But it looks like very capable software.

@Daid_Braam Assumed as much, but thought the implementation details could help you if you’re planning on implementing in LW or something else. The “minimize bends” part helped make the resulting cutting paths cleaner. I want to augment it so it prefers to self-close a shape as opposed to continuing so duplicates don’t “spiral”, but otherwise I’m very happy with the results.