-
I just want Python to generate the corresponding DXF content from the data and return it to Node. If not, maybe I'll make my own |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
Generating files can be a performance drain because of the amount of data. |
Beta Was this translation helpful? Give feedback.
-
@qilong777 do you mean like being able to write to a This code creates an ASCII DXF file: out = io.StringIO()
doc.write(out)
content: str = out.getvalue()
# convert string "content" into bytes if required:
# this applies the required output encoding: doc.output_encoding
# and the correct DXF Unicode encoding style: "\U+xxxx"
data: bytes = doc.encode(content) This code creates a Binary DXF file without going through out = io.BytesIO()
doc.write(out, fmt='bin')
out.seek(0)
data: bytes = out.read() |
Beta Was this translation helpful? Give feedback.
-
There is a method to create base64 encoded data from a DXF document: # return data to browser ...
return b'data:application/octet-stream;base64,' + doc.encode_base64() |
Beta Was this translation helpful? Give feedback.
There is a method to create base64 encoded data from a DXF document:
https://ezdxf.mozman.at/docs/drawing/drawing.html#ezdxf.document.Drawing.encode_base64