Different colours on seam allowance, pass marks and sew lines

Issue #745 new
Julian Todd created an issue

I'd like to cut the pattern (or cut the fabric directly) on a laser cutter.

I need to be able to set an etch mode for the sew lines and the pass marks, and a stronger laser intensity for the seam allowance cut.

Most laser cutting interfaces let you apply the settings according to the colour of the lines in the SVG file.

(Apologies if this feature already exists; I've looked hard and couldn't find it. You can set colours of curves and lines in the drawing mode, but I couldn't find such features in the layout mode. )

Different line widths in the output (or different styles, like dotted) would also make it possible to distinguish between the line types if colours are not wanted.

Comments (20)

  1. Julian Todd reporter

    Looking at the SVG output file, it seems that everything that is part of a one shape (seam allowances, pass marks) is put into a single <path> element. The different disconnected components are separated by an M-command in the path string.

    This makes it hard to go in and hack the SVG file to change the stroke colour to make them different.

    As a work-around I could possibly separate these path pieces into separate <path> elements using a script and apply different colours to them -- if they always appear in the same order.

  2. Julian Todd reporter

    The version I am using is: Valentina 0.5.0.0 Build built on May 11 2017

    I can't upload test files to this issues tracker to show this issue, so here are links in my repository:

    https://bitbucket.org/AndrewA/valentinapatterns/src/7164b15b9dedf369a433da40fc19c129fbb6dde7/test.val?at=master&fileviewer=file-view-default

    https://bitbucket.org/AndrewA/valentinapatterns/src/7164b15b9dedf369a433da40fc19c129fbb6dde7/test.svg?at=master&fileviewer=file-view-default

    The version in the .val file still says it's 0.4.8, even though I have just saved it

    Most cheap laser cutters in hackspaces in the UK are using this crude software: http://justaddsharks.co.uk/support/lasercut-5-3 You choose from the different line colours in your drawing and set the order, speed and power. This handles etching (light burn marks) and cutting.

    I am unaware of the DXF-AAMA standard; I can't find any manufacturing consumers for it. If you need a vision for the end-result for automation, have a look at PCB production from gerber files. http://www.eurocircuits.com/dfm-from-gerber-files-to-pcb-production-data/ In fact, given the functionality of its marking layers, cutting layers, hole layers and the fact that there is a huge infrastructure for viewing and running cutting machines from it, maybe this format could be repurposed for fabric cutting. I'd like to be able to upload my pattern shapes to the website of a supplier and get sent the cut pieces of fabric in the post. Then I'd have a bigger choice of fabrics and minimum waste if different people are getting shapes cut from the same roll.

  3. Roman Telezhynskyi repo owner

    maybe this format could be repurposed for fabric cutting

    It was actually designed for this. Test builds support exporting in this format.

    As to your request, it looks more like AAMA with SVG. As i see, it has the same goal. Because it is output for cutting better to go the same way as in case of AAMA. Just instead of layers use different colors. Should not very hard to add. But because we don't have standard in this case some sort of setting dialog need to be implemented.

  4. Julian Todd reporter

    I have hacked the test file with example colours:

    https://bitbucket.org/AndrewA/valentinapatterns/src/ac4c97ad507105e4168b6280ea25bae81210974f/testcolours.svg?at=master&fileviewer=file-view-default

    You do not need a setting dialog or to find a standard set of colours for this. The LaserCut software lets you state which colour has each property. It is not necessary to decide which colours to use in one program and then decide what the colours mean in the second program. It is good enough to fix the colours, because we will say what the colours mean in the manufacturing program. And even if the colours are wrong you can change them in inkscape. The only thing that matters is that the three different linetypes (the sew, the cut, the passmark) can be distinguished.

    I can edit my output file by hand to make it work for now on the laser cutter.

    I was referring to https://en.wikipedia.org/wiki/Gerber_format which is for PCBs where the production has been fully automated for years, and you can order PCBs printed and cut very reliably. These are more complicated than fabric shapes, and I imagined that the same ordering, nesting and processing systems could be used on fabric by the same suppliers of PCBs, because all they need to do is send the cutting instructions to a different machine.

    This is not to be confused with "Gerber Technology" who make similar software to valentina and sell fabric cutting machines. Unfortunately I have not worked out what file format they use to drive their tools (probably not DXF-AAMA). However videos of their interface onto the cutting machine show it's similar to the LaserCut software where you choose the colour and set what kind of knife to use: https://youtu.be/CZkcxZCtkyo?t=3m58s

    The lack of an obvious self-contained manufacturing file (as we have for PCBs with gerbers) makes it impossible to disconnect the design from manufacture efficiently. The situation is also similar to 3D printing, who have their STL files which makes it possible to order printed parts. (The STL file format is very crude, simple and wasteful, but it is universal now.)

  5. Julian Todd reporter

    Close it with what setting?

    "won't fix"?

    Not going to make it possible to distinguish between seam cuts and passmarks in the SVG output?

  6. Julian Todd reporter

    I can see it's a challenge in the code in the SVG writing function: https://bitbucket.org/dismine/valentina/src/aab475b44af0c7d39157bc8f7df1b211106f4850/src/app/valentina/mainwindowsnogui.cpp?at=develop&fileviewer=file-view-default#mainwindowsnogui.cpp-805

    There is only one function called QGraphicsScene::render that draws everything to the QPainter that contains QSvgGenerator and you can only set the pen colour once at the start of the function.

    Because the same method is being used to render png, eps, ps, obj, pdf, dxf files it is not an option for the render function to set the pen colour itself (because it would have to interface with 6 different file Generators. (However, maybe the QPainter has the capability of interfacing one setpencolor() function to all these different formats)

    An alternative method is to call the render() function 3 times with different settings (eg "only passmarks" ) and set the pen colour outside of these calls.

  7. Roman Telezhynskyi repo owner

    I am asking because you looks like found your way to reach your goal.

    I can see it's a challenge

    No. :) Not at all. Please, read Qt's documentation. Current way is only one possible. You can write to SVG any painting. Even made "manually". This is very similar to what i did to AAMA.

    So, i see you are a developer. This mean you could help us with this feature. I understand the idea, but it is kind of hack. Unfortunately right now the issue has low priority. But if you will provide some implementation i will include it and improve to level we need.

  8. Julian Todd reporter

    I'd love to help, but you can imagine the number of projects I have already picked up (I have other specialities and am very bad at building from C++ code).

    However, I have do have one project similar to this one, which is for designing and plotting cave surveys. https://bitbucket.org/goatchurch/tunnelx Instead of Qt it uses Java, and also used the method of using the screen scene.render() function to make outputs to different file formats, so I recognized the trick.

    Anyway, as a stop-gap for anyone who absolutely must have different colours for the different line types for running a laser cutter over the pattern, here is my quick and dirty post-processing script. If I make an on-line hack, I'll link to it here.

    import re
    fin = open("pattern.svg")
    
    res = [ ]
    for lin in fin:
        if not re.match("<path vector-effect", lin):
            res.append(lin)
            continue
        m = re.search('d="([^"]*)', lin)
        d = lin[m.start(1):m.end(1)]
        dl = re.findall('(M[^M]*)', d)
        print(len(d), len(dl))
        if len(dl) > 3:
            dl[2:] = ["".join(dl[2:])]
    
        lres = [ lin[:m.start(1)]+dl[0]+lin[m.end(1):] ]
        for col, dll in zip(["#00ff00", "#ff0000"], dl[1:]):
            lres.append("</g>\n")
            lres.append(re.sub("#000000", col, res[-3]))   # colour <g element
            lres.append(res[-2])  # some middle stuff
            lres.append(res[-1])  # just the >
            lres.append(lin[:m.start(1)]+dll+lin[m.end(1):])
        res.extend(lres)
    fin.close()
    
    fout = open("colouredpattern.svg", "w")
    fout.write("".join(res))
    fout.close()
    
  9. Yann Lossouarn

    AFAIK, Gerber/PCB file format is not widely supported by common laser cutting software. Things may be different if we speak about factory production (I do not know), but as far as we speak about small laser CO2 cutting units, the de facto standard is DXF. I understand DXF-AAMA is a variation of DXF, that contains specific information for defining units and tools to be used for fabrication of the pattern? If someone can send me a sample DXF-AAMA, I can test it against common laser cutting software (LaserWorks/RDWorks : used by most chinese sources laser cutters around there, LinuxCNC or GRBL, widespread open-source CNC/CAM software.

  10. Yann Lossouarn

    Ok, I did not see the DXF-AAMA was already available. I tested both the files mentioned in your topic and files exported from my projects, with LaserWorks. Results: - unit is bad: by default in most CNC applications, the reference unit is mm. - geometry is ok - AAMA specific concepts (layers, unit...) are not managed - seam line, cut line, text, passmarks, etc. can be selected and therefore colored separately, which would allow these elements to be appropriately cut, lasermarked (provided you find an appropriate setting for marking fabric or paper ;/) or ignored.

    Would it make sense to use cm as the design unit (if so chosen by Valentina user), but mm as the default DXF export unit ?

  11. Roman Telezhynskyi repo owner

    There’s nothing in a plain DXF file to tell the person or program reading units & scale the file what units have been used. So 123.45 could be inches, feet, metres, furlongs or parsecs. This is not a huge problem as long as you know what units were used.

  12. Log in to comment