Draft mapping files/de

Das Draft-Modul kann Dateien importieren, die mit jedem Programm erstellt wurden, das im DXF-Format exportieren kann. Da sich FreeCAD aber sehr von AutoCAD und anderen üblichen 2D-CAD-Programmen unterscheidet, möchte man vielleicht automatisch DXF-Entitäten in FreeCAD übersetzen.

For example 2D CAD programs often use a black background, so you make your drawing using bright colors, like yellow, green, etc. Then, when you want to print your drawing, those ugly colors will be mapped to nice black colors with different linewidths.

Since FreeCAD is not an AutoCAD clone, we don't need to stick to those ugly colors. The concepts of colors, linewidth, or layers are actually very different in FreeCAD. So, we can take advantage of this new environment and work, for example, with black lines on white background. We can also use different linewidths, so our drawing will look on the screen pretty much the same way as it will be printed (note that printing your drawing from FreeCAD is still not supported at the moment, a little bit more patience!).

To use a mapping file, simply navigate to Edit -> Preferences -> Draft -> dxf settings and select those two options:
 * Import style: Map colors to linewidths
 * Mapping file: navigate to a .csv file (see below)

These settings will then be your defaults next time you import a DXF file.

The Draft module accepts two types of .csv (comma- or tab-separated file) as mapping file:

converting from autocad plot styles
AutoCAD saves its plot styles as .CTB files. If you open your plot style manager from AutoCAD, you will actually open an explorer window showing the location where those files are saved. The DXF importer cannot use these files directly because, you will have guessed, they are encoded. Fortunately, there is a nice free CTB viewer & converter that can convert CTB files to TAB-separated CSV files. The .csv files generated by this program can be used immediately, they can also be edited with any spreadsheet application.

making your own .csv files
Making your own mapping files is very easy too. It can be made in a spreadsheet application or in any text editor. The rule is simple: you need 3 columns separated by a tabulation (hit the TAB key). First column is the AutoCAD color, second column is the FreeCAD linecolor RGB value formatted like this: 255,255,255 and the third column is the FreeCAD linewidth in pixels. The first line won't be read. So, you can make one like this, for example:

The above table would convert color 1 (red) to black (0,0,0)/1 pixel, color 2 (yellow) to black/2 pixels, color 8 (darkgrey) to some dark shade of grey(80,80,80) and 1 pixel wide, etc, etc. You can specify only the colors that you need. What you didn't specify will receive default color/linewidth.

Don't forget that the first line won't be used, so you can use it for writing column titles for example. If you write a .csv file in a spreadsheet application (such as OpenOffice), be careful that sometimes your spreadsheet will think that something written 100,100,100 is one number (hundred million one hundred thousand hundred) and will want to remove the commas. Also, when you save the file as .csv, be sure to specify that it must be TAB-separated and not COMMA-separated.