DXF Export Not Working

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
rnwest
Posts: 12
Joined: Tue Oct 16, 2018 12:36 pm

DXF Export Not Working

Postby rnwest » Thu Jan 24, 2019 5:28 pm

Hello,
I tried to export the attached FreeCAD sketch as a DXF file:
sketch.png
sketch.png (132.14 KiB) Viewed 915 times
The option 'Allow FreeCAD to automaticaly download and update the DXF libraries' is enabled under Edit->Preferences. I select the sketch (Sketch004) in the tree, then go to File->Export and choose 'Autodesk DXF 2D' as the filetype. When I import the file into FreeCAD again, the result looks nothing like the original sketch:
dxf_import.png
dxf_import.png (103.81 KiB) Viewed 915 times
I attached both the FreeCAD file as well as the resulting DXF file. Any help would be greatly appreciated, I've tried to solve this for hours and have gotten nowhere so far. I need to export the sketch as DXF as it will be manufactured on a water jet cutter and the (ancient) software only accepts dxf.
All the best,
Nat

Version info:
OS: Linux
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.13541 (Git) AppImage
Build type: None
Branch: releases/FreeCAD-0-17
Hash: 9948ee4f1570df9216862a79705afb367b2c6ffb
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedKingdom (en_GB)
Attachments
sketch.FCStd
(9.94 KiB) Downloaded 11 times
sketch.dxf
(3.31 KiB) Downloaded 10 times
openBrain
Posts: 2165
Joined: Fri Nov 09, 2018 5:38 pm

Re: DXF Export Not Working

Postby openBrain » Thu Jan 24, 2019 6:02 pm

Hi,

First noticeable thing is that if I recompute your design, an error is raised at "Sketch" with invalid reference to Spreadsheet.
You should fix it.
Then your sketch is not fully constrained, but I'm not sure it minds for DXF export purposes. ;)
rnwest
Posts: 12
Joined: Tue Oct 16, 2018 12:36 pm

Re: DXF Export Not Working

Postby rnwest » Thu Jan 24, 2019 6:17 pm

openBrain wrote:
Thu Jan 24, 2019 6:02 pm
Hi,

First noticeable thing is that if I recompute your design, an error is raised at "Sketch" with invalid reference to Spreadsheet.
You should fix it.
Then your sketch is not fully constrained, but I'm not sure it minds for DXF export purposes. ;)
Thank you openBrain for your answer. The sketch was originally part of a larger file, and probably included references to a spreadsheet as well, but i deleted everything but the sketch, to have a minimal example (I thought the sketch didn't have any references to the Spreadsheet, but it looks like I was wrong). When I open the file and run App.activeDocument().recompute() in the Python console, the result is '0' (which I assume means no error). For version info, see above. But I can assure you that the dxf export problem was there before I deleted the spreadsheet :)

Edit: I attached a fully constrained version to this post. I am pretty sure that the sketch no longer contains any references to the Spreadsheet that existed previously (I deleted and readded any constraints which could have been set by the spreadsheet previously). The problem persists.

2nd Edit: I was wrong, there were still some spreadsheet references in the file. Scroll down for a version without any references. But this still doesn't solve the problem.
Attachments
sketch_constrained.fcstd
(9.89 KiB) Downloaded 8 times
Last edited by rnwest on Thu Jan 24, 2019 8:31 pm, edited 1 time in total.
Roy_043
Posts: 504
Joined: Thu Dec 27, 2018 12:28 pm

Re: DXF Export Not Working

Postby Roy_043 » Thu Jan 24, 2019 7:38 pm

The orientation of the sketch seems to be the main issue. With the values in the image a correct DXF is exported (tested with BricsCAD). But when you import the file back into FC the nested triangular shape is missing. To fix that: Check the 'Project exported objects along view direction' option, switch to the Top view and export again. This 2nd DXF does not have any polylines. Note that in both DXFs the linework is nested in a block.
Attachments
Sketch_ProjectAlongView.dxf
(3.97 KiB) Downloaded 8 times
Sketch_Default_Settings.dxf
(3.47 KiB) Downloaded 6 times
Sketch_DXF.png
Sketch_DXF.png (8.53 KiB) Viewed 891 times
GeneFC
Posts: 1025
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: DXF Export Not Working

Postby GeneFC » Thu Jan 24, 2019 8:09 pm

rnwest wrote:
Thu Jan 24, 2019 6:17 pm
Edit: I attached a fully constrained version to this post. I am pretty sure that the sketch no longer contains any references to the Spreadsheet that existed previously (I deleted and readded any constraints which could have been set by the spreadsheet previously). The problem persists.
There are still about 6 references to a spreadsheet in your "corrected" file. Look for the constraints that have a small fx symbol at the right edge of the constraint panel.

Gene
rnwest
Posts: 12
Joined: Tue Oct 16, 2018 12:36 pm

Re: DXF Export Not Working

Postby rnwest » Thu Jan 24, 2019 8:28 pm

GeneFC wrote:
Thu Jan 24, 2019 8:09 pm
There are still about 6 references to a spreadsheet in your "corrected" file. Look for the constraints that have a small fx symbol at the right edge of the constraint panel.

Gene
Thank you Gene for your hint. I have attached a corrected version to this post. This is very odd though, the constraints that referenced the spreadsheet in the previous version were all coincidence and symmetry constraints. As far as I understand, spreadsheets can only be used to constrain lengths, distances, diameters,... i.e. 'numeric' values, using a cell value. But why do coincidence and symmetry constraints contain spreadsheet references??

Nat
Attachments
sketch_constrained_no_refs.fcstd
(9.78 KiB) Downloaded 7 times
GeneFC
Posts: 1025
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: DXF Export Not Working

Postby GeneFC » Thu Jan 24, 2019 8:49 pm

rnwest wrote:
Thu Jan 24, 2019 8:28 pm
But why do coincidence and symmetry constraints contain spreadsheet references??
My typical response to this sort of question is that when improper references are made or other errors occur all bets are off. There can be various strange consequences. In this case probably some indexing error that tried to apply the missing spreadsheet constraints to the wrong elements in the sketcher.

If this is somehow a consistent pattern then it might be a bug. In the present case it is probably nothing.

Gene
openBrain
Posts: 2165
Joined: Fri Nov 09, 2018 5:38 pm

Re: DXF Export Not Working

Postby openBrain » Thu Jan 24, 2019 9:07 pm

Now with latest file, each time I recompute the following warning arised :
Sketcher::SketchObject / Sketch004: Links go out of the allowed scope
openBrain
Posts: 2165
Joined: Fri Nov 09, 2018 5:38 pm

Re: DXF Export Not Working

Postby openBrain » Thu Jan 24, 2019 9:14 pm

Got it thanks to the Dependency Graph.
I just remapped the Sketch004 to the XY_Plane011 so it is correctly linked to origin.
I selected top view (don't know if it change something) and exported Sketch004 to DXF ... and everything runs seamlessly. :)

EDIT : here again I have to use the Legacy Importer to correctly import back the DXF to FC

EDIT2 : maybe the original problem comes from fact that DXF exporter uses a Z-axis view to process (don't quote me it's a guess :lol: ) -> I did a quick test with the first attached file. Mapping plane changes nothing (YZ also works). Just fixing the problem of bad origin linkage makes the DXF export to work correctly (even with the Spreadsheet errors).
User avatar
meme2704
Posts: 2926
Joined: Sat Apr 01, 2017 2:47 pm
Location: Vosges

Re: DXF Export Not Working

Postby meme2704 » Fri Jan 25, 2019 8:41 am

Hi
Check the 'Project exported objects along view direction' option,
I do not find this option,
but not serious, I have my solution /
I extract the original sketch (minimal thickness)
using "Position, I place the object on the XY plane,
and exports it in DXF
Attachments
sketch_dxf.PNG
sketch_dxf.PNG (68.08 KiB) Viewed 841 times