Engraving woes with freecad-daily

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!
Post Reply
m0n5t3r
Posts: 137
Joined: Fri Feb 03, 2017 2:55 pm

Engraving woes with freecad-daily

Post by m0n5t3r »

There seems to be an overall lack of documentation / process for engraving, and sometimes my typical Monte Carlo problem solving approach (click random things until it works) seems to fail; case in point, I'm trying to engrave some text, and after lots of flailing I think I got to the simplest thing that fails, after I removed confounding factors like SVG and the like.

What I did:
  • create shapestring
  • try to engrave that, got

    Code: Select all

    Traceback (most recent call last):
      File "/usr/share/freecad-daily/Mod/Path/PathScripts/PathUtils.py", line 64, in new_function
        res = function(*args, **kwargs)
      File "/usr/share/freecad-daily/Mod/Path/PathScripts/PathOp.py", line 518, in execute
        result = self.opExecute(obj) # pylint: disable=assignment-from-no-return
      File "/usr/share/freecad-daily/Mod/Path/PathScripts/PathEngrave.py", line 130, in opExecute
        self.buildpathocc(obj, shape.Wires, self.getZValues(obj))
      File "/usr/share/freecad-daily/Mod/Path/PathScripts/PathEngraveBase.py", line 78, in buildpathocc
        edges = copy.copy(PathOpTools.orientWire(offset).Edges)
      File "/usr/share/freecad-daily/Mod/Path/PathScripts/PathOpTools.py", line 145, in orientWire
        return PathGeom.flipWire(wire)
      File "/usr/share/freecad-daily/Mod/Path/PathScripts/PathGeom.py", line 557, in flipWire
        return Part.Wire(edges)
    <class 'TypeError'>: item is not a shape
    2.46e-07 <App> Document.cpp(3462): Failed to recompute Unnamed#Engrave: item is not a shape
    
  • do a draft -> draft to sketch
  • attempt to engrave again, got

    Code: Select all

    Traceback (most recent call last):
      File "/usr/share/freecad-daily/Mod/Path/PathScripts/PathUtils.py", line 64, in new_function
        res = function(*args, **kwargs)
      File "/usr/share/freecad-daily/Mod/Path/PathScripts/PathOp.py", line 518, in execute
        result = self.opExecute(obj) # pylint: disable=assignment-from-no-return
      File "/usr/share/freecad-daily/Mod/Path/PathScripts/PathEngrave.py", line 130, in opExecute
        self.buildpathocc(obj, shape.Wires, self.getZValues(obj))
      File "/usr/share/freecad-daily/Mod/Path/PathScripts/PathEngraveBase.py", line 98, in buildpathocc
        for cmd in PathGeom.cmdsForEdge(edge):
      File "/usr/share/freecad-daily/Mod/Path/PathScripts/PathGeom.py", line 260, in cmdsForEdge
        if edge.Curve.Axis.z < 0:
    <class 'AttributeError'>: 'Part.BSplineCurve' object has no attribute 'Axis'
    165.645 <App> Document.cpp(3462): Failed to recompute shapestring_test#Engrave: 'Part.BSplineCurve' object has no attribute 'Axis'
    
  • add a check for the Axis attribute so now it looks like this:

    Code: Select all

                if hasattr(edge.Curve, 'Axis') and edge.Curve.Axis.z < 0:
    
    Now there is no more error, but the output is ... more artistic than I'd like:
    Screenshot from 2019-12-21 08-35-01.png
    Screenshot from 2019-12-21 08-35-01.png (31.17 KiB) Viewed 696 times
OS: Ubuntu 16.04.6 LTS (Unity/ubuntu)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.
Build type: Release
Python version: 3.5.2
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
Attachments
shapestring-test.FCStd
(42.5 KiB) Downloaded 22 times
chrisb
Veteran
Posts: 53939
Joined: Tue Mar 17, 2015 9:14 am

Re: Engraving woes with freecad-daily

Post by chrisb »

I can (almost) confirm, but there are different mistakes involved. This is what is working here (I tested it with DejaVuSerif without italics, italics are not available on my system):
In 0.18.4 you should base the job on the ShapeString, not on the derived sketch. You can either
- double click Job
- select General
- click Edit button and check ShapeString and uncheck Sketch
- confirm
- recompute the engrave operation

or you create the engrave from scratch.
mlampert wrote:ping
Markus, we have a regression here, in 0.19 I get an error when doing the same. This is the message when creating a new engraving operation, recomputing the existing with a corrected base object yields almost the same:

Code: Select all

PathGeom.WARNING: <class 'Part.BezierCurve'> not support for flipping
PathGeom.WARNING: <class 'Part.BezierCurve'> not support for flipping
PathGeom.WARNING: <class 'Part.BezierCurve'> not support for flipping
PathGeom.WARNING: <class 'Part.BezierCurve'> not support for flipping
Traceback (most recent call last):
  File "/Users/cb/Desktop/FreeCAD.app/Contents/Resources/Mod/Path/PathScripts/PathUtils.py", line 64, in new_function
    res = function(*args, **kwargs)
  File "/Users/cb/Desktop/FreeCAD.app/Contents/Resources/Mod/Path/PathScripts/PathOp.py", line 518, in execute
    result = self.opExecute(obj) # pylint: disable=assignment-from-no-return
  File "/Users/cb/Desktop/FreeCAD.app/Contents/Resources/Mod/Path/PathScripts/PathEngrave.py", line 130, in opExecute
    self.buildpathocc(obj, shape.Wires, self.getZValues(obj))
  File "/Users/cb/Desktop/FreeCAD.app/Contents/Resources/Mod/Path/PathScripts/PathEngraveBase.py", line 78, in buildpathocc
    edges = copy.copy(PathOpTools.orientWire(offset).Edges)
  File "/Users/cb/Desktop/FreeCAD.app/Contents/Resources/Mod/Path/PathScripts/PathOpTools.py", line 145, in orientWire
    return PathGeom.flipWire(wire)
  File "/Users/cb/Desktop/FreeCAD.app/Contents/Resources/Mod/Path/PathScripts/PathGeom.py", line 557, in flipWire
    return Part.Wire(edges)
<class 'TypeError'>: item is not a shape
2258.02 <App> Document.cpp(3462): Failed to recompute shapestring_test#Engrave: item is not a shape
Recompute failed! Please check report view.
I have a faint idea what's going wrong, because following a hint from sliptonic I tried to repair my tesselation script which converts B-splines to arcs and lines I came to this change. However I was not successful to extract the code for replacing the cleanedges function. Now I think the error may be related and the tesselation doesn't work correctly.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
m0n5t3r
Posts: 137
Joined: Fri Feb 03, 2017 2:55 pm

Re: Engraving woes with freecad-daily

Post by m0n5t3r »

I'm on 0.19, and the shapestring was an example (I was trying to engrave some svg graphics when I came to this - that's another place where there doesn't seem to be any clear path from svg to something path can use - the imported thing is an unmanageable pile of edges (and engrave throws all sorts of exceptions when attempting to do anything with said edges - intersection cannot be computed, select edges from a single solid, three points are collinear, etc.), turning it into sketches makes managing things a lot easier, because they can be merged, etc.
chrisb
Veteran
Posts: 53939
Joined: Tue Mar 17, 2015 9:14 am

Re: Engraving woes with freecad-daily

Post by chrisb »

m0n5t3r wrote: Sat Dec 21, 2019 10:13 am turning it into sketches makes managing things a lot easier, because they can be merged, etc.
Of coursethere shouldn't errors come up, but the rest seems ok to me, I think it is quite natural that input coming from another system - and it is a system without a 3rd dimension - needs some adaption.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
mlampert
Veteran
Posts: 1772
Joined: Fri Sep 16, 2016 9:28 pm

Re: Engraving woes with freecad-daily

Post by mlampert »

chrisb wrote: Sat Dec 21, 2019 9:23 am Markus, we have a regression here, in 0.19 I get an error when doing the same. This is the message when creating a new engraving operation, recomputing the existing with a corrected base object yields almost the same:
This is the same issue we had a few weeks ago - Bezier curves are being used/favoured by some fonts which are not yet supported. I hope to get to look into that over the next few days.
chrisb
Veteran
Posts: 53939
Joined: Tue Mar 17, 2015 9:14 am

Re: Engraving woes with freecad-daily

Post by chrisb »

mlampert wrote: Sat Dec 21, 2019 7:06 pmI hope to get to look into that over the next few days.
That would of course be great, but keep in mind that the next few days are somewhat special.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply