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:
Diffstat (limited to 'io_export_dxf/primitive_exporters/base_exporter.py')
-rw-r--r--io_export_dxf/primitive_exporters/base_exporter.py46
1 files changed, 23 insertions, 23 deletions
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 #---------