[Bf-extensions-cvs] [f01b67d] dxf_import: Ultimate cleanup (minor pep8).
Bastien Montagne
noreply at git.blender.org
Tue Aug 19 16:04:54 CEST 2014
Commit: f01b67d9ccb13f311d104fe3ce21efe816194add
Author: Bastien Montagne
Date: Tue Aug 19 16:03:04 2014 +0200
Branches: dxf_import
https://developer.blender.org/rBAf01b67d9ccb13f311d104fe3ce21efe816194add
Ultimate cleanup (minor pep8).
===================================================================
M io_import_dxf/__init__.py
M io_import_dxf/dxfimport/line_merger.py
===================================================================
diff --git a/io_import_dxf/__init__.py b/io_import_dxf/__init__.py
index 64fac4a..9c53963 100644
--- a/io_import_dxf/__init__.py
+++ b/io_import_dxf/__init__.py
@@ -155,18 +155,21 @@ def _update_use_georeferencing_do(self, context):
def _recenter_allowed(self):
scene = bpy.context.scene
- return not (self.use_georeferencing and (self.proj_scene == 'TMERC' \
- or (not self.create_new_scene and is_ref_scene(scene)))) \
- or (not PYPROJ and self.dxf_indi == "EUCLIDEAN")
+ return (not (self.use_georeferencing and (self.proj_scene == 'TMERC'
+ or (not self.create_new_scene and is_ref_scene(scene))))
+ or (not PYPROJ and self.dxf_indi == "EUCLIDEAN"))
+
def _set_recenter(self, value):
self.recenter = value if _recenter_allowed(self) else False
+
def _update_proj_scene_do(self, context):
# make sure scene EPSG is not None if DXF EPSG is not None
if self.proj_scene == 'NONE' and self.proj_dxf != 'NONE':
self.proj_scene = self.proj_dxf
+
def _update_import_atts_do(self, context):
if self.represent_thickness_and_width and self.merge:
self.import_atts = True
@@ -256,8 +259,6 @@ class IMPORT_OT_dxf(bpy.types.Operator):
default='LINKED_OBJECTS',
)
-
-
def _update_create_new_scene(self, context):
_update_use_georeferencing_do(self, context)
_set_recenter(self, self.recenter)
@@ -291,7 +292,6 @@ class IMPORT_OT_dxf(bpy.types.Operator):
default=T_import_atts
)
-
# geo referencing
def _update_use_georeferencing(self, context):
@@ -315,9 +315,9 @@ class IMPORT_OT_dxf(bpy.types.Operator):
update=_update_dxf_indi,
)
- # XXX This looks very suspicious to me, why not use usual FloatProperty???
- # YYY I had it as a FloatProperty but those are not precise enough, i.e. 1.0 becomes 0.999999999. Python is more precise here.
- dxf_scale = StringProperty( # string = the floating point precision is handled by python: float(dxf_scale)
+ # Note: FloatProperty is not precise enough, e.g. 1.0 becomes 0.999999999. Python is more precise here (it uses
+ # doubles internally), so we store it as string here and convert to number with py's float() func.
+ dxf_scale = StringProperty(
name="Unit Scale",
description="Coordinates are assumed to be in meters; deviation must be indicated here",
default="1.0"
@@ -458,8 +458,6 @@ class IMPORT_OT_dxf(bpy.types.Operator):
col.label("") # Placeholder.
col.label("") # Placeholder.
- #box.active = True
-
# user info
if self.proj_scene != 'NONE':
if not valid_dxf_srid:
diff --git a/io_import_dxf/dxfimport/line_merger.py b/io_import_dxf/dxfimport/line_merger.py
index c703614..78e78cc 100644
--- a/io_import_dxf/dxfimport/line_merger.py
+++ b/io_import_dxf/dxfimport/line_merger.py
@@ -18,6 +18,7 @@
# <pep8 compliant>
+
def line_merger(lines, precision=6):
merger = _LineMerger(lines, precision)
return merger.polylines
More information about the Bf-extensions-cvs
mailing list