[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [844] contrib/py/scripts/addons: == dxf importer ==

Luca Bonavita mindrones at gmail.com
Fri Jul 23 18:00:19 CEST 2010


Revision: 844
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-extensions&revision=844
Author:   mindrones
Date:     2010-07-23 18:00:19 +0200 (Fri, 23 Jul 2010)

Log Message:
-----------
== dxf importer ==

renamed, tweaks to info dict

Added Paths:
-----------
    contrib/py/scripts/addons/io_import_scene_dxf.py

Removed Paths:
-------------
    contrib/py/scripts/addons/import_scene_dxf.py

Deleted: contrib/py/scripts/addons/import_scene_dxf.py
===================================================================
--- contrib/py/scripts/addons/import_scene_dxf.py	2010-07-22 15:55:34 UTC (rev 843)
+++ contrib/py/scripts/addons/import_scene_dxf.py	2010-07-23 16:00:19 UTC (rev 844)
@@ -1,2078 +0,0 @@
-# ##### BEGIN GPL LICENSE BLOCK #####
-#
-#  This program is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU General Public License
-#  as published by the Free Software Foundation; either version 2
-#  of the License, or (at your option) any later version.
-#
-#  This program is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#  GNU General Public License for more details.
-#
-#  You should have received a copy of the GNU General Public License
-#  along with this program; if not, write to the Free Software Foundation,
-#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# ##### END GPL LICENSE BLOCK #####
-
-bl_addon_info = {
-	'name': 'Import Autocad DXF (.dxf)',
-	'author': 'Thomas Larsson',
-	'version': '0.1',
-	'blender': (2, 5, 3),
-	'location': 'File > Import',
-	'description': 'Import files in the Autocad DXF format (.dxf)',
-	'wiki_url': 'http://wiki.blender.org/index.php/Extensions:Py/Scripts',
-	'category': 'Import/Export'}
-
-"""
-Place this file in the .blender/scripts/addons dir
-You have to activated the script in the "Add-Ons" tab (user preferences).
-Access from the File > Import menu.
-"""
-
-import os
-import codecs
-import math
-import bpy
-import mathutils
-from mathutils import Vector
-
-#
-#	Global flags
-#
-
-T_Merge = 0x01
-T_Replace = 0x02
-T_Curves = 0x04
-T_Verbose = 0x08
-T_Debug = 0x10
-
-toggle = T_Merge | T_Replace 
-
-theMergeLimit = 1e-5
-
-#
-#	class CSection:
-#
-
-class CSection:
-	type = None
-
-	def __init__(self):
-		self.data = []
-
-	def display(self):
-		print("Section", self.type)
-		for datum in self.data:
-			datum.display()
-
-#
-#	class CTable:
-#
-
-class CTable:
-	def __init__(self):
-		self.type = None
-		self.name = None
-		self.handle = None
-		self.owner = None
-		self.subclass = None
-		self.nEntries = 0
-	def display(self):
-		print("Table %s %s %s %s %s %d" % (self.type, self.name, self.handle, self.owner, self.subclass, self.nEntries))
-
-#
-#	class CEntity:
-#
-class CEntity:
-	def __init__(self, typ, drawtype):
-		self.type = typ
-		self.drawtype = drawtype
-		self.handle = None
-		self.owner = None
-		self.subclass = None
-		self.layer = 0
-		self.color = 0
-		self.invisible = 0
-		self.linetype_name = ''
-		self.linetype_scale = 1.0
-		self.paperspace = 0
-		self.extrusion = Vector()
-
-	def display(self):
-		print("Entity %s %s %s %s %s %s %x" % 
-			(self.type, self.handle, self.owner, self.subclass, self.layer, self.color, self.invisible))
-
-	def build(self, vn):
-		global toggle
-		if toggle & T_Debug:
-			raise NameError("Cannot build %s yet" % self.type)
-		return(([], [], vn)) 
-
-	def draw(self):
-		global toggle
-		if toggle & T_Debug:
-			raise NameError("Cannot draw %s yet" % self.type)
-		return
-
-
-DxfCommonAttributes = {
-	5 : 'handle',
-	6 : 'linetype_name',
-	8 : 'layer',
-	48 : 'linetype_scale',
-	60 : 'invisible',
-	62 : 'color',
-	67 : 'paperspace',
-	100 : 'subclass',
-	330 : 'owner',
-	360 : 'owner',
-	210 : 'extrusion.x', 220 : 'extrusion.y', 230 : 'extrusion.z', 
-}
-
-#
-#	class C3dFace(CEntity):
-#	10 : 'point0.x', 20 : 'point0.y', 30 : 'point0.z', 
-#	11 : 'point1.x', 21 : 'point1.y', 31 : 'point1.z', 
-#	12 : 'point2.x', 22 : 'point2.y', 32 : 'point2.z', 
-#	13 : 'point3.x', 23 : 'point3.y', 33 : 'point3.z', 
-#	70 : 'flags',
-#
-
-class C3dFace(CEntity):
-	def __init__(self):
-		CEntity.__init__(self, '3DFACE', 'Face')
-		self.point0 = Vector()
-		self.point1 = Vector()
-		self.point2 = Vector()
-		self.point3 = Vector()
-
-	def display(self):
-		CEntity.display(self)
-		print(self.point0)
-		print(self.point1)
-		print(self.point2)
-		print(self.point3)
-
-	def build(self, vn):
-		verts = [self.point0, self.point1, self.point2]
-		if self.point2 == self.point3:
-			face = (vn, vn+1, vn+2)
-			vn += 3
-		else:
-			verts.append( self.point3 )
-			face = (vn, vn+1, vn+2, vn+3)
-			vn += 4			
-		return((verts, [face], vn))
-
-#
-#	class C3dSolid(CEntity):
-#	1 : 'data', 3 : 'more', 70 : 'version',
-#
-
-class C3dSolid(CEntity):
-	def __init__(self):
-		CEntity.__init__(self, '3DSOLID', 'Face')
-		self.data = None
-		self.more = None
-		self.version = 0
-
-#
-#	class CAcadProxyEntity(CEntity):
-#	70 : 'format',
-#	90 : 'id', 91 : 'class', 92 : 'graphics_size', 93 : 'entity_size', 95: 'format',
-#	310 : 'data', 330 : 'id1', 340 : 'id2', 350 : 'id3', 360 : 'id4', 
-#
-
-class CAcadProxyEntity(CEntity):
-	def __init__(self):
-		CEntity.__init__(self, 'ACAD_PROXY_ENTITY', None)
-
-
-#
-#	class CArc(CEntity):
-#	10 : 'center.x', 20 : 'center.y', 30 : 'center.z', 
-#	40 : 'radius',
-#	50 : 'start_angle', 51 : 'end_angle'
-#
-
-class CArc(CEntity):
-	def __init__(self):
-		CEntity.__init__(self, 'ARC', 'Edge')
-		self.center = Vector()
-		self.radius = 0.0
-		self.start_angle = 0.0
-		self.end_angle = 0.0
-		
-	def display(self):
-		CEntity.display(self)
-		print(self.center)
-		print("%.4f %.4f %.4f " % (self.radius, self.start_angle, self.end_angle))
-
-	def build(self, vn):
-		dphi = (self.end_angle - self.start_angle)*math.pi/180
-		phi0 = self.start_angle*math.pi/180
-		w = dphi/32
-		r = self.radius
-		center = self.center
-		verts = []
-		edges = []
-		for n in range(32):
-			s = math.sin(n*w + phi0)
-			c = math.cos(n*w + phi0)
-			v = (center.x + r*c, center.y + r*s, center.z)
-			verts.append(v)
-			edges.append((vn,vn+1))
-			vn += 1
-		edges.pop()
-		return( (verts, edges, vn) )
-
-#
-#	class CArcAlignedText(CEntity):
-#	1 : 'text', 2 : 'font', 3 : 'bigfont', 7 : 'style',
-#	10 : 'center.x', 20 : 'center.y', 30 : 'center.z', 
-#	40 : 'radius', 41 : 'width', 42 : 'height', 43 : 'spacing', 
-#	44 : 'offset', 45 : 'right_offset', 46 : 'left_offset', 
-#	50 : 'start_angle', 51 : 'end_angle',
-#	70 : 'order', 71 : 'direction', 72 : 'alignment', 73 : 'side', 
-#	74 : 'bold', 75 : 'italic', 76 : 'underline',
-#	77 : 'character_set', 78 : 'pitch', 79 'fonttype',
-#	90 : 'color',
-#	280 : 'wizard', 330 : 'id'
-#
-
-class CArcAlignedText(CEntity):
-	def __init__(self):
-		CEntity.__init__(self, 'ARCALIGNEDTEXT', 'Edge')
-		self.text = ""
-		self.style = ""
-		self.center = Vector()
-		self.radius = 0.0
-		self.width = 1.0
-		self.height = 1.0
-		self.spacing = 1.0
-		self.offset = 0.0
-		self.right_offset = 0.0
-		self.left_offset = 0.0
-		self.start_angle = 0.0
-		self.end_angle = 0.0
-		self.order = 0
-		self.directions = 0
-		self.alignment = 0
-		self.side = 0
-		self.bold = 0
-		self.italic = 0
-		self.underline = 0
-		self.character_set = 0
-		self.pitch = 0
-		self.fonttype = 0
-		self.color = 0
-		self.wizard = None
-		self.id = None
-
-
-#
-#	class CAttdef(CEntity):
-#	1 : 'text', 2 : 'tag', 3 : 'prompt', 7 : 'style',
-#	10 : 'insertion_point.x', 20 : 'insertion_point.y', 30 : 'insertion_point.z', 
-#	11 : 'alignment_point.x', 21 : 'alignment_point.y', 31 : 'alignment_point.z', 
-#	40 : 'height', 41 : 'x_scale', 
-#	50 : 'rotation_angle', 51 : 'oblique_angle', 
-#	70 : 'flags', 71 : 'text_generation_flags', 
-#	72 : 'horizontal_justification',  74 : 'vertical_justification',	
-#
-
-class CAttdef(CEntity):
-	def __init__(self):
-		CEntity.__init__(self, 'ATTDEF', None)
-		self.value = ""
-		self.tag = ""
-		self.prompt = ""
-		self.style = ""
-		self.insertion_point = Vector()
-		self.alignment_point = Vector()
-		self.height = 1.0
-		self.x_scale = 1.0
-		self.rotation_angle = 0.0
-		self.oblique_angle = 0.0
-		self.flags = 0
-		self.text_generation_flags = 0
-		self.horizontal_justification = 0.0
-		self.vertical_justification = 0.0
-
-	def draw(self):
-		drawText(self.text,  self.insertion_point, self.height, self.x_scale, self.rotation_angle, self.oblique_angle)
-		return
-
-#
-#	class CAttrib(CEntity):
-#	1 : 'text', 2 : 'tag', 3 : 'prompt', 7 : 'style',
-#	10 : 'insertion_point.x', 20 : 'insertion_point.y', 30 : 'insertion_point.z', 
-#	11 : 'alignment_point.x', 21 : 'alignment_point.y', 31 : 'alignment_point.z', 
-#	40 : 'height', 41 : 'x_scale', 
-#	50 : 'rotation_angle', 51 : 'oblique_angle', 
-#	70 : 'flags', 73 : 'length', 
-#	71 : 'text_generation_flags', 72 : 'horizontal_justification',  74 : 'vertical_justification', 	
-#
-
-class CAttrib(CEntity):
-	def __init__(self):
-		CEntity.__init__(self, 'ATTRIB', None)
-		self.text = ""
-		self.tag = ""
-		self.prompt = ""
-
-		self.style = ""
-		self.insertion_point = Vector()
-		self.alignment_point = Vector()
-		self.height = 1.0
-		self.x_scale = 1.0
-		self.rotation_angle = 0.0
-		self.oblique_angle = 0.0
-		self.flags = 0
-		self.length = 1.0
-		self.text_generation_flags = 0
-		self.horizontal_justification = 0.0
-		self.vertical_justification = 0.0
-
-	def draw(self):
-		drawText(self.text,  self.insertion_point, self.height, self.x_scale, self.rotation_angle, self.oblique_angle)
-		return
-
-
-#
-#	class CBlock(CEntity):
-#	1 : 'xref', 2 : 'name', 3 : 'also_name', 
-#	10 : 'base_point.x', 20 : 'base_point.y', 30 : 'base_point.z', 
-#	40 : 'size', 41 : 'x_scale', 
-#	50 : 'rotation_angle', 51 : 'oblique_angle', 	
-#	70 : 'flags', 
-#
-
-class CBlock(CEntity):
-	def __init__(self):
-		CEntity.__init__(self, 'BLOCK', None)
-		self.xref = ""
-		self.name = ""
-		self.also_name = ""
-		self.base_point = Vector()
-		self.size = 1.0
-		self.x_scale = 1.0
-		self.rotation_angle = 0.0
-		self.oblique_angle = 0.0
-		self.flags = 0
-
-	def display(self):
-		CEntity.display(self)
-		print("%s %s %s " % (self.xref, self.name, self.also_name))
-		print(self.base_point)
-
-	def draw(self):
-		# Todo
-		return
-
-#
-#	class CCircle(CEntity):
-#	10 : 'center.x', 20 : 'center.y', 30 : 'center.z', 
-#	40 : 'radius'
-#
-
-class CCircle(CEntity):
-	def __init__(self):
-		CEntity.__init__(self, 'CIRCLE', 'Edge')
-		self.center = Vector()
-		self.radius = 0.0
-
-	def display(self):
-		CEntity.display(self)
-		print(self.center)
-		print("%.4f" % self.radius)
-
-	def build(self, vn):
-		w = 2*math.pi/32
-		r = self.radius
-		center = self.center
-		verts = []
-		edges = []
-		v0 = vn
-		for n in range(32):
-			s = math.sin(n*w)
-			c = math.cos(n*w)
-			v = (center.x + r*c, center.y + r*s, center.z)
-			verts.append(v)
-			edges.append((vn,vn+1))
-			vn += 1
-		edges.pop()
-		edges.append((v0,vn-1))

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list