Soliciting Funds: An inkscape extension to export dxf with layer information from BlenderBIM svg

edited February 4 in General

Collaboration often involves sharing 2D drawings in dxf format, so people can work in their favorite program. Tipically the drawing elements are organized with layers with different colors, lineweight and linetypes. This is important for increased readability and easily change visibility, lock or unlock parts of the drawing and so on.
Currently, dxf files exported with Inkscape from svg generated with BlenderBIM doesn't contain any layer information.
This project is looking to solicit the funds to help develop an Inkscape extension that allows:
1. Create Inkscape layers from svg elements associated with different IFC classes made with BlenderBIM
2. Allow configuration of the layers attributes (name, color, lineweight, linetype) for each IfcClass
3. Export to dxf with layers information



This has been discussed in the following locations:

As you can see in the links above, there has already been some work in the regard. With this project, we hope to build off this initial work and it will be useful when implementing direct dxf export from BlenderBIM

theoryshawMassimobdamayatomkarincaAcetlang

Comments

  • edited February 4
  • edited February 5

    FWIW it should be relatively straightforward for someone familiar with both svg syntax and ezdxf API to write a converter. I'll share a test I worked on some time ago. I eventually elected on directly writing to dxf from the 3D blend file because I personally don't have a use for svg and it doesn't translate 1:1 to the dxf syntax. for example in a svg an object can be part of any number of classes but in dxf an object can be in only one layer.

    I'll drop the link. Do with it what you wish, the current implementation translates polylines, hatches and texts. Hatches are translated to solid, not patterned, same for lines, they're continuous. https://github.com/Gorgious56/svg2dxf/blob/main/convert.py

    Bedsonelschillingduarteframos
  • Update implementing a new ezdxf based inkscape exporter extension.
    Basic functionality is done thanks to @Gorgious input and adapting from the existing DXF exporter. Still need to add lineweight, linetype and save/load settings options.
    Video:
    https://www.dropbox.com/scl/fi/jsjf2tqq28xk63xp4skz9/2024-02-14_13-40-38.mp4?rlkey=7cu96f0b1rka949kor5zjxapu&dl=0

    theoryshawMassimoNigelAceatomkarincaGorgioussteverugi
  • @elschilling nice work to you all. Will the save/load settings be an external text file that can be edited externally? It is good to have a 'save settings' file for each recipient of the exported drawing so they can be customized to their needs.

    elschilling
  • edited February 18

    @Nigel said:
    Will the save/load settings be an external text file that can be edited externally? It is good to have a 'save settings' file for each recipient of the exported drawing so they can be customized to their needs.

    Yes. It is possible to have multiple export settings saved as json files that can be edited externally or with the inkscape extension GUI.
    Here is an update:

    • Export settings GUI

    • Export settings JSON file

    • Result DXF exported

    The extension is available here
    To install copy the ezdxf_exporter_effect.inx and ezdxf_exporter_effect.py to your inkscape user extensions folder and install ezdxf library with pip install ezdxf
    After that there should be a new option called IfcClass exdxf exporter available at Extensions > Export menu
    Next I will implement text and hatch support.
    Any help testing and feedbacks are appreciated

    NigelMassimocarlopavtheoryshawbitacovirDarth_Blender
  • I've packed all dependencies into a zip file for easy installation. Just extract it to the Inkscape user extension folder.
    Tested it on Windows 10

    theoryshawMassimoNigelcarlopavAceArv
  • Hey @elschilling I have installed the exporter on Windows 10 and I just get to the place where I can save the DXF but it is not saving, after clicking the button it just does nothing,

    not sure If I messed up the extension installation or there is a step to the process I've missed?

  • AceAce
    edited February 28

    Hi @theoryshaw yes I extracted the top zip
    I downloaded the latest updated zip

    and copied the contents into the extensions folder found here:
    C:\Program Files\Inkscape\share\inkscape\extensions
    The extension itself appears in Inkscape and I can get all the way to the screenshot I posted, then when you click 'save' it doesn't commit or something, just does nothing.

    I'm using Inkscape 1.3 on Windows 10,

    elschilling
  • I've experienced this too, just now. I think it's working, but just gets hung up, and freezes.
    I can't convert the attached file.

    Aceelschilling
  • @theoryshaw said:
    I've experienced this too, just now. I think it's working, but just gets hung up, and freezes.
    I can't convert the attached file.

    Could you please share the ifc file that this svg comes from? I confirm the bug both on windows and linux environments. On linux I could detect the error message that says 'Segmentation Fault'. I suspect that the bug is related to the markers definition of the generated svg. A temporary workaround is:
    1. Open the drawing with Inkscape
    2. Copy all drawing elements
    3. Open another Inkscape and paste your drawing
    4. Export to dxf
    I will try to make specific xpath query to filter only drawing elements

  • NP, here's the file (Restaurant_Sun_Prairie.ifc) with all the BB dependencies.
    The name of the drawing is FLOOR PLAN - 1ST-cad_background_test.
    And here's the svg.
    Thanks!

    elschilling
  • Hi @elschilling, did you run into a roadblock here? Anything I can help with, to help troubleshoot.
    ...
    If this is a lot of work, my vote would be to release the funds to you now, as you already put in a lot of effort.
    Would be nice to see some funding movement on these campaigns.

Sign In or Register to comment.