Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2017-03-19 04:49:03 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-03-19 04:49:18 +0300
commit57f376e9465c6b79ebd4409bc30e0b5930dd4140 (patch)
tree8dc6d5940bc8c39d7979d3b35c19d91f4bb83bf0 /io_export_dxf
parent1338695613af08ae912e6507f0fc89d54577e11a (diff)
Cleanup: trailing space
Diffstat (limited to 'io_export_dxf')
-rw-r--r--io_export_dxf/draw_blenders/__init__.py4
-rw-r--r--io_export_dxf/export_dxf.py18
-rw-r--r--io_export_dxf/model/dxfLibrary.py28
-rw-r--r--io_export_dxf/model/migiusModel.py10
-rw-r--r--io_export_dxf/model/model.py4
-rw-r--r--io_export_dxf/operator.py12
-rw-r--r--io_export_dxf/primitive_exporters/__init__.py2
-rw-r--r--io_export_dxf/primitive_exporters/base_exporter.py46
-rw-r--r--io_export_dxf/primitive_exporters/curve_exporter.py22
-rw-r--r--io_export_dxf/primitive_exporters/insert_exporter.py2
-rw-r--r--io_export_dxf/primitive_exporters/mesh_exporter.py20
-rw-r--r--io_export_dxf/primitive_exporters/text_exporter.py2
12 files changed, 85 insertions, 85 deletions
diff --git a/io_export_dxf/draw_blenders/__init__.py b/io_export_dxf/draw_blenders/__init__.py
index 06e5e20f..e2a7d030 100644
--- a/io_export_dxf/draw_blenders/__init__.py
+++ b/io_export_dxf/draw_blenders/__init__.py
@@ -58,7 +58,7 @@ def curve_drawBlender(vertList, org_point=[0.0,0.0,0.0], closed=0, name="dxfCurv
ob.setLocation(cur_loc)
Blender.Redraw()
#return ob
-
+
#-----------------------------------------------------
def drawClipBox(clip_box):
"""debug tool: draws Clipping-Box of a Camera View
@@ -79,7 +79,7 @@ def drawClipBox(clip_box):
newmesh = Mesh.New()
newmesh.verts.extend(verts)
newmesh.faces.extend(faces)
-
+
plan = Object.New('Mesh','clip_box')
plan.link(newmesh)
sce = Scene.GetCurrent()
diff --git a/io_export_dxf/export_dxf.py b/io_export_dxf/export_dxf.py
index fb53e4dd..89aa1d1c 100644
--- a/io_export_dxf/export_dxf.py
+++ b/io_export_dxf/export_dxf.py
@@ -6,7 +6,7 @@ if DEBUG:
import sys
sys.path.append(os.environ['PYDEV_DEBUG_PATH'])
import pydevd
-
+
from .model.migiusModel import MigiusDXFLibDrawing
SUPPORTED_TYPES = ('MESH')#,'CURVE','EMPTY','TEXT','CAMERA','LAMP')
@@ -28,7 +28,7 @@ def exportDXF(context, filePath, settings):
objects = (ob for ob in scene.objects if ob.is_visible(scene) and ob.select and ob.type in SUPPORTED_TYPES)
else:
objects = (ob for ob in scene.objects if ob.is_visible(scene) and ob.type in SUPPORTED_TYPES)
-
+
if DEBUG: pydevd.settrace()
mw = get_view_projection_matrix(context, settings)
@@ -37,22 +37,22 @@ def exportDXF(context, filePath, settings):
#todo: fixme: seems to be the reason for missing BLOCK-export
#if APPLY_MODIFIERS: tmp_me = Mesh.New('tmp')
#else: tmp_me = None
-
+
drawing = MigiusDXFLibDrawing()
exported = 0
for o in objects:
if _exportItem(context, o, mw, drawing, settings):
exported +=1
-
+
if not drawing.isEmpty():
# NOTE: Only orthographic projection used now.
# if PERSPECTIVE: # generate view border - passepartout
# from .primitive_exporters.viewborder_exporter import ViewBorderDXFExporter
# e = ViewBorderDXFExporter(settings)
# e.export(drawing, ob, mx, mw)
-
+
drawing.convert(filePath)
-
+
duration = time.clock() - time1
print('%s objects exported in %.2f seconds. -----DONE-----' %\
(exported, duration))
@@ -75,7 +75,7 @@ def getCommons(ob, settings):
thickness=None
parent=None
"""
-
+
BYBLOCK=0 #DXF-attribute: assign property to BLOCK defaults
BYLAYER=None #256 #DXF-attribute: assign property to LAYER defaults
LAYERNAME_DEF='' #default layer name
@@ -94,7 +94,7 @@ def getCommons(ob, settings):
ob_material = materials[0]
ob_mat_color = ob_material.material.diffuse_color
else: ob_mat_color, ob_material = None, None
- if DEBUG:
+ if DEBUG:
print('ob_mat_color, ob_material=', ob_mat_color, ob_material) #--------------
data_materials = ob.material_slots
@@ -202,7 +202,7 @@ def get_view_projection_matrix(context, settings):
Projection matrix is either identity if 3d export is selected or
camera projection if a camera or view is selected.
Currently only orthographic projection is used. (Subject to discussion).
- """
+ """
cam = settings['projectionThrough']
if cam == None:
mw = mathutils.Matrix()
diff --git a/io_export_dxf/model/dxfLibrary.py b/io_export_dxf/model/dxfLibrary.py
index c1730d4d..1d917e25 100644
--- a/io_export_dxf/model/dxfLibrary.py
+++ b/io_export_dxf/model/dxfLibrary.py
@@ -278,7 +278,7 @@ class Face(_Entity):
while len(points)<4: #fix for r12 format
points.append(points[-1])
self.points=points
-
+
def __str__(self):
out = ' 0\n3DFACE\n%s%s\n' %(self._common(),_points(self.points))
return out
@@ -579,7 +579,7 @@ class LineType(_Call):
elements += ' 49\n%s\n' %e
result += elements
return result
-
+
#-----------------------------------------------
class Style(_Call):
@@ -767,16 +767,16 @@ class Drawing(_Collection):
#self.acadver='9\n$ACADVER\n1\nAC1006\n'
self.acadver=' 9\n$ACADVER\n 1\nAC1009\n'
"""DXF AutoCAD-Release format codes:
- AC1021 2008, 2007
- AC1018 2006, 2005, 2004
- AC1015 2002, 2000i, 2000
- AC1014 R14,14.01
- AC1012 R13
- AC1009 R12,11
- AC1006 R10
- AC1004 R9
- AC1002 R2.6
- AC1.50 R2.05
+ AC1021 2008, 2007
+ AC1018 2006, 2005, 2004
+ AC1015 2002, 2000i, 2000
+ AC1014 R14,14.01
+ AC1012 R13
+ AC1009 R12,11
+ AC1006 R10
+ AC1004 R9
+ AC1002 R2.6
+ AC1.50 R2.05
"""
def _name(self,x):
@@ -815,7 +815,7 @@ class Drawing(_Collection):
entities=self._section('entities',[str(x) for x in self.entities])
all=''.join([header,tables,blocks,entities,' 0\nEOF\n'])
return all
-
+
def _write_section(self,file,name,data):
file.write(' 0\nSECTION\n 2\n%s\n'%name.upper())
for x in data:
@@ -924,4 +924,4 @@ if __name__=='__main__':
if not copy:
Draw.PupMenu('Error%t|This script requires a full python install')
else: test()
-
+
diff --git a/io_export_dxf/model/migiusModel.py b/io_export_dxf/model/migiusModel.py
index a1e8b830..10344767 100644
--- a/io_export_dxf/model/migiusModel.py
+++ b/io_export_dxf/model/migiusModel.py
@@ -13,7 +13,7 @@ try:
#from dxfLibrary import *
except Exception:
raise Exception("No dxfLibrary.py module in Blender script folder found!")
-
+
#------------------------------------------------------
#def col2RGB(color):
# return [int(floor(255*color[0])),
@@ -81,13 +81,13 @@ class MigiusDXFLibDrawing(DxfDrawing):
# for l in self._layers:
drawing.saveas(file)
- def _write(self):
+ def _write(self):
# init Drawing ---------------------
d=DXF.Drawing()
# add Tables -----------------
# initialized automatic: d.blocks.append(b) #section BLOCKS
# initialized automatic: d.styles.append(DXF.Style()) #table STYLE
-
+
#table LTYPE ---------------
#d.linetypes.append(DXF.LineType(name='CONTINUOUS',description='--------',elements=[0.0]))
d.linetypes.append(DXF.LineType(name='DOT',description='. . . . . . .',elements=[0.25, 0.0, -0.25]))
@@ -97,13 +97,13 @@ class MigiusDXFLibDrawing(DxfDrawing):
d.linetypes.append(DXF.LineType(name='BORDER',description='__ __ . __ __ . ',elements=[1.75, 0.5, -0.25, 0.5, -0.25, 0.0, -0.25]))
d.linetypes.append(DXF.LineType(name='HIDDEN',description='__ __ __ __ __',elements=[0.4, 0.25, -0.25]))
d.linetypes.append(DXF.LineType(name='CENTER',description='____ _ ____ _ __',elements=[2.0, 1.25, -0.25, 0.25, -0.25]))
-
+
#d.vports.append(DXF.VPort('*ACTIVE'))
d.vports.append(DXF.VPort('*ACTIVE',center=(-5.0,1.0),height=10.0))
#d.vports.append(DXF.VPort('*ACTIVE',leftBottom=(-100.0,-60.0),rightTop=(100.0,60.0)))
#d.views.append(DXF.View('Normal')) #table view
d.views.append(DXF.ViewByWindow('BF_TOPVIEW',leftBottom=(-100,-60),rightTop=(100,60))) #idem
-
+
return d
def _processEntityArray(self, drawing, type, ents):
diff --git a/io_export_dxf/model/model.py b/io_export_dxf/model/model.py
index bff37339..53fef13b 100644
--- a/io_export_dxf/model/model.py
+++ b/io_export_dxf/model/model.py
@@ -10,7 +10,7 @@ class DxfDrawing(object):
self._views = []
self._vports = []
self._blocks = []
-
+
def isEmpty(self):
return len(self._entities) == 0
@@ -34,5 +34,5 @@ class DxfDrawing(object):
def convert(self, **kwargs):
""" Converts this drawing into DXF representation object """
raise NotImplementedError()
-
+
diff --git a/io_export_dxf/operator.py b/io_export_dxf/operator.py
index b5d8d089..3ba7de60 100644
--- a/io_export_dxf/operator.py
+++ b/io_export_dxf/operator.py
@@ -67,7 +67,7 @@ class DXFExporter(bpy.types.Operator):
('..BLOCK', '..BLOCK', ''),
('..XDATA', '..XDATA', ''),
('..INI-File', '..INI-File', '')
- )
+ )
projectionItems=(
('NO', 'No projection', 'Export 3D scene without any 2D projection'),
('TOP', 'TOP view', 'Use TOP view for projection'),
@@ -150,10 +150,10 @@ class DXFExporter(bpy.types.Operator):
projectionThrough = EnumProperty(name="Projection", default="NO",
description="Select camera for use to 2D projection",
items=projectionItems)
-
+
onlySelected = BoolProperty(name="Only selected", default=True,
description="What object will be exported? Only selected / all objects")
-
+
apply_modifiers = BoolProperty(name="Apply modifiers", default=True,
description="Shall be modifiers applied during export?")
# GUI_B -----------------------------------------
@@ -225,7 +225,7 @@ class DXFExporter(bpy.types.Operator):
# description='Set default COLOR. (0=BYBLOCK,256=BYLAYER)')
# layerltype_def = StringProperty(name="Default LINETYPE", default="DEF_LAY_TYPE",
# description='Set default LINETYPE')
-
+
verbose = BoolProperty(name="Verbose", default=False,
description="Run the exporter in debug mode. Check the console for output")
@@ -249,9 +249,9 @@ class DXFExporter(bpy.types.Operator):
'entitylayer_from' : self.entitylayer_from,
'entitycolor_from' : self.entitycolor_from,
- 'entityltype_from' : self.entityltype_from,
+ 'entityltype_from' : self.entityltype_from,
'layerName_from' : self.layerName_from,
-
+
# NOT USED
# 'layFrozen_on' : self.layFrozen_on,
# 'materialFilter_on' : self.materialFilter_on,
diff --git a/io_export_dxf/primitive_exporters/__init__.py b/io_export_dxf/primitive_exporters/__init__.py
index 8e49ba00..d1cfad46 100644
--- a/io_export_dxf/primitive_exporters/__init__.py
+++ b/io_export_dxf/primitive_exporters/__init__.py
@@ -6,5 +6,5 @@ that is being exported from export_dxf.py in ../
NOTE: Only MESH exporter has been ported since it is imho
mostly used. I am not specialist on Autocad so I cannot
guest how many time the other primitive are used. That's
-why they are left unported.
+why they are left unported.
"""
diff --git a/io_export_dxf/primitive_exporters/base_exporter.py b/io_export_dxf/primitive_exporters/base_exporter.py
index b85dc127..2542a1c0 100644
--- a/io_export_dxf/primitive_exporters/base_exporter.py
+++ b/io_export_dxf/primitive_exporters/base_exporter.py
@@ -1,14 +1,14 @@
import mathutils
class BasePrimitiveDXFExporter(object):
-
+
INSTANCES = False
PROJECTION = False
HIDDEN_LINES = False
-
+
def __init__(self, settings):
self._settings = settings
-
+
def projected_co(self, verts, matrix):
""" converts coordinates of points from OCS to WCS->ScreenCS
needs matrix: a projection matrix
@@ -18,11 +18,11 @@ class BasePrimitiveDXFExporter(object):
#print 'deb:projected_co() verts=', verts #---------
temp_verts = [matrix*mathutils.Vector(v) for v in verts]
#print 'deb:projected_co() temp_verts=', temp_verts #---------
-
+
# if GUI_A['Z_force_on'].val: locZ = GUI_A['Z_elev'].val
# else:locZ = 0.0
locZ = 0.0
-
+
if self.PROJECTION:
if self.PERSPECTIVE:
clipStart = 10.0
@@ -36,7 +36,7 @@ class BasePrimitiveDXFExporter(object):
temp_verts = [v[:3] for v in temp_verts]
#print 'deb:projected_co() out_verts=', temp_verts #---------
return temp_verts
-
+
def isLeftHand(self, matrix):
#Is the matrix a left-hand-system, or not?
ma = matrix.to_euler().to_matrix()
@@ -44,7 +44,7 @@ class BasePrimitiveDXFExporter(object):
check = self.M_DotVecs(ma[2], crossXY)
if check < 0.00001: return 1
return 0
-
+
#-----------------------------------------------------
def hidden_status(self, faces, mx, mx_n):
# sort out back-faces = with normals pointed away from camera
@@ -63,8 +63,8 @@ class BasePrimitiveDXFExporter(object):
#print 'deb:2vec_normal=', vec_normal #------------------
#vec_normal *= mw0.rotationPart()
#print 'deb:3vec_normal=', vec_normal, '\n' #------------------
-
-
+
+
frontFace = False
if not self.PERSPECTIVE: #for ortho mode ----------
# normal must point the Z direction-hemisphere
@@ -75,14 +75,14 @@ class BasePrimitiveDXFExporter(object):
vert = mathutils.Vector(v.co) * mx
if mathutils.DotVecs(vert, vec_normal) < 0.00001:
frontFace = True
-
+
if frontFace:
front_faces.append(f.index)
for key in f.edge_keys:
#this test can be done faster with set()
if key not in front_edges:
front_edges.append(key)
-
+
#print 'deb: amount of visible faces=', len(front_faces) #---------
#print 'deb: visible faces=', front_faces #---------
#print 'deb: amount of visible edges=', len(front_edges) #---------
@@ -100,7 +100,7 @@ class BasePrimitiveDXFExporter(object):
# p[1] += G_ORIGIN[1]
# p[2] += G_ORIGIN[2]
return points
-
+
#---- migration to 2.49-------------------------------------------------
#Draw.PupMenu('DXF exporter: Abort%t|This script version works for Blender up 2.49 only!')
@@ -109,12 +109,12 @@ class BasePrimitiveDXFExporter(object):
return v1.cross(v2) #for up2.49
else:
return mathutils.CrossVecs(v1,v2) #for pre2.49
-
+
def M_DotVecs(self, v1,v2):
if 'cross' in dir(mathutils.Vector()):
return v1.dot(v2) #for up2.49
else:
- return mathutils.DotVecs(v1,v2) #for pre2.49
+ return mathutils.DotVecs(v1,v2) #for pre2.49
#-----------------------------------------------------
def getExtrusion(self, matrix):
@@ -134,18 +134,18 @@ class BasePrimitiveDXFExporter(object):
#print 'deb:\n' #-------------
#print 'deb:getExtrusion() Extrusion=', Extrusion #---------
return Extrusion, AXaxis.normalize()
-
+
#-----------------------------------------------------
# def getZRotation(AXaxis, rot_matrix_invert):
# """calculates ZRotation = angle between ArbitraryXvector and obj.matrix.Xaxis
-#
+#
# """
# # this works: Xaxis is the obj.matrix-Xaxis vector
# # but not correct for all orientations
# #Xaxis = matrix[0].copy().resize3D() # = ArbitraryXvector
# ##Xaxis.normalize() # = ArbitraryXvector
# #ZRotation = - mathutils.AngleBetweenVecs(Xaxis,AXaxis) #output in radians
-#
+#
# # this works for all orientations, maybe a bit faster
# # transform AXaxis into OCS:Object-Coord-System
# #rot_matrix = normalizeMat(matrix.rotationPart())
@@ -155,11 +155,11 @@ class BasePrimitiveDXFExporter(object):
# ##vec.normalize() # not needed for atan2()
# #print '\ndeb:getExtrusion() vec=', vec #---------
# ZRotation = - atan2(vec[1],vec[0]) #output in radians
-#
+#
# #print 'deb:ZRotation() ZRotation=', ZRotation*r2d #---------
# return ZRotation
-#
-#
+#
+#
# #-----------------------------------------------------
# def getTargetOrientation(mx,Extrusion,AXaxis,WCS_loc,sizeX,sizeY,sizeZ,rotX,rotY,rotZ):
# """given
@@ -175,11 +175,11 @@ class BasePrimitiveDXFExporter(object):
# else: #TODO: to check, why below rot_matrix_invert is not equal above one
# rot_euler_matrix = euler2matrix(rotX,rotY,rotZ)
# rot_matrix_invert = euler2matrix(-rotX,-rotY,-rotZ)
-#
+#
# # OCS_origin is Global_Origin in ObjectCoordSystem
# OCS_origin = mathutils.Vector(WCS_loc) * rot_matrix_invert
# #print 'deb: OCS_origin=', OCS_origin #---------
-#
+#
# ZRotation = rotZ
# if Extrusion!=None:
# ZRotation = getZRotation(AXaxis,rot_matrix_invert)
@@ -187,7 +187,7 @@ class BasePrimitiveDXFExporter(object):
# rs, rc = sin(ZRotation), cos(ZRotation)
# Zrotmatrix = mathutils.Matrix([rc, rs,0.0],[-rs,rc,0.0],[0.0,0.0,1.0])
# #print 'deb: Zrotmatrix=\n', Zrotmatrix #--------------
-#
+#
# # ECS_origin is Global_Origin in EntityCoordSystem
# ECS_origin = OCS_origin * Zrotmatrix
# #print 'deb: ECS_origin=', ECS_origin #---------
diff --git a/io_export_dxf/primitive_exporters/curve_exporter.py b/io_export_dxf/primitive_exporters/curve_exporter.py
index d74a459f..09372cad 100644
--- a/io_export_dxf/primitive_exporters/curve_exporter.py
+++ b/io_export_dxf/primitive_exporters/curve_exporter.py
@@ -32,7 +32,7 @@ def exportCurve(ob, mx, mw, **common):
if not PROJECTION:
#Extrusion, ZRotation, Elevation = getExtrusion(mx)
Extrusion, AXaxis = getExtrusion(imx)
-
+
# no thickness/width for POLYLINEs converted into Screen-C-S
#print 'deb: curve.ext1=', curve.ext1 #---------
if curve.ext1: Thickness = curve.ext1 * sizeZ
@@ -66,7 +66,7 @@ def exportCurve(ob, mx, mw, **common):
rotY = ob.RotY
rotZ = ob.RotZ
#print 'deb: sizeX=%s, sizeY=%s' %(sizeX, sizeY) #---------
-
+
Thickness,Extrusion,ZRotation,Elevation = None,None,None,None
ZRotation,Zrotmatrix,OCS_origin,ECS_origin = None,None,None,None
AXaxis = mx[0].copy().resize3D() # = ArbitraryXvector
@@ -74,7 +74,7 @@ def exportCurve(ob, mx, mw, **common):
if not PROJECTION:
#Extrusion, ZRotation, Elevation = getExtrusion(mx)
Extrusion, AXaxis = getExtrusion(mx)
-
+
# no thickness/width for POLYLINEs converted into Screen-C-S
#print 'deb: curve.ext1=', curve.ext1 #---------
if curve.ext1: Thickness = curve.ext1 * sizeZ
@@ -174,7 +174,7 @@ def writeCurveEntities(curve, mx,
#print 'deb: pkt=', pkt #---------
points.append(pkt)
flags.append([None, [width1,width2]])
-
+
#print 'deb: points', points #--------------
if len(points)>1:
c = curve_as_list[GUI_A['curve_as'].val]
@@ -192,13 +192,13 @@ def writeCurveEntities(curve, mx,
else:
points = projected_co(points, mx)
#print 'deb: points', points #--------------
-
+
if cur.isCyclic(): closed = 1
else: closed = 0
points = toGlobalOrigin(points)
points_temp = []
for p,f in zip(points,flags):
- points_temp.append([p,f[0],f[1]])
+ points_temp.append([p,f[0],f[1]])
points = points_temp
#print 'deb: points', points #--------------
@@ -209,7 +209,7 @@ def writeCurveEntities(curve, mx,
##common['elevation']= Elevation
common['thickness']= Thickness
#print 'deb: common=', common #------------------
-
+
flag70, flag75 = pflag70+closed, pflag75
if 0: #DEBUG
p=AXaxis[:3]
@@ -222,20 +222,20 @@ def writeCurveEntities(curve, mx,
#OCS_origin=[0,0,0] #only debug----------------
dxfPLINE = DXF.PolyLine(points,OCS_origin, flag70=flag70, flag75=flag70, width=0.0,**common)
entities.append(dxfPLINE)
-
+
dxfPLINE = DXF.PolyLine(points,OCS_origin, flag70=flag70, flag75=flag70, width=0.0,**common)
entities.append(dxfPLINE)
if Thickness:
common['thickness']= -Thickness
dxfPLINE = DXF.PolyLine(points,OCS_origin, flag70=flag70, flag75=flag70, width=0.0,**common)
entities.append(dxfPLINE)
-
+
elif c=="LINEs": # export Curve as multiple LINEs
points = projected_co(points, mx)
if cur.isCyclic(): points.append(points[0])
#print 'deb: points', points #--------------
points = toGlobalOrigin(points)
-
+
if DEBUG: curve_drawBlender(points,WCS_loc,closed) #deb: draw to scene
common['extrusion']= Extrusion
common['elevation']= Elevation
@@ -251,7 +251,7 @@ def writeCurveEntities(curve, mx,
linepoints = [points[i], points[i+1]]
dxfLINE = DXF.Line(linepoints,**common)
entities.append(dxfLINE)
-
+
elif c=="POINTs": # export Curve as multiple POINTs
points = projected_co(points, mx)
for p in points:
diff --git a/io_export_dxf/primitive_exporters/insert_exporter.py b/io_export_dxf/primitive_exporters/insert_exporter.py
index 80cf7dbd..46382e3d 100644
--- a/io_export_dxf/primitive_exporters/insert_exporter.py
+++ b/io_export_dxf/primitive_exporters/insert_exporter.py
@@ -43,7 +43,7 @@ def exportInsert(ob, mx, insert_name, **common):
#TODO: ? sizeX *= coef
#sizeY *= coef
#sizeZ *= coef
-
+
#print 'deb: point=', point #--------------
[point] = toGlobalOrigin([point])
diff --git a/io_export_dxf/primitive_exporters/mesh_exporter.py b/io_export_dxf/primitive_exporters/mesh_exporter.py
index 9764796b..69834871 100644
--- a/io_export_dxf/primitive_exporters/mesh_exporter.py
+++ b/io_export_dxf/primitive_exporters/mesh_exporter.py
@@ -4,7 +4,7 @@ from .base_exporter import BasePrimitiveDXFExporter
import copy
class MeshDXFExporter(BasePrimitiveDXFExporter):
-
+
def export(self, ctx, drawing, ob, mx, mx_n, **kwargs):
"""
Converts Mesh-Object to desired projection and representation(DXF-Entity type)
@@ -15,7 +15,7 @@ class MeshDXFExporter(BasePrimitiveDXFExporter):
# it manipulates original geometry and by retransformation lefts back rounding-errors
# we dont want to manipulate original data!
#temp_verts = me.verts[:] #doesn't work on ubuntu(Yorik), bug?
- if me.vertices:
+ if me.vertices:
# check if there are more instances of this mesh (if used by other objects), then write to BLOCK/INSERT
if self.INSTANCES and me.users>1 and not self.PROJECTION and not (ob.modifiers and self._settings['apply_modifiers']):
if drawing.containsBlock(me.name):
@@ -40,15 +40,15 @@ class MeshDXFExporter(BasePrimitiveDXFExporter):
# block = DXF.Block(insert_name,flag=0,base=(0,0,0),entities=entities)
# write INSERT as entity
entities = self._writeInsert(ob, mx, me.name, **(kwargs))
-
+
else: # no other instances, so go the standard way
return self._standard_way(drawing, me, mx, mx_n)
-
+
def _writeInsert(self, drawing, ob, mx, insert_name, **kwargs):
from insert_exporter import InsertDXFExporter
ex = InsertDXFExporter(self._settings)
ex.export(drawing, ob, mx, insert_name, **(kwargs))
-
+
def _getMeshData(self, ctx, obj, settings):
if obj.modifiers and settings['apply_modifiers']:
#this gets mesh with applied modifiers
@@ -57,7 +57,7 @@ class MeshDXFExporter(BasePrimitiveDXFExporter):
# me = ob.getData(mesh=1) # is a Mesh if mesh>0 (otherwise it is a NMesh)
data = obj.data
return data
-
+
def _standard_way(self, drawing, me, mx, mx_n, **kwargs):
allpoints = [v.co for v in me.vertices]
allpoints = self.projected_co(allpoints, mx)
@@ -92,7 +92,7 @@ class MeshDXFExporter(BasePrimitiveDXFExporter):
for type, args in entities:
drawing.addEntity(type, **(args))
return True
-
+
def _writeMeshEntities(self, allpoints, edges, faces, **kwargs):
"""help routine for exportMesh()
"""
@@ -115,7 +115,7 @@ class MeshDXFExporter(BasePrimitiveDXFExporter):
elif c in {'POLYFACE', 'POLYLINE'}:
if faces and allpoints:
#TODO: purge allpoints: left only vertices used by faces
-# if exportsettings['verbose']:
+# if exportsettings['verbose']:
# mesh_drawBlender(allpoints, None, faces) #deb: draw to scene
if not (self.PROJECTION and self.HIDDEN_LINES):
faces = [[v+1 for v in f.vertices] for f in faces]
@@ -129,7 +129,7 @@ class MeshDXFExporter(BasePrimitiveDXFExporter):
i,newverts=0,[]
for used_i,used in enumerate(verts_state):
if used:
- newverts.append(allpoints[used_i])
+ newverts.append(allpoints[used_i])
map[used_i]=i
i+=1
allpoints = newverts
@@ -142,7 +142,7 @@ class MeshDXFExporter(BasePrimitiveDXFExporter):
entities.append(('PolyLine', args))
elif c=='3DFACEs':
if faces and allpoints:
-# if exportsettings['verbose']:
+# if exportsettings['verbose']:
# mesh_drawBlender(allpoints, None, faces) #deb: draw to scene
for f in faces:
points = [allpoints[v_id] for v_id in f.vertices]
diff --git a/io_export_dxf/primitive_exporters/text_exporter.py b/io_export_dxf/primitive_exporters/text_exporter.py
index 98693aec..52d19725 100644
--- a/io_export_dxf/primitive_exporters/text_exporter.py
+++ b/io_export_dxf/primitive_exporters/text_exporter.py
@@ -60,7 +60,7 @@ def exportText(ob, mx, mw, **common):
coef = -clipStart / (point1*mx)[2]
textHeight *= coef
#print 'deb: coef=', coef #--------------
-
+
#print 'deb: point=', point #--------------
[point] = toGlobalOrigin([point])
point2 = point