利用者:Cnd/Extensions:2.6/Py/Scripts/Import-Export/DXF Importer

提供: wiki
2014年9月10日 (水) 18:34時点におけるwiki>Cndによる版 (DXF to CURVES:)
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先: 案内検索

Autodesk DXF Importer

DXF Importer
Import AutoDesk DXF
UI location Import
Usage Import DXF drawings
Version 0.8.5 Author(s) Lukas Treyer, Manfred Moitzi
Blender 2.72 License GNU General Public License (GPL)


Executable information
File name ?



General Remarks

  • DXF-Layers are reflected as Blender-groups
  • This importer uses a general purpose DXF library called dxfgrabber
  • The pre 2.72 DXF importer can be found here

DXF Type Mapping

In order to be as non-destructive as possible the importer aims to map as many DXF types to Blender curves as possible.

DXF to CURVES:

  • LINE as "POLYLINE"-curve (with the option to merge connecting lines)
  • (LW)POLYLINE, (LW)POLYGON as "POLYLINE"-curve if they have no bulges else as "BEZIER"-curve
  • ARCs, CIRCLEs and ELLIPSEs as "BEZIER"-curves
  • HELIXes (3D) as "BEZIER"-curves

DXF to MESHES:

  • MESH is mapped to a mesh object with a SubD modifier, incl. edge crease
  • POLYFACEs and POLYMESHes are imported to a mesh object
  • 3DFACEs, SOLIDs, POINTs are imported into one combined mesh object per layer called layername_3Dfaces.

Missing DXF Types:

  • Hatches
  • Leader

Options

DXF Import Options
  • Merge Options
    • Blocks As: DXF Blocks can be imported as linked objects or group instances. Linked objects use parenting for DXF 'sub-blocks' (blocks in blocks).
    • Parent Blocks to Bounding Boxes: draw a bounding box around blocks
    • Merged Objects: Since Blender (v2.71) is pretty slow at adding objects the user might want to merge similar dxf geometry to one object. It is possible to merge geometry by layer and by layer and DXF type. The first produces one object per layer; if there is mesh, curve, lamp, text data on one layer one object per layer and per Blender object. The second not only differentiates between Blender data types but also DXF types, such as POLYLINE and POLYGON.
    • Combine LINE entities to polygons: Separated lines in DXF might be merged to one consecutive Blender POLY curve. Similar to Remove Doubles but for curves.
  • Line thickness and width:
    • Represent line thickness/width: DXF line attributes thickness and width have an effect on line in z and x/y direction respectively. A straight line might be turned to a cube by its attributes for instance. Therefore in Blender these attributes are represented with curve extrusion, Bevel and Taper objects.
    • Merge by attributes: If both Merged Objects and Represent line thickness/width are activated the object merging needs to be extended to separate all lines width different thickness and width. With Merge by attributes this separation option is also available without the actual representation of line thickness and width.
  • Optional Objects
    • Import TEXT entities (TEXT, MTEXT)
    • Import LIGHT entity, incl. support for AutoCAD colors
    • Export ACIS Entities: export NURBS 3D geometry (BODY, REGION, PLANESURFACE, SURFACE, 3DSOLID) to ACIS-Sat files, since this is the format AutoCAD stores NURBS to DXF. The user is being notified about the amount of stored .sat/.sab files.
  • View Options
    • Display Groups in Outliner(s): switch outliner display mode to GROUPS (DXF layers are mapped to groups)
    • Import DXF file to a new scene
    • Center geometry to scene: center the imported geometry to the center of the scene; the offset information is stored as a custom property to the scene

Geo Referencing

Geo Referencing Options: If a scene has a geo reference already, the scene SRID is set automatically and (when using pyproj) a DXF SRID MUST be set. Unit Scale is used to scale coordinates (e.g. centimeter to meter)
Scene Custom Properties set by Geo Referencing
  • Important: DXF files do not store any information about the coordinate system / spherical projection of its coordinates. Best practice is to know the coordinate system for your specific DXF file and enter this information in the DXF importer interface as follows:
  • PyProj: Installation: Download (WIN, MAC) pyproj and copy it to your AppData/ApplicationSupport Folder/Blender/2.70/scripts/modules/. In case you need to compile your own binary refer to this post on blenderartists. pyproj is a python wrapper to the proj library, a well known C library used to convert coordinates between different coordinate systems. Open source GIS libraries such as "proj" are used directly or indirectly by many authorities and therefore can be considered to be well maintained. If pyproj is available the DXF importer shows a selection of national coordinate systems but lets the user also to enter a custom EPSG / SRID code. It also stores the SRID as a custom property to the blender scene. If a scene has already such a SRID property the coordinates are being converted from your DXF file to target coordinate system and therefore you MUST specify a SRID for the DXF file. If no SRID custom property is available the scene SRID is by default the same as the DXF SRID.
  • No PyProj: In case pyproj is not available the DXF importer will only use its built-in lat/lon to x/y converter. For the conversion we use the "transverse mercator" projection that asks for a lat/lon coordinate to be used as the center of the projection. The lat/lon coordinate is being added to your scene as a custom property. Subsequent imports will convert any lat/lon coordinates to the same geo reference. Important: So far only lat/lon to x/y conversion is supported. If you have a DXF file with euclidean coordinates that refer to another lat/lon center the conversion is not (yet) supported.
  • Rules of thumb for choosing an SRID: if you have your data from openstreetmap or some similar GIS service website and exported it with QGIS or ArcGIS the coordinates are most likely in lat/lon --> use WGS84 as your SRID with pyproj or "spherical" if pyproj is not available. For other DXF vector maps it's very likely that they use local / national coordinate systems. Open the DXF with a text editor (it has many thousands of lines) and make an educated guess looking at some coordinates. DXF works with "group codes", a name AutoDesk invented for "key" as in key/value pairs. x has group code 10, y has 20, z has 30. If you find a pattern like 10, newline, whitespace, whitespace, NUMBER, newline, 20, newline, whitespace, whitespace, NUMBER, newline, 30, newline, whitespace, whitespace, NUMBER then NUMBER will be most likely your coordinates. Probably you can tell from the format and/or the range of the coordinates which coordinate system it should be.