MATLAB Answers

Converting .fig file into 2D .dxf file

58 views (last 30 days)
I'm trying to save a figure (see attached) made by multiple lines of 2 different colors (red & black) into a 2D .dxf file (of a series of lines). I tried the existing functions DXFLIB and DXFWRITE in the community but can't seem to get them working. Do you guys have any idea on how to get around this, and/or if you have done a similar job?
Thanks in advance!
  1 Comment
Hans Sunaryanto
Hans Sunaryanto on 15 Aug 2019
Just realized I forgot to attach the file - Here it is!

Sign in to comment.

Accepted Answer

Yair Altman
Yair Altman on 15 Aug 2019
I think it may be simplest to save the figure as PDF and then use one of the multiple available converters from PDF to DXF.
Yair Altman
Yair Altman on 15 Aug 2019
Well, it's really not complicated to automate this:
  1. save the temporary PDF file using saveas(hFig,'filename.pdf') or using the export_fig utility
  2. Then use the system() function to invoke the command-line version of your favorite PDF-to-DXF converter
  3. finally, call delete('filename.pdf') to delete the temporary PDF file

Sign in to comment.

More Answers (0)


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by