9 Replies Latest reply on May 20, 2014 11:47 AM by Jamil Snead

    Extracting sketches to DXF with layers

    Michael Paauwe

      Hi All,

      I want to extract all the 2D sketches in a part to a single DXF file.

      The catch is that I need to have each sketch on a separate layer.

      I have come close to this by selecting the sketches and copying (ctrl-C) and pasting (ctrl-V) to a new part.  Then I can save the part as DXF.

      I can also make all the sketches visible (right click and select show on each sketch and make sketches visible from the view menu), then hide the solid bodies and save as DXF.


      The problem with both these options is that the sketches all end up on layer 0 and I can't separate them.


      Can anyone think of a way to get the sketches onto separate layers or group the elements together?


      Thanks in advance.

        • Re: Extracting sketches to DXF with layers
          Scott McFadden


          I think you are close in your methods.  Why don't you past the sketches into a Draftsight 2D drawing.

          Create your layers, then change the sketches to those layers then export that out as a dxf file.

          • Re: Extracting sketches to DXF with layers
            Lenny Bucholz

            what does the part look like? pic would help.


            you could make configurations of the part then save as dxf at each config, then import to draftsite and put on different layers.


            there is not a simple way and my question is why is this needed? laser cutting, water jet, old CAM software????


            I may have some other ways to get what you need if you let us know what its for.


            I'm a machinist\model maker\prototyper and fixer and would be glade to help ya out!

              • Re: Extracting sketches to DXF with layers
                Michael Paauwe

                Hi Lenny,

                The part is a ceramic electronic component.  It is manufactured in layers, much the same way that a PCB is manufactured.  The fabrication process requires artwork in DXF format for each layer.  We also do FEA on the package design for electrical performance. Currently we design in 2D and import into a 3D environment for FEA.  We want to switch to designing in 3D and export to 2D but without being able to easily export the sketches this will be more work.

                  • Re: Extracting sketches to DXF with layers
                    Lenny Bucholz

                    Are you making a part file or parts in an assembly?


                    If a part with configs you can make one drawing, lock the views in place and then save a dxf out at each config state of the views


                    then import to your 2d package and then set each one to its own layer. But sounds like 2d to 3d is better, less monkey fartin around, but maybe not, you just have to develope your own way to make it work and after a while it becomes the norm.


                    I was just playing with a part file to dxf and as long as you pick the origin and open the dxf in the same SW drawing the 2d will come in in the same location, then you can move the geom to where you want it after all is brought in.

                • Re: Extracting sketches to DXF with layers
                  Leigh Christie

                  There is one work around. If it's a sheetmetal part, you can save the geometry (the outline of the part) on a spearate layer from all of the sketches. For parts that you plan to cut out on a waterjet or lasercutter this can be useful since your "score" lines can be sketches and the geometry is a separate layer. But that's about all you can do because solidworks has a limited selection of "entities" when mapping dxf files.

                  • Re: Extracting sketches to DXF with layers
                    Leigh Christie

                    I should also mention that if you map the "sketches" you'll get a lot of stuff you don't want and it will make it harder because you'll have to go in and delete a bunch of the lines manually in Rhino or AutoCAD or Omax or whatever you use when you're waterjet cutting or laser cutting. There is a trick, and I think it relies on a bug in the "map colours" dialog box.


                    step -1) create a solidworks file that has an extruded flat shape with some sketches on it's surface.

                    step 0) make your part into a sheet metal part (even if it has no beds)

                    step 1) Save as DXF, click options

                    step 2) check off the "custom map solidworks to dxf -> enabled"

                    step 3) under entities to export, select "sketches" and deselct geometry (you can include geometry if you want and put it on a different layer, but this "trick" does not require that"

                    step 4) click ok and the "solidworks to dxf mappin" dialog box should pop up

                    step 5) under "define layers" keep layer 0 on, change it's colour to black, and delete any others (not sure if this matters)

                    step 6) under map entities, delete everything leave it blank

                    step 7) under map colours, select a SW colour of say pink and then a DXF colour of say blue, and then you switch the SW colour to black... you're sketches will now show up in white, and the geometry will show up in the colour you chose for the DXF.

                    step 8) you now have a single layer with both the outline of the part in one colour (whatever you selected for the DXF colour in step 7) and the sketches in white. Take this DXF file into your favoirte 2D editor (I prefer Rhino because the scripting is super easy). Within that editor you should be able to select by colour and thus you will have sketches separate from the geometry.


                    This process is particularly useful when you want to create score lines (different from bend lines) within SolidWorks. Of course you can just export the SW sheet metal bend lines to different layers and then run a script to create the score lines in Rhino... but sometimes people like to have their score lines really clear in their SolidWorks models so that when they update the model the score lines update parametrically. If you do a lot of laser cutting, waterjet cutting, 2D milling, plasma cutting, or wire EDM the above trick is really useful. That said, I highly recomend that you learn some basick rhino scripting since it wills save you a LOT of time.


                    I should also mention that if you don't use the above trick when exporting "sketches", you'll end up having to go in and delete the geometry outlines in the sketch manually since they will be the same colour as the sketches.


                    Again, step 7 is basically exploiting a bug that makes it so that the "geometry" of the sketches is exported as

                    • Re: Extracting sketches to DXF with layers
                      Jamil Snead

                      Here's an easy solution:


                      1. Bring the part into a drawing in SolidWorks.

                      2. Create the different layers you need in the drawing (save it as a template with the layers so it goes faster next time).

                      3. On each layer convert the sketch that should be on that layer.

                      4. Save as dxf.