DXF Export

I successfully exported the floor plan and elevations to DXF, but I couldn't export the sections.


Python: Traceback (most recent call last):
File "C:\Users\Sahru\AppData\Roaming\Blender Foundation\Blender\4.4\extensions.local\lib\python3.11\site-packages\bonsai\bim\module\drawing\operator.py", line 3573, in invoke
return self.execute(context)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Sahru\AppData\Roaming\Blender Foundation\Blender\4.4\extensions.local\lib\python3.11\site-packages\bonsai\bim\module\drawing\operator.py", line 3602, in execute
tool.Drawing.convert_svg_to_dxf(drawing_uri, drawing_uri.with_suffix(".dxf"))
File "C:\Users\Sahru\AppData\Roaming\Blender Foundation\Blender\4.4\extensions.local\lib\python3.11\site-packages\bonsai\tool\drawing.py", line 2321, in convert_svg_to_dxf
path = path.attrib["d"]
~~~^^^^^
KeyError: 'd'

Comments

  • @sahrul That looks like a bug. Maybe report it at https://github.com/IfcOpenShell/IfcOpenShell/issues ideally including your file. If your file cannot be publicly shared, there is a explanation in the bug template on how to share the file just with the core developers.

  • Hard for me to say, without the file.
    It might be a bug. I suggest posting a github issue, and then sharing the file via this link, if it's private.
    ...
    It appears you are saving both the blend file and ifc file together. Do you get this same issue, if you open the .ifc anew?

  • From briefly looking at the code, the dxf converter expects every svg path element to have a "d" attribute, so it doesn't do any checks. For some reason your svg file has at least one path element that does not contain a "d" attribute, so instead you get the above exception.
    From https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorials/SVG_from_scratch/Paths a path only has the "d" attribute, so how you got an svg with an empty path is a bit strange.

  • @theoryshaw said:
    Hard for me to say, without the file.
    It might be a bug. I suggest posting a github issue, and then sharing the file via this link, if it's private.
    ...
    It appears you are saving both the blend file and ifc file together. Do you get this same issue, if you open the .ifc anew?

    I have tried to open IFC but it still gives error

  • @theoryshaw said:
    Hard for me to say, without the file.
    It might be a bug. I suggest posting a github issue, and then sharing the file via this link, if it's private.
    ...
    It appears you are saving both the blend file and ifc file together. Do you get this same issue, if you open the .ifc anew?

  • I'm using a recent nightly build, and I can create the NORTH SECTION svg drawing, and convert to dxf no problem.
    Hmmm. Can't attach a dxf here. Boooo.

  • Here's the dxf loaded into freecad:

    Bedsonzoomer
  • Worked for me.
    Attached dxf. Just remove .txt suffix.
    ...
    BTW, you might want to try this approach, as it translates the IfcClasses into CAD layers.

    zoomer
  • @theoryshaw said:
    Worked for me.
    Attached dxf. Just remove .txt suffix.
    ...
    BTW, you might want to try this approach, as it translates the IfcClasses into CAD layers.

    NORTH SECTION, exported dxt successfully, but NORTH SECTION-X error

  • OK, so I dug a bit into the svg produced, and for reasons I do not know some "path" tags are entirely empty, i.e. <path/>
    This is valid xml, but I don't think it is valid svg as a path should have a d attribute. The dxf exporter assumes a path has a d attribute. I can "fix" it using a simple exception catch, but that is not the real problem. The real problem is why is Bonsai writing empty path tags to the svg?
    @sahrul You really need to raise a bug, as the svg serializer that produces the source svg output is a bit beyond me. You can point to this discussion for background in the bug.

    sahrul
  • Specifically you have a bunch of IfcMembers that have two path components, one of which is empty. Other IfcMembers in the file only have a single path component, so it is not all IfcMembers that are wrong.

        <g ifc:guid="0k$xc8gCP1tPRtTYgZpZlN" ifc:name="Member" class="IfcMember material-null cut">
          <path/>
          <path d="M250.77452242374417,242.98600137233734 L250.58886885643003,242.96221911907196 L250.56263417005536,243.16701352596283 L250.54693758487699,243.2895439863205 L250.8572310209274,243.3292931318283 L251.04288458824155,243.35307776927948 L251.0691192746162,243.1482833623886 L251.0848161578178,243.02575051784515 Z M251.07225507497785,243.04286181926727 L251.07235580682752,243.04431855678558 L251.04930102825162,243.2242888212204 L251.03550702333447,243.33196818828583 L251.03473037481305,243.3342832326889 L251.03426575660703,243.3356660604477 L251.0326626896858,243.33750903606415 L251.03170335292813,243.3386105298996 L251.02951765060422,243.3396977186203 L251.02820992469785,243.34034860134125 L251.02577447891233,243.34051549434662 L251.0243174433708,243.34061563014984 L250.73884725570676,243.30404698848724 L250.56804597377774,243.2821673154831 L250.56573182344434,243.28139007091522 L250.56434690952298,243.28092515468597 L250.5625060200691,243.2793229818344 L250.56140452623364,243.27836215496063 L250.56031703948972,243.27617824077606 L250.559666454792,243.2748693227768 L250.55949836969373,243.27243506908417 L250.55939763784406,243.27097594738007 L250.58245241641995,243.09100568294525 L250.5962464213371,242.9833287000656 L250.59702306985852,242.98101365566254 L250.59748768806455,242.97962844371796 L250.599091053009,242.9777878522873 L250.60005009174344,242.97668635845184 L250.60223579406735,242.97559916973114 L250.60354351997373,242.9749482870102 L250.60597896575925,242.97477900981903 L250.60743600130078,242.9746788740158 L250.89290618896482,243.0112498998642 L251.06370747089383,243.03312957286835 L251.06602191925046,243.03390681743622 L251.0674065351486,243.03436934947968 L251.0692477226257,243.03597390651703 L251.07034921646115,243.03693234920502 L251.07143640518186,243.03911864757538 L251.07208698987958,243.04042518138885 Z"/>
        </g>
    
    
    sahrul
  • edited July 3

    Hmmmm... every IfcMember with an extra empty <path/> is a RENG BARU:

  • Even more info: The Bisect cutting mode when generating the section is what causes the issue. Try changing it to OpenCASCADE, recreate the drawing, then convert to dxf.

    Massimo
  • @sjb007 said:
    Even more info: The Bisect cutting mode when generating the section is what causes the issue. Try changing it to OpenCASCADE, recreate the drawing, then convert to dxf.

    i tried and it worked, thank you @sjb007

Sign In or Register to comment.