How to import a DXF into SOLIDWORKS as a clean sketch, without hundreds of tiny segments
Drawing programs export curves as many short pieces, so a DXF often arrives as hundreds of lines, arcs and spline bits with tiny gaps, and the sketch is slow and will not extrude. SOLIDWORKS can merge close points on import and Repair Sketch finds some faults one by one. Clean DXF Import reads the file itself and cleans it before it becomes a sketch: pieces joined into whole lines, arcs, circles and splines, gaps closed, with a before and after preview.
Video (0:50, English): A logo DXF comes into SOLIDWORKS as 437 lines. Here it is as 71 real curves. Also on YouTube.
Why an imported DXF is such a mess
- Illustrator, Inkscape, CorelDRAW and many CAM or sign programs write a curve as a chain of short lines or of many small spline pieces. What looks like one outline is hundreds of entities.
- Ends that should meet miss each other by a few thousandths of a millimetre, pieces lie on top of each other, and some have no length at all. SOLIDWORKS then finds no closed contour: the sketch will not extrude, or only by selected contours.
- A sketch of many hundred entities is slow to open, to select in and to rebuild, and every later feature inherits that.
What SOLIDWORKS offers built in
- The DXF/DWG Import wizard can merge points that lie closer together than a distance you give. That closes many small gaps, but the pieces stay pieces.
- Repair Sketch (Tools › Sketch Tools) finds small gaps, overlaps and zero-length entities and repairs what it can. On a drawing with hundreds of faults you step through them.
- Fit Spline (Tools › Spline Tools) turns the segments you select into one spline. You pick the chains by hand, one curve at a time.
- Check Sketch for Feature tells you why a sketch will not extrude and points at the place.
A clean sketch with Clean DXF Import
- 01Select a plane or a flat face (or nothing for the Front plane), then
SWPlugins Suitetab › Clean DXF Import and pick the DXF or DWG file. - 02The file is read and cleaned before anything is written. The message says what happened: how many pieces became how many lines, arcs, circles and splines, how many closed loops there are and how many ends are still open.
- 03The Task Pane shows the drawing before (every piece in its own colour) and after (lines blue, arcs green, circles orange, splines grey, open ends as red dots). A file with layers lists them: untick a frame or dimensions.
- 04If red dots remain, raise Close gaps up to. If small nicks or specks should go, raise Remove details smaller than. The automatic tolerances follow the size of the drawing.
- 05Curves as = Arcs if the sketch goes to a machine that takes no splines.
- 06OK writes the sketch: plain SOLIDWORKS lines, arcs, circles and splines, the ends that belong together on exactly the same point.
A sketch that is already in the part
SWPlugins Suite tab › Clean Sketch does the same for an existing sketch, for example one imported the usual way some time ago: the same options, the same before and after preview, and OK replaces the sketch’s geometry with the cleaned one. Relations and dimensions on the replaced entities are lost, so clean first and dimension afterwards.
Good to know
- One logo we measured arrived as 437 entities through the built-in import and as 71 after cleaning, with the same outline.
- Text, hatches, dimensions and images in the file are left out; the message lists what was skipped.
- The result does not depend on the add-in: the sketch opens and solves on any SOLIDWORKS, with or without it.
- Above 200 entities the sketch is written a faster way that Ctrl+Z does not take back: save the part first when you clean inside an existing sketch.
Try it on your own part
Clean DXF Import, Clean Sketch are part of Advanced Sketching, a module of the SWPlugins Suite, a SOLIDWORKS add-in (2023 or newer). Every tool works free for 14 days; a licence is €149.25 plus VAT for the whole Suite, single modules from €44.25 (launch price until 30 November, regular €199 and from €59), one-time.
Docs: Clean DXF Import · Clean Sketch
Questions
Yes. A DWG is read through SOLIDWORKS’ own import (a new part appears for a moment and closes again) and then cleaned the same way. Layers are only available for DXF files.
No dimensions. Add basic relations is an option, off by default: it only states what the drawing already is, such as shared ends, exactly horizontal or vertical lines and tangent joins.
Yes. With Curves as = Arcs every free curve becomes arcs and lines end to end, within the fit tolerance you set.