Draft_ShapeString fails to Path_Vcarve with particular font

Here's the place for discussion related to CAM/CNC and the development of the Path module.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
mcdanlj
Posts: 68
Joined: Sun Dec 01, 2019 12:10 am

Draft_ShapeString fails to Path_Vcarve with particular font

Post by mcdanlj »

On Maker Forums, I'm trying to help a new forum visitor get started with FreeCAD for his new CNC router, and he's just playing around to learn. He is using a font (which I don't have locally) which causes Path_Vcarve to fail.

With the attached file (which I simplified a bit):
  1. Choose Path WB
  2. Select "Big Title" ShapeString
  3. Select Path→Vcarve, OK
I see the error PathVcarve.ERROR: Error processing Base object. Engraving operation will produce no output.

If I instead choose individual faces from the ShapeString, in individual Path_Vcarve ops, some of them work and some don't. For example. the bar of the initial "T" carves, but not its body. The "h" carves, but the "e" does not. The pattern of what works and what doesn't is not clear to me.

If I change the font to the LiberationMono-Bold (/usr/share/fonts/liberation-mono/LiberationMono-Bold.ttf on my system) it works.

Code: Select all

OS: Fedora Linux 36 (Thirty Six) (GNOME/gnome)
Word size of FreeCAD: 64-bit
Version: 0.20.29177 (Git) AppImage
Build type: Release
Branch: (HEAD detached at 0.20)
Hash: 68e337670e227889217652ddac593c93b5e8dc94
Python 3.9.13, Qt 5.12.9, Coin 4.0.0, Vtk 9.1.0, OCC 7.5.3
Locale: English/United States (en_US)
Installed mods: 
  * sheetmetal 0.2.49
  * A2plus 0.4.56a
  * ExplodedAssembly
  * dxf_library
  * MeshRemodel 1.8919.0
  * fasteners 0.3.46
  * Assembly4 0.12.2
  * CurvedShapes 1.0.3
  * Pyramids-and-Polyhedrons
  * Manipulator 1.4.8
  * parts_library
  * Defeaturing
Attachments
TitleVCarve.FCStd
(130.88 KiB) Downloaded 22 times
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: Draft_ShapeString fails to Path_Vcarve with particular font

Post by GeneFC »

V-Carve is not really appropriate for that sort of shape. The tool would need to go up and down to fill the shape, and the result would be a bit of a mess. I suspect the failure is due to the size of the V-tool or the depth parameters selected. I could not do any further testing because the specific tool was not available to me.

Engrave seems to work fine, although that creates an outline path rather than a single medial path.

Gene
mcdanlj
Posts: 68
Joined: Sun Dec 01, 2019 12:10 am

Re: Draft_ShapeString fails to Path_Vcarve with particular font

Post by mcdanlj »

GeneFC wrote: Wed Jul 13, 2022 1:46 pm V-Carve is not really appropriate for that sort of shape. The tool would need to go up and down to fill the shape, and the result would be a bit of a mess.
This confuses me. I'd expect that this would be a perfect application for V-Carve and lots of @sliptonic's examples are of font carving. Of course it has to go up and down; isn't that actually specifically why V-Carve isn't just engrave the median? I thought it was actually the main point of the algorithm.
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: Draft_ShapeString fails to Path_Vcarve with particular font

Post by GeneFC »

It just seems to me that changing the depth in such a large fashion required by that font would look very strange.

It is your project. Do whatever you like. 8-)

The rest of my comments still stand. It is very important to make sure the various depths are set correctly in the Path operation. The defaults may or may not be sufficient.

Gene
mcdanlj
Posts: 68
Joined: Sun Dec 01, 2019 12:10 am

Re: Draft_ShapeString fails to Path_Vcarve with particular font

Post by mcdanlj »

GeneFC wrote: Wed Jul 13, 2022 6:33 pm It just seems to me that changing the depth in such a large fashion required by that font would look very strange.

It is your project. Do whatever you like. 8-)
It's not... I'm trying to help someone else learn FreeCAD, and ran into an inscrutable error, so I was trying to report it. It's not obvious to me from the error what the problem is, so I thought the example might be useful if only for producing an error message that better identified the problem, and the instructions are very strict that no bug report without a forum post.

Just trying to help.
The rest of my comments still stand. It is very important to make sure the various depths are set correctly in the Path operation. The defaults may or may not be sufficient.
Yeah, I had shared with the user how to change depths, and he started from scratch and succeeded — which of course means I don't know exactly what he did different on the successful path.
User avatar
sliptonic
Veteran
Posts: 3457
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: Draft_ShapeString fails to Path_Vcarve with particular font

Post by sliptonic »

Just guessing but the problem is probably the overlapping faces. This font isn't appropriate for v carving.
2022-07-13_18-10.png
2022-07-13_18-10.png (16.87 KiB) Viewed 1299 times
mcdanlj
Posts: 68
Joined: Sun Dec 01, 2019 12:10 am

Re: Draft_ShapeString fails to Path_Vcarve with particular font

Post by mcdanlj »

sliptonic wrote: Wed Jul 13, 2022 11:12 pm Just guessing but the problem is probably the overlapping faces. This font isn't appropriate for v carving.
To test this theory, instead of selecting the whole ShapeString, create two ops, one for the bar of the T and one for the ascender of the T. No overlapping faces. The bar carves; the ascender doesn't. I've made the stock 20mm deep to make sure that depth isn't the problem. See the attached file. This avoids any of the overlaps, so there is something else going on.

I recognize that you have an aesthetic objection to this font for vcarving, but there's no particular reason that overlapping faces as separate ops can't carve overlapping faces. I could understand if that confuses Path_Vcarve's ShapeString handling because it treats it as a single op instead of as, essentially, a list of faces, but then it should be an effective workaround (again, please set aside aesthetic judgements here) to create a separate op for each face..

Again, my purpose here is to provide a sample that someone else was trying to use, in case it was useful. It's not a request to fix a bug. Indeed, he's already started over and successfully cut wood, and reports having done it with this font.

The only reason to pay attention to this particular example is if it's a useful test case for development.
Attachments
TitleVCarveErrorExample.FCStd
(136.28 KiB) Downloaded 19 times
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: Draft_ShapeString fails to Path_Vcarve with particular font

Post by GeneFC »

I played with this a bit more. The special font is freely available for personal use, so I downloaded it and tested a number of characters. Some work and some don't.

The one thing I spotted is that any shape with a "bulb" at the end of it seems to fail. I do not know how the path algorithm works, but there may be some sort of problem with overlaps when the shape is analyzed.

Gene
User avatar
sliptonic
Veteran
Posts: 3457
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: Draft_ShapeString fails to Path_Vcarve with particular font

Post by sliptonic »

I've tracked it a little farther.
In Python, it's occuring on this line when we make the call to voronoiEdge.toShape

This results in an 'Unknown C++ exception'

I can't see anything wrong with the voronoi edge in python. Maybe someone with C++ skills can debug it further.
Below is the two previous edges that worked and then the edge that fails.

Code: Select all

10:31:21  PathVcarve.DEBUG: (192) - VoronoiEdge([46.319, 49.742], [46.431, 49.905])
10:31:21  PathVcarve.DEBUG: (183) - zStart value: 0.8660254037844387 depth: -0.6722745962155613
10:31:21  PathVcarve.DEBUG: (183) - zStart value: 0.8660254037844387 depth: 0.6409254037844387
10:31:21  PathVcarve.DEBUG: (192) - VoronoiEdge([46.431, 49.905], [47.037, 49.45])
10:31:21  PathVcarve.DEBUG: (183) - zStart value: 0.8660254037844387 depth: 0.6406254037844388
10:31:21  PathVcarve.DEBUG: (183) - zStart value: 0.8660254037844387 depth: 0.8376254037844387
10:31:21  PathVcarve.DEBUG: (192) - VoronoiEdge([47.037, 49.45], [47.127, 49.381])
10:31:21  PathVcarve.DEBUG: (387) - Unknown C++ exception
mlampert
Veteran
Posts: 1772
Joined: Fri Sep 16, 2016 9:28 pm

Re: Draft_ShapeString fails to Path_Vcarve with particular font

Post by mlampert »

sliptonic wrote: Thu Jul 14, 2022 3:34 pm This results in an 'Unknown C++ exception'

I can't see anything wrong with the voronoi edge in python. Maybe someone with C++ skills can debug it further.
Below is the two previous edges that worked and then the edge that fails.
I'll have a look - thanks for the details and narrowing it down.
Post Reply