Hi all,
I’m writing a python script for procedural houses modeling and I get blocket for days after the 10 first lines… and I don’t understand why my script simply crashes Blender.
Here is the code, the goal is, in a mesh composed, of single separate edges, to selectt edges one by one, and (for the beginning) to extrude them.
# ArToKi-Homa.py (c) 2011 Thierry Maes (tmaes)
#
# ***** 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 LICENCE BLOCK *****
bl_info = {
"name": "ArToKi-HoMa",
"author": "Thierry Maes (tmaes)",
"version": (0,0,0),
"blender": (2, 6, 4),
"api": 41889,
"location": "Properties > Object > ArToKi HoMa",
"description": "Create houses based on simple 2 point lines.",
"warning": "",
"wiki_url": "",
"tracker_url": "",
"category": "Object"}
"""
This addon is made for mass planification.
It create simple house primitives
"""
import bpy
class OBJECT_PT_ArToKi_HoMa(bpy.types.Panel):
bl_label = "ArToKi - HoMa"
bl_space_type = "PROPERTIES"
bl_region_type = "WINDOW"
bl_context = "object"
def draw(self, context):
layout = self.layout
obj = bpy.context.active_object
row = layout.row()
row.operator("object.homa_create_houses",text="Create Houses")
class OBJECT_OT_HoMa_create_houses(bpy.types.Operator):
bl_label = "HoMa Create Houses"
bl_idname = "object.homa_create_houses"
bl_description = "Transforms 2 point lines to houses"
@classmethod
def poll(cls, context):
return context.active_object is not None
def execute(self, context):
#main(context)
#print('prout')
for t in bpy.context.active_object.data.edges:
t.select=True
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.extrude_edges_move(TRANSFORM_OT_translate={"value":(0,5,0),"constraint_axis":(False,True,False),"constraint_orientation":'NORMAL'})
bpy.ops.object.mode_set(mode='OBJECT')
t.select=False
return {'FINISHED'}
# registering and menu integration
def register():
bpy.utils.register_class(OBJECT_PT_ArToKi_HoMa)
bpy.utils.register_class(OBJECT_OT_HoMa_create_houses)
# unregistering and removing menus
def unregister():
bpy.utils.unregister_class(OBJECT_PT_ArToKi_HoMa)
bpy.utils.unregister_class(OBJECT_OT_HoMa_create_houses)
if __name__ == "__main__":
register()
If I test it just after rebooting my computer, it works once, every other try makes blender simply crash.
Does anyone have an idea?
Thanks in advance…
–
Thierry Maes