Always broken face when importing DXF to sketch

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!
JackOfDiamonds
Posts: 7
Joined: Fri May 22, 2020 5:12 am

Always broken face when importing DXF to sketch

Post by JackOfDiamonds » Fri Nov 13, 2020 6:04 pm

Please note this happens any time I have tried to import a DXF and extrude it, no matter how simple the DXF is. So I think I have a workflow problem.

What I'm trying to do:
[*]I create a DXF drawing of a sprocket in LibreCAD
[*]I import to FreeCAD. I get a bunch of arcs.
[*]I use Draft Workbench to convert the arcs to sketches (I also tried combining arcs first using the Up Convert tool in Draft, but I get an error that items cannot be upconverted)
[*]I use Sketcher to merge all the sketches into one big sketch
[*]I use Sketch Validator to find about 177 missing coincidences. I fix them. Despite this, Sketcher still tells me my shape is un-constrained, with about 500 degrees of freedom. I am not sure if the shape has to be fully constrained in order to be extruded. It seems very difficult to make this complex shape fully constrained. If so, I need help to do it.
[*]I cannot extrude the shape due to "unable to validate broken face" error. I don't see any obvious geometric things that would prevent extrusion (open gaps, crossed lines, concentric circles, etc.
[*]To troubleshoot, I tried turning all lines into construction lines except the center circle. It extrudes fine. Then I did the same thing and tried to extrude one of the cut-out shapes by itself. I get a failed to validate broken face error even on a single cut-out shape. I also tried to extrude just the tooth profile, with all the other lines converted to construction lines. So there is something wrong that I can't figure out, why the imported sprocket shape, even portions of it, are giving a broken face error, even when they portions are relatively simple shapes.
[*]I have identified a weird dot in the sketcher view. I can't figure out what entity this dot corresponds to or if it's part of the problem. I cannot extrude




OS: Linux Mint 19.3 Tricia
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.
Build type: None
Python version: 2.7.14+
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.9.1.oce-0.18
Attachments
weirdDot.png
weirdDot.png (55.78 KiB) Viewed 277 times
30t_swirled.fcstd
(25.87 KiB) Downloaded 14 times
30t_swirled.dxf
(45.86 KiB) Downloaded 16 times

User avatar
sgrogan
Posts: 6205
Joined: Wed Oct 22, 2014 5:02 pm

Re: Always broken face when importing DXF to sketch

Post by sgrogan » Fri Nov 13, 2020 7:19 pm

JackOfDiamonds wrote:
Fri Nov 13, 2020 6:04 pm
Please note this happens any time I have tried to import a DXF and extrude it, no matter how simple the DXF is. So I think I have a workflow problem.
1) import your dxf
2) delete the "circle" and the 2 points on top of each other from your screen shot
3) Draft to Sketch
4) Sketch validate and fix (176 missing coincidences)
5) Part Extrude
Capture.PNG
Capture.PNG (19.26 KiB) Viewed 252 times
swirled.FCStd
(64.8 KiB) Downloaded 8 times
EDIT: its not 2 points it's a collapsed arc, more clear from your sketch in the .FCStd file
Last edited by sgrogan on Fri Nov 13, 2020 7:37 pm, edited 1 time in total.
"fight the good fight"

JackOfDiamonds
Posts: 7
Joined: Fri May 22, 2020 5:12 am

Re: Always broken face when importing DXF to sketch

Post by JackOfDiamonds » Fri Nov 13, 2020 7:33 pm

Thank you for helping troubleshoot; I am happy you were able to get it to work. For me, there is still something fishy.

You mention deleting a circle and two points on each other. I'm not sure what you mean.

I tried again with deleting the axle circle, with same results.

The part of my screenshot that I circled (dot/sots at the bottom) does not appear for me until I merge all the sketches together. The imported DXF turns into 177 arcs and 1 circle (the center circle). There are no points, just 177 arcs and 1 circle.

When I import the DXF, I can scroll through the list of the arcs and I never see anything like that dot at the bottom. I can also use Shift+B to drag a big box around the whole drawing, and the drawing is selected, but there is no dot like that.

After I convert all the arcs to sketches, I still don't find any sketch that corresponds to that dot, and the dot is still not visible anywhere. I can scroll through the list of sketches, and the lines in the drawing all light up, but there is nothing there at the bottom.

After I merge the sketches together, instantly I can see that dot at the bottom. I can click on the dot, and it turns green, just like any other dot, but I can't delete it because pressing Delete deletes the whole sketch then.
Last edited by JackOfDiamonds on Fri Nov 13, 2020 7:40 pm, edited 1 time in total.

User avatar
sgrogan
Posts: 6205
Joined: Wed Oct 22, 2014 5:02 pm

Re: Always broken face when importing DXF to sketch

Post by sgrogan » Fri Nov 13, 2020 7:40 pm

JackOfDiamonds wrote:
Fri Nov 13, 2020 7:33 pm
After I merge the sketches together, instantly I can see that dot at the bottom. I can click on the dot, and it turns green, just like any other dot, but I can't delete it because pressing Delete deletes the whole sketch then.
I was editing my previous post as you were posting. To delete the points (which are actually the end points of a collapsed arc) you must be in sketch edit mode. Double click the sketch in the tree.
"fight the good fight"

User avatar
Roy_043
Posts: 2344
Joined: Thu Dec 27, 2018 12:28 pm

Re: Always broken face when importing DXF to sketch

Post by Roy_043 » Fri Nov 13, 2020 7:46 pm

In the workflow that sgrogan proposes coincident constraints are applied, and in the process inaccuracies in the DXF are fixed. It is those inaccuracies that are the root cause of your problem. Maybe you can specify a higher number of decimals in LibreCAD?

JackOfDiamonds
Posts: 7
Joined: Fri May 22, 2020 5:12 am

Re: Always broken face when importing DXF to sketch

Post by JackOfDiamonds » Fri Nov 13, 2020 7:52 pm

sgrogan wrote:
Fri Nov 13, 2020 7:40 pm
JackOfDiamonds wrote:
Fri Nov 13, 2020 7:33 pm
After I merge the sketches together, instantly I can see that dot at the bottom. I can click on the dot, and it turns green, just like any other dot, but I can't delete it because pressing Delete deletes the whole sketch then.
I was editing my previous post as you were posting. To delete the points (which are actually the end points of a collapsed arc) you must be in sketch edit mode. Double click the sketch in the tree.
This was part of the layered problem...even when I was in sketch edit mode, I clicked on the dot and hit delete, and nothing would happen. That's because it was a collapsed arc, and clicking the endpoints of an arc and hitting delete doesn't delete it, and it doesn't highlight it in the viewer either. You have to select the arc itself. So I had to drag a box around it, which selected the "arc", and it was also highlighted in the viewer, and I could delete it. Then when I hit the Delete key it actually deleted it. I was able to extrude the shape then.

Thanks to your help I found the problem is apparently a "nuisance" arc that was generated at some point, and since it was collapsed, I couldn't see it or select it easily to find it. I don't know if this was generated during the DXF import process, or if there's something wrong with the LibreCAD files, but I will try some other LibreCAD files and see if I learn anything.

User avatar
sgrogan
Posts: 6205
Joined: Wed Oct 22, 2014 5:02 pm

Re: Always broken face when importing DXF to sketch

Post by sgrogan » Fri Nov 13, 2020 7:56 pm

JackOfDiamonds wrote:
Fri Nov 13, 2020 7:33 pm
There are no points, just 177 arcs
Indeed if I go back to your .dxf and zoom way in on the "point" it is an arc with it's endpoints <0.001mm apart. The Sketch validate find and fix collapses it to zero. It's Arc059 in the original .dxf
"fight the good fight"

chrisb
Posts: 30483
Joined: Tue Mar 17, 2015 9:14 am

Re: Always broken face when importing DXF to sketch

Post by chrisb » Fri Nov 13, 2020 8:58 pm

JackOfDiamonds wrote:
Fri Nov 13, 2020 6:04 pm
Version: 0.16.
Your version is very outdated, so this may not apply to your version: You can set in Preferences->Import-Export->DXF to join the geometry on import. That saves you the step with the validation tool.

There are thousands of improvementsand many many bugficxes in 0.19. So I really recommend to upgrade. If you use PartDesign, be prepared to learn a new workflow.

If you do the modeling yourself, why not model it right away in FreeCAD? You could model one tooth and multiply it using Draft->PolarArray.
You need at least FreeCAD 0.19.23300 to edit my current sketches.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.

JackOfDiamonds
Posts: 7
Joined: Fri May 22, 2020 5:12 am

Re: Always broken face when importing DXF to sketch

Post by JackOfDiamonds » Fri Nov 13, 2020 10:53 pm

The changed Part Design workflow is what has stopped me from upgrading. I heard that and decided to wait. I am just learning 3D printing, and I don't want to introduce changes when I've just started to become productive with Part Design. I understand it's inevitable however especially if I have problems. Here is my ThingiVerse

https://www.thingiverse.com/jackofdiamonds/designs

The proper sprocket tooth profile is a little hard to generate correctly from first principles; I didn't design it myself. Instead I got the DXF of the tooth outline generated by an online sprocket generator. Then I imported the DXF to LibreCAD to add the designs because it was before I got into 3D printing and LibreCAD was all I had. Now, I might import the sprocket profile directly into FreeCAD instead, but I still use LibreCAD for most 2D drawing.

I recently started using FreeCAD sketcher for bike frames instead of LibreCAD and it's very interesting to be able to enter the bike geometry dimensions as constraints; this enables something like a parametric drawing that you can change the geometry and the sketch will update without having to "re-draw" it every time. If the constraints could be tabulated into a form you would almost have a fully parametric bike-frame-drawing program. I am still using LibreCAD to draw small laser-cut parts, but I can see myself using FreeCAD more for 2D, especilly if importing DXFs from LibreCAD keeps being a pain.

drmacro
Posts: 2304
Joined: Sun Mar 02, 2014 4:35 pm

Re: Always broken face when importing DXF to sketch

Post by drmacro » Fri Nov 13, 2020 11:10 pm

I haven't use 0.18 for nearly 2 years.

i don't remember any workflow changes...I be interested to know what I've forgotten. :oops:
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."

My beginners, written treatise: Learning FreeCAD

Post Reply