[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12624] trunk/blender/release/scripts/ import_dxf.py: Update v1.0.11 from Migius

Campbell Barton ideasman42 at gmail.com
Mon Nov 19 18:39:53 CET 2007


Revision: 12624
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12624
Author:   campbellbarton
Date:     2007-11-19 18:39:52 +0100 (Mon, 19 Nov 2007)

Log Message:
-----------
Update v1.0.11 from Migius

You can find the update v1.0.11 on http://wiki.blender.org/index.php/Scripts/Manual/Import/DXF-3D

changelog:
c4 added "analyse DXF-file" UI-option: print LAYER/BLOCK-dependences into a textfile
c3 human-formating of data in INI-Files
c2 added "caps" for closed Bezier-curves
c2 added "set elevation" UI-option
c1 rewrite POLYLINE2d-arc-segments Bezier-interpreter
b9 many bugs fixed
b9 rewrite POLYLINE2d-arc-segments trimming (clean-trim)
b8 added "import from frozen layers" UI-option
b8 added "import from paper space" UI-option
b8 support Bezier curves for LINEs incl.thickness(0.0-10.0)
b8 added meshSmooth_on for circle/arc/polyline
b8 added vertexGroups for circle/arc
b7 added width_force for ARCs/CIRCLEs = "thin_box" option
b3 cleanup code, rename f_drawArc/Bulg->f_calcArc/Bulg
b2 fixing material assignment by LAYER+COLOR
b1 fixing Bezier curves representation of POLYLINEs-arc-segments
b0 added global_scale_presets: "yard/feet/inch to meter"

Modified Paths:
--------------
    trunk/blender/release/scripts/import_dxf.py

Modified: trunk/blender/release/scripts/import_dxf.py
===================================================================
--- trunk/blender/release/scripts/import_dxf.py	2007-11-19 14:00:48 UTC (rev 12623)
+++ trunk/blender/release/scripts/import_dxf.py	2007-11-19 17:39:52 UTC (rev 12624)
@@ -7,7 +7,7 @@
 Tooltip: 'Import for DXF geometry data (Drawing eXchange Format).'
 """
 __author__ = 'Kitsu(Ed Blake) & migius(Remigiusz Fiedler)'
-__version__ = '1.0.beta10 - 2007.09.09 by migius'
+__version__ = '1.0.11 - 2007.11.17 by migius'
 __url__ = ["http://blenderartists.org/forum/showthread.php?t=84319",
 	 "http://wiki.blender.org/index.php/Scripts/Manual/Import/DXF-3D"]
 __email__ = ["Kitsune_e(at)yahoo.com", "migius(at)4d-vectors.de"]
@@ -18,69 +18,96 @@
 This version is focused on import of 3d-objects.
 
 Supported DXF Objects:
-LINE
-POINT
-SOLID
-TRACE
-TEXT
-INSERT (=block)
-MINSERT (=array)
-CIRCLE
-ARC
-3DFACE
-2d-POLYLINE (=plane, incl. arc, variable-width, curve, spline)
-3d-POLYLINE (=no-plane)
-3d-POLYMESH
+LINE,
+POINT,
+SOLID,
+TRACE,
+TEXT,
+INSERT (=block),
+MINSERT (=arrays of blocks),
+CIRCLE,
+ARC,
+3DFACE,
+2d-POLYLINE (=plane, incl. arc, variable-width, curve, spline),
+3d-POLYLINE (=non-plane polylines),
+3d-POLYMESH,
 3d-POLYFACE
-under construction, partly supported DXF>r12:
+
+under construction, partly supported DXF>r12 Objects:
 LWPOLYLINE (LightWeight), MLINE, MTEXT, ELLIPSE
 
 Unsupported DXF Objects:
-DXF r12: DIMENSION, XREF (External Reference)
+DXF r12: DIMENSION, XREF (External Reference),
 DXF>r12: SPLINE, GROUP, RAY/XLINE, LEADER, 3DSOLID, BODY, REGION, dynamic BLOCK
 
 Supported Properties:
 Hierarchy: Entire DXF BLOCKs hierarchy is preserved after import into Blender
-visibility, frozen
-COLOR
-LAYER
-thickness
-width
+visibility, frozen,
+COLOR, LAYER,
+thickness, width,
 (todo: grouped, XDATA)
 It is recommended to use DXF-object properties for coding Blender materials.
 
 Notes:
 - Recommend that you run 'RemoveDoubles' on each imported mesh after using this script
 - Blocks are created on layer 19 then referenced at each insert point.
-* Big DXF-files (over 1500 objects) decrease import performance. The problem is not the inefficiency of python-scripting but Blenders performance in creating new objects in his database - probably a database management problem.
-* The Blender curves of imported ARCs and POLYLINE-arc-segments have light malformed ends.(to fix in beta10)
+- Big DXF-files (over 1500 objects) decrease import performance. The problem is not the inefficiency of python-scripting but Blenders performance in creating new objects in his database - probably a database management problem.
 	
 TODO:  
 - the new style object visibility
-- support for Spline-curves, Besier-curves
 - support for real 3d-solids (ACIS)
 - (to see more, search for "-todo-" in script)
 
+"""
 
+"""
 History:
- v1.0 - 2007.09 by migius: "full 3d"-release
+ v1.0 - 2007.11. by migius: "full 3d"-release
  planned tasks:
+ -- command-line-mode/batch-mode
+ -- in-place-editing for dupliGroups
  -- filtering of unused/not-inserted BLOCKs
- -- human-formating of data in INI-File
- -- suport for MLine
- -- suport for Ellipse
- -- suport for Mtext
+ -- support for MLine
+ -- support for Ellipse
+ -- support for Mtext
  -- blender_object.ID.properties[dxf_layer_name]
+ -- better support for long dxf-layer-names 
  -- Configuration files(.ini) should/can handle various material setups
  -- added f_layerFilter
  -- to-check: obj/mat/group/_mapping-idea from ideasman42:
- -- better support for long dxf-layer-names 
- -- support width_force for LINEs/ARCs/CIRCLEs/ELLIPSEs = "solidify"
- -- curves: added fill/non-fill option for closed curves: CIRCLEs,ELLIPSEs,POLYLINEs
+ -- curves: added "fill/non-fill" option for closed curves: CIRCLEs,ELLIPSEs,POLYLINEs
  -- bug:? object = Object.Get(obname) -> = SCENE.getChildren(obname)
- -- command-line-mode/batch-mode
- -- fixed malformed endpoints of Blender curves of imported ARCs and POLYLINE-arc segments. 
- beta10: 2007.09.09 by migius
+ -- "normalize Z" option to correct non-planar figures
+ -- LINEs need "width" in 3d-space incl vGroups
+ -- support width_force for LINEs/ELLIPSEs = "solidify"
+ -- bug: dxf-files without layer-section missing layersmap{}
+ -- color BYLAYER=256,BYBLOCK=0 
+ -- blocknames conventions length
+ v1.0.11: 2007.11.17 by migius
+ c4 added "analyze DXF-file" UI-option: print LAYER/BLOCK-dependences into a textfile
+ c3 human-formating of data in INI-Files
+ c2 added "caps" for closed Bezier-curves
+ c2 added "set elevation" UI-option
+ c1 rewrite POLYLINE2d-arc-segments Bezier-interpreter
+ b9 many bugs fixed
+ b9 rewrite POLYLINE2d-arc-segments trimming (clean-trim)
+ b8 added "import from frozen layers" UI-option
+ b8 added "import from paper space" UI-option
+ b8 support Bezier curves for LINEs incl.thickness(0.0-10.0)
+ b8 added meshSmooth_on for circle/arc/polyline 
+ b8 added vertexGroups for circle/arc 
+ b7 added width_force for ARCs/CIRCLEs = "thin_box" option
+ b3 cleanup code, rename f_drawArc/Bulg->f_calcArc/Bulg
+ b2 fixing material assignment by LAYER+COLOR
+ b1 fixing Bezier curves representation of POLYLINEs-arc-segments
+ b0 added global_scale_presets: "yard/feet/inch to meter"
+ v1.0.10: 2007.10.18 by migius
+ a6 bugfix CircleDrawCaps for OSX 
+ a5 added two "curve_res" UI-buttons for Bezier curves representation
+ a5 improved Bezier curves representation of circles/arcs: correct handlers
+ a4 first try to fix malformed endpoints of Blender curves of imported ARCs and POLYLINE-arc segments. 
+ a3 bugfix: open POLYLINEs with end_point.loc==start_point.loc
+ a2 bugfix: f_transform for OCS=(0,0,-1) oriented objects
  a1 added "fill_on" option to draw top and bottom sides of CIRCLEs and ELLIPSEs
  a1 rewrite f_CIRCLE.Draw: from Mesh.Primitive to Mesh
  a1 bugfix "newScene"-mode: Cylinders/Arcs were drawn at <0,0,0>location
@@ -100,13 +127,13 @@
  d4 added: f_set_thick(cntrolled by ini-parameters)
  d4 bugfix: face-normals in objects with minus thickness
  d4 added: placeholder'Empty'-size in f_Insert.draw
- d3 rewrite f_Text.Draw: added suport for all Text's parameters
+ d3 rewrite f_Text.Draw: added support for all Text's parameters
  d2 redesign: progressbar 
  e- tuning by ideasman42: better use of the Py API.
  c- tuning by ideasman42
  b- rewrite f_Text.Draw rotation/transform
  b- bugfix: POLYLINE-segment-intersection more reliable now
- b- bugfix: circle:_thic, 'Empties':no material_assignement
+ b- bugfix: circle:_thic, 'Empties':no material_assignment
  b- added material assignment (from layer and/or color)
  a- added empty, cylinder and UVsphere for POINTs
  a- added support for 2d-POLYLINE: splines, fitted curves, fitted surfaces
@@ -129,7 +156,7 @@
  g- rewrote: insert-point-handle-object is a small tetrahedron
  e- bugfix: closed-polymesh3d
  - rewrote: startUI, type_map.keys, f_drawer, for all class_f_draw(added "settings" as attribut)
- - added 2d/3d-support for Polyline_Width incl. angleintersection
+ - added 2d/3d-support for Polyline_Width incl. angle intersection
  beta07: 2007.06.19 by migius
  - added 3d-support for LWPolylines
  - added 2d/3d-support for Points
@@ -140,7 +167,7 @@
  - added 2d/3d-support for 3d-PolyLine, PolyMesh and PolyFace
  - added Global-Scale for size control of imported scenes
  beta04: 2007.06.12 by migius
- - rewrote the f_drawBulge for correct import the arc-segments of Polylines
+ - rewrote the f_calcBulge for correct import the arc-segments of Polylines
  beta03: 2007.06.10 by migius
  - rewrote interface
  beta02: 2007.06.09 by migius
@@ -186,30 +213,34 @@
 # --------------------------------------------------------------------------
 
 import Blender
-import bpy
+#import bpy
 from Blender import *
 #from Blender.Mathutils import Vector, Matrix
 #import BPyMessages
 
-
-from dxfReader import readDXF	  # get_name, get_layer
+from dxfReader import readDXF
+#from dxfReader import get_name, get_layer
 from dxfReader import Object as dxfObject
 from dxfColorMap import color_map
+
 from math import *
 
 try:
 	import os
 	if os.name:# != 'mac':
 		import psyco
-		psyco.log()
+		psyco.log(Blender.Get('tempdir')+"/blender.log-psyco")
+		#psyco.log()
 		psyco.full(memory=100)
 		psyco.profile(0.05, memory=100)
 		psyco.profile(0.2)
+		#print 'psyco imported'
 except ImportError:
+	#print 'psyco not imported'
 	pass
 
 print '\n\n\n\n'
-print 'Import DXF to Blender *** START ***'   #---------------------
+print 'Import DXF to Blender *** start ***'   #---------------------
 
 SCENE = None
 WORLDX = Mathutils.Vector((1,0,0))
@@ -220,10 +251,14 @@
 MIN_DIST = 0.001	#cut-off value for sort out short-distance polyline-"duoble_vertex"
 ARC_RESOLUTION = 64   #(4-500) arc/circle resolution - number of segments
 ARC_RADIUS = 1.0   #(0.01-100) arc/circle radius for number of segments algorithm
-THIN_RESOLUTION = 8   #(4-500) thin_cylinder arc_resolution - number of segments
+CURV_RESOLUTION = 12 #(3-50) Bezier curves resolution
+CURVARC_RESOLUTION = 4 #(3-32) resolution of circle represented as Bezier curve 
+THIN_RESOLUTION = 8   #(4-64) thin_cylinder arc_resolution - number of segments
 MIN_THICK = MIN_DIST * 10.0  #minimal thickness by forced thickness
 MIN_WIDTH = MIN_DIST * 10.0  #minimal width by forced width
-ANGLECUT_LIMIT = 3.0	 #limit for anglecut of polylines-wide-segments (values:1.0 - 5.0)
+TRIM_LIMIT = 3.0	 #limit for triming of polylines-wide-segments (values:0.0 - 5.0)
+ELEVATION = 0.0 #standard elevation = coordinate Z
+
 TARGET_LAYER = 3	#target blender_layer
 GROUP_BYLAYER = 0   #(0/1) all entities from same layer import into one blender-group
 
@@ -232,6 +267,7 @@
 INIFILE_DEFAULT_NAME = 'importDXF'
 INIFILE_EXTENSION = '.ini'
 INIFILE_HEADER = 'ImportDXF.py ver.1.0 config data'
+INFFILE_HEADER = 'ImportDXF.py ver.1.0 analyze of DXF-data'
 
 AUTO = BezTriple.HandleTypes.AUTO
 FREE = BezTriple.HandleTypes.FREE
@@ -252,8 +288,8 @@
 
 # from Stani's dxf writer v1.1 (c)www.stani.be (GPL)
 #---color values
-BYBLOCK=0
-BYLAYER=256
+BYBLOCK = 0
+BYLAYER = 256
 
 #---block-type flags (bit coded values, may be combined):
 ANONYMOUS		   =1  # This is an anonymous block generated by hatching, associative dimensioning, other internal operations, or an application
@@ -310,7 +346,7 @@
 
 
 class Layer:  #-----------------------------------------------------------------
-	"""Class for objects representing dxf layers.
+	"""Class for objects representing dxf LAYERs.
 	"""

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list