[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2493] contrib/py/scripts/addons/ io_export_dxf: DXF-exporter script:

Remigiusz Fiedler migius at gmx.net
Wed Oct 19 21:36:03 CEST 2011


Revision: 2493
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2493
Author:   migius
Date:     2011-10-19 19:36:03 +0000 (Wed, 19 Oct 2011)
Log Message:
-----------
DXF-exporter script:
- fixed output to 3DFACEs and set it as default option
- fixed some descriptions in menu

Modified Paths:
--------------
    contrib/py/scripts/addons/io_export_dxf/operator.py
    contrib/py/scripts/addons/io_export_dxf/primitive_exporters/mesh_exporter.py

Modified: contrib/py/scripts/addons/io_export_dxf/operator.py
===================================================================
--- contrib/py/scripts/addons/io_export_dxf/operator.py	2011-10-19 06:26:42 UTC (rev 2492)
+++ contrib/py/scripts/addons/io_export_dxf/operator.py	2011-10-19 19:36:03 UTC (rev 2493)
@@ -155,9 +155,9 @@
                               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.")
+                           description="Shall be modifiers applied during export?")
     # GUI_B -----------------------------------------
-    mesh_as = EnumProperty( name="Export Mesh As", default='POLYLINE',
+    mesh_as = EnumProperty( name="Export Mesh As", default='3DFACEs',
                             description="Select representation of a mesh",
                             items=mesh_asItems)
 #    curve_as = EnumProperty( name="Export Curve As:", default='NO',
@@ -191,18 +191,18 @@
 #                            description="Select representation of a lamp",
 #                            items=lamp_asItems)
     # ----------------------------------------------------------
-    entitylayer_from = EnumProperty(name="Entity Layer From", default="obj.data.name",
-                                    description="entity LAYER assigned to?",
+    entitylayer_from = EnumProperty(name="Entity Layer", default="obj.data.name",
+                                    description="Entity LAYER assigned to?",
                                     items=entitylayer_from_items)
-    entitycolor_from = EnumProperty(name="Layer Color From", default="default_COLOR",
-                                    description="entity COLOR assigned to?",
+    entitycolor_from = EnumProperty(name="Entity Color", default="default_COLOR",
+                                    description="Entity COLOR assigned to?",
                                     items=layerColorFromItems)
-    entityltype_from = EnumProperty(name="Layer Type", default="CONTINUOUS",
-                                    description="Select type of layer",
+    entityltype_from = EnumProperty(name="Entity Linetype", default="CONTINUOUS",
+                                    description="Entity LINETYPE assigned to?",
                                     items=entityltype_fromItems)
 
-    layerName_from = EnumProperty(name="Layer Name From", default="LAYERNAME_DEF",
-                                    description="Select Entity from which layer name will be taken.",
+    layerName_from = EnumProperty(name="Layer Name", default="LAYERNAME_DEF",
+                                    description="From where will layer name be taken?",
                                     items=layerNameFromItems)
     # GUI_A -----------------------------------------
 #    layFrozen_on = BoolProperty(name="LAYER.frozen status", description="(*todo) Support LAYER.frozen status   on/off", default=False)

Modified: contrib/py/scripts/addons/io_export_dxf/primitive_exporters/mesh_exporter.py
===================================================================
--- contrib/py/scripts/addons/io_export_dxf/primitive_exporters/mesh_exporter.py	2011-10-19 06:26:42 UTC (rev 2492)
+++ contrib/py/scripts/addons/io_export_dxf/primitive_exporters/mesh_exporter.py	2011-10-19 19:36:03 UTC (rev 2493)
@@ -75,14 +75,14 @@
             ##faces = [[v.index for v in f.vertices] for f in me.faces]
             faces = me.faces
             #faces = [[allpoints[v.index] for v in f.vertices] for f in me.faces]
-        print('deb: allpoints=\n', allpoints) #---------
-        print('deb: edges=\n', edges) #---------
-        print('deb: faces=\n', faces) #---------
+        #print('deb: allpoints=\n', allpoints) #---------
+        #print('deb: edges=\n', edges) #---------
+        #print('deb: faces=\n', faces) #---------
         if self.isLeftHand(mx): # then change vertex-order in every face
             for f in faces:
                 f.reverse()
                 #f = [f[-1]] + f[:-1] #TODO: might be needed
-            print('deb: faces=\n', faces) #---------
+            #print('deb: faces=\n', faces) #---------
         entities = self._writeMeshEntities(allpoints, edges, faces, **kwargs)
         # TODO: rewrite
         for type, args in entities:
@@ -94,12 +94,12 @@
         """
         entities = []
         c = self._settings['mesh_as']
-        if 'POINTs'==c: # export Mesh as multiple POINTs
+        if c=='POINTs': # export Mesh as multiple POINTs
             for p in allpoints:
                 args = copy.copy(kwargs)
                 args['points'] = [p]
                 entities.append(('Point', args))
-        elif 'LINEs'==c or (not faces):
+        elif c=='LINEs' or (not faces):
             if edges and allpoints:
 #                if exportsettings['verbose']:
 #                    mesh_drawBlender(allpoints, edges, None) #deb: draw to blender scene
@@ -108,42 +108,43 @@
                     args = copy.copy(kwargs)
                     args['points'] = points
                     entities.append(('Line', args))
-        elif faces:
-            if c in ('POLYFACE','POLYLINE'):
-                if allpoints:
-                    #TODO: purge allpoints: left only vertices used by faces
+        elif c in ('POLYFACE','POLYLINE'):
+            if faces and allpoints:
+                #TODO: purge allpoints: left only vertices used by faces
 #                    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]
-                    else:
-                        # for back-Faces-mode remove face-free vertices
-                        map=verts_state= [0]*len(allpoints)
-                        for f in faces:
-                            for v in f:
-                                verts_state[v]=1
-                        if 0 in verts_state: # if dirty state
-                            i,newverts=0,[]
-                            for used_i,used in enumerate(verts_state):
-                                if used:
-                                    newverts.append(allpoints[used_i])    
-                                    map[used_i]=i
-                                    i+=1
-                            allpoints = newverts
-                            faces = [[map[v]+1 for v in f] for f in faces]
-                    args = copy.copy(kwargs)
-                    args['flag70'] = 64
-                    args['flag75'] = 0
-                    args['width'] = 0.0
-                    args['points'] = [allpoints, faces]
-                    entities.append(('PolyLine', args))
-            elif '3DFACEs'==c:
+                if not (self.PROJECTION and self.HIDDEN_LINES):
+                    faces = [[v+1 for v in f.vertices] for f in faces]
+                else:
+                    # for back-Faces-mode remove face-free vertices
+                    map=verts_state= [0]*len(allpoints)
+                    for f in faces:
+                        for v in f:
+                            verts_state[v]=1
+                    if 0 in verts_state: # if dirty state
+                        i,newverts=0,[]
+                        for used_i,used in enumerate(verts_state):
+                            if used:
+                                newverts.append(allpoints[used_i])    
+                                map[used_i]=i
+                                i+=1
+                        allpoints = newverts
+                        faces = [[map[v]+1 for v in f] for f in faces]
+                args = copy.copy(kwargs)
+                args['flag70'] = 64
+                args['flag75'] = 0
+                args['width'] = 0.0
+                args['points'] = [allpoints, faces]
+                entities.append(('PolyLine', args))
+        elif c=='3DFACEs':
+            if faces and allpoints:
 #                if exportsettings['verbose']: 
 #                    mesh_drawBlender(allpoints, None, faces) #deb: draw to scene
                 for f in faces:
-                    points = f.vertices
+                    points = [allpoints[v_id] for v_id in f.vertices]
                     args = copy.copy(kwargs)
                     args['points'] = points
+#                    print(args)
                     entities.append(('Face', args))
     
 



More information about the Bf-extensions-cvs mailing list