Rhino DXF vs. FreeCAD / KiCad

draft.3dm (475.9 KB) as it appears in Rhino:

The exported DXF draft.dxf (6.4 KB, R12 Lines & Arcs) as it appears in FreeCAD:

The circle on the right has moved to the left. The same issue exists with KiCad:

Independent of who is to blame, is there any way to fix this?

Hmm, seems odd. Here is what is written in the .DXF for the circles. The highlighted numbers are the X and Y coordinates of the circle centers.

image
image
image

Why the last one gets a negative X coordinate I have no idea. Its direction is flipped relative to the others maybe that’s a problem for DXF R12 - which is a really old, primitive DXF version? But that’s why it moves to the left I think. I guess Rhino has a way of interpreting the other data that allows it to import correctly, but the others don’t.

Solutions - flip the last circle? Use a different DXF scheme for export?

Here is an R12 DXF export with the last circle flipped:

draft-flip.dxf (6.4 KB)

Does that come in correctly?

Edit: I did notice that your circles in draft.3dm are “NURBS circles” (old Rhino V2 style circles) and not pure circle entities. How did you make those? But that does not seem to be part of the flip problem.

2007 Natural has the same issue. 2007 Polylines works.

When I redraw the NURBS circles with _Circle, then even R12 Lines & Arcs works. Alternatively, and more conveniently, I found I can use _Convert with Output=Arcs and SimplifyInput=Yes.

Yes.

_Make2d, as I thought that may help.

Just run SimplifyCrv on them… In DXF R12, it’s supposed to do that automatically on export anyway by default.

I wouldn’t do that.

Tried that before, didn’t work.

Hmm, worked here on your draft.3dm - to simplify the elements to circles - however the flip problem remains.
@lowell - any input on this?

It looks like problematic are arcs (and circles) that I created using _Mirror. Also arcs possibly may need to be drawn counter clockwise.

Yes, that flips the direction of a curve or surface. However, it seems like that shouldn’t matter - it obviously doesn’t to Rhino, but other programs may not be so reasonable. Maybe the Rhino exporter needs to be looked at though.

Does this do any good?

Enabling Flip arc normals to +Z does the trick, at least with my example. I enabled it for R12 Lines & Arcs.

So DXF stores the normal (up/down) with each object?

Glad it helps.

Some are defined relative to a plane. Circles, arcs, some kinds of plines, annotations etc. It’s roughly the same in Rhino and Acad as far as that goes, and the plane has an up and down.

If you mirror arcs, then the curve direction gets reversed. As far as I know, the ‘plane’ is determined by the direction of the arc (counterclockwise is ‘up’), so mirrored ccw arcs/circles end up as clockwise and thus end up with a ‘down’ facing plane (correct me if I’m wrong).

That’s the subjective effect, but it’s driven by the plane definition changing, not the arc definition changing.
Maybe think of it as drawing an arc on some clear film and flipping the film over.
The drawing doesn’t change but the image goes in the other direction with respect to the table.

Thanks for the explanation. If not too much effort, can you give a code example, showing how the direction is encoded in the DXF?

As far as I understand it now, this is a bug in FreeCAD and KiCad, and I want to report it. It may be possible that they use the same DXF import library.

But the plane definition is part of the arc definition…

When you mirror something the axis perpendicular to the mirror plane is inverted (i.e. if the mirror plane is the world YZ plane, the X axis is inverted, +x becomes -x). Because a right handed coordinate system is enforced, this 'flips" the plane’s Z axis to the other side, which indeed results in the arc direction (start>end) being reversed from that of the original object when viewed from the same direction.

Which is totally correct, but I have a feeling some 2D CAD programs do not have any concept of 3D and thus the ‘backwards’ facing Z axis is not taken into account, only the arc direction viewed from +Z.

I’m assuming that the ‘Flip arc normals to +Z’ setting was designed for exactly this situation - I just never really looked at it that closely, having never used a program that had a need for it.

@feklee I would just copy the DXF R12 export scheme and change the arc setting to ‘flip’ as above, then name the copy of the export scheme something like ‘Freecad’. Since there are so many programs out there that take .dxf files and each one has different requirements/quirks, you may find yourself using a number of different export schemes. What’s cool about Rhino is that you can configure the exports to do just about anything other programs need.

1 Like

@feklee - This explains the dxf definition: http://help.autodesk.com/view/OARX/2018/ENU/?guid=GUID-0B14D8F1-0EBA-44BF-9108-57D8CE614BC8

1 Like

@feklee did you report this to FreeCAD or KiCAD? I’ve just checked in FreeCAD 0.19 pre and it’s still doing this.

As it’s possible to make Rhino export in a DXF format that KiCad can read, I didn’t bother to report the issue. See earlier conversations in this thread.