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:
-rw-r--r--io_mesh_stl/blender_utils.py1
-rw-r--r--io_mesh_stl/stl_utils.py18
2 files changed, 8 insertions, 11 deletions
diff --git a/io_mesh_stl/blender_utils.py b/io_mesh_stl/blender_utils.py
index 9c3488eb..7b037716 100644
--- a/io_mesh_stl/blender_utils.py
+++ b/io_mesh_stl/blender_utils.py
@@ -38,6 +38,7 @@ def create_and_link_mesh(name, faces, points):
obj = bpy.data.objects.new(name, mesh)
scene.objects.link(obj)
+ scene.objects.active =
obj.select = True
diff --git a/io_mesh_stl/stl_utils.py b/io_mesh_stl/stl_utils.py
index 1d35acb1..49e8d0f9 100644
--- a/io_mesh_stl/stl_utils.py
+++ b/io_mesh_stl/stl_utils.py
@@ -145,19 +145,15 @@ def _ascii_read(data):
data.readline()
while True:
- # strip facet normal // or end
- data.readline()
-
- # strip outer loup, in case of ending, break the loop
- if not data.readline():
+ l = data.readline()
+ if not l:
break
- yield [tuple(map(float, data.readline().split()[1:]))
- for _ in range(3)]
-
- # strip facet normalend and outerloop end
- data.readline()
- data.readline()
+ # if we encounter a vertex, read next 2
+ l = l.lstrip()
+ if l.startswith(b'vertex'):
+ yield [tuple(map(float, l_item.split()[1:]))
+ for l_item in (l, data.readline(), data.readline())]
def _binary_write(filename, faces):