Missing lines with DXF import

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!
Post Reply
iwbnwif
Posts: 36
Joined: Thu Feb 23, 2017 7:39 pm

Missing lines with DXF import

Post by iwbnwif »

Hi, I am trying to import a building floor plan that was originally drawn in QCad and saved as a DXF.

The file opens perfectly in LibreCAD and also in DraftSight, but try as I may I cannot get it to work properly in FreeCAD (both 0.17 and tonight's 0.18).

Image in LibreCAD:
librecad.png
librecad.png (7.01 KiB) Viewed 3221 times
Image in DraftSight:
draftsight.png
draftsight.png (5.25 KiB) Viewed 3221 times
Image in FreeCAD:
freecad.png
freecad.png (1.48 KiB) Viewed 3221 times
I have tried exporting in various flavours of DXF and also as DWG from both LibreCAD and DraftSight, but the result is the same every time.

I have also tried deleting various parts of the drawing to see if there is a rogue line, and although there is some slight differences, the drawing is still incomplete.

Any help is very welcome!
User avatar
Wilson
Posts: 28
Joined: Fri Jul 13, 2018 6:50 pm
Location: Portugal
Contact:

Re: Missing lines with DXF import

Post by Wilson »

Could you share your dxf file so I could try it out and see if I can come with a solution for you?

*EDIT*: Also, one thing that sometimes solves problems with dxf is to select and copy to clipboard all objects from your dxf file, create a new dwg/dxf, paste all objects in this new file and save it with a new name. Then, import this new dxf to FreeCAD.
Syres
Veteran
Posts: 2900
Joined: Thu Aug 09, 2018 11:14 am

Re: Missing lines with DXF import

Post by Syres »

By default I believe the Legacy Python Importer is not checked, enabling this can fix a lot of DXF import problems. This is found in Edit menu > Preferences > Import-Export > DXF tab as per screenshot:
Edit_Preferences_DXF.jpg
Edit_Preferences_DXF.jpg (122.43 KiB) Viewed 3202 times
Click Apply and then OK to ensure the change is made.
iwbnwif
Posts: 36
Joined: Thu Feb 23, 2017 7:39 pm

Re: Missing lines with DXF import

Post by iwbnwif »

Firstly, thanks to both for replying.
Could you share your dxf file so I could try it out and see if I can come with a solution for you?
Of course, I should have done that. Attached now.
*EDIT*: Also, one thing that sometimes solves problems with dxf is to select and copy to clipboard all objects from your dxf file, create a new dwg/dxf, paste all objects in this new file and save it with a new name. Then, import this new dxf to FreeCAD.
Hmm, I tried that but it was exactly the same - still bits missing.
By default I believe the Legacy Python Importer is not checked, enabling this can fix a lot of DXF import problems. This is found in Edit menu > Preferences > Import-Export > DXF tab as per screenshot:
I wanted to try this, but was having a lot of problems installing the add-on (Add-on Manager kept freezing trying to populate the add-on list). However, I tried again just now and yes - it works 8-) !

I can continue to the next stage now.
Attachments
NONAME_1.dxf
(58.39 KiB) Downloaded 58 times
User avatar
Wilson
Posts: 28
Joined: Fri Jul 13, 2018 6:50 pm
Location: Portugal
Contact:

Re: Missing lines with DXF import

Post by Wilson »

I didn't know about the Legacy Python Importer, if that solved the problem that's the most important. In alternative, if you open your DXF with Draftsight, copy all objects to a new DXF file and import again, even with the Legacy Python Importer checked it seems to work. Attached you'll find the new DXF for you to try it out.
Attachments
NONAME.dxf
(108.71 KiB) Downloaded 84 times
iwbnwif
Posts: 36
Joined: Thu Feb 23, 2017 7:39 pm

Re: Missing lines with DXF import

Post by iwbnwif »

if you open your DXF with Draftsight, copy all objects to a new DXF file and import again, even with the Legacy Python Importer checked it seems to work. Attached you'll find the new DXF for you to try it out
Thank you, your DXF also works :)

I am not sure why I couldn't get the copy method to work last night, maybe it's because I was using Linux Mint. I will try again this evening.
User avatar
MarcX
Posts: 26
Joined: Tue Nov 28, 2017 1:15 pm
Location: France, Grenoble

Re: Missing lines with DXF import

Post by MarcX »

A few years ago I made my own command line interface tool for importing DXFs.

https://framagit.org/MarcusFecit/LibreCadToFreeCad

The tool can also detect basic constraints such as coincidence, tangentiality, horizontality, verticality, etc..

I now have improved it with a Pyside2 QT interface and even a Web interface (Flask).

I hope I will have some time this summer to clean the code, translate it to english and publish it.


What I can say about your DXF file is that the useful part of the design is far away from the origin. Is it what you want ?


Et bonne journée !
--
Marc BERLIOUX
Post Reply