Preparing Blender Models for Export to 3d Laser
I've written a script to prepare Blender models for 3d engraving. The 3d engraving software requires models to be a mesh made of triangular polygons. A typical Blender model isn't.
Usually I create models with a mix of text, curved objects, and meshes made up of quadrangular polygons. To prepare them for export involves:-
- Converting all objects to MESHs
- Selecting each object in turn and
- Selecting all vertices
- Removing overlapping vertices (Doubles)
- Converting quadrangular polygons to triangles
Or in keyboard shortcuts, A >> Alt C >> ↓ >> Enter and then for each object ⇆ Tab >> A >> W >> R >> Ctrl T >> ⇆ Tab.
If I did one model occasionally, this wouldn't be an issue. But it is lengthy and tedious when doing a series of models, repetitively. So I wrote a script that does it for me :)
"name": "Crystallise",
"author": "John Flower",
"version": (0,1),
"blender": (2, 5, 8),
"api": 35853,
"location": "View3D > Add",
"description": "Prepares a model for crystal export",
"warning": "",
"wiki_url": "",
"tracker_url": "",
"category": "Mesh"}
import bpy
class OpCrystallise(bpy.types.Operator):
bl_idname = "screen.crystallise"
bl_label = "Crystallise"
def execute(self, context):
for ob in bpy.context.selected_objects:
bpy.ops.object.mode_set(mode='OBJECT')
bpy.ops.object.convert()
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_all()
bpy.ops.mesh.quads_convert_to_tris()
bpy.ops.mesh.remove_doubles()
bpy.ops.object.mode_set(mode='OBJECT')
self.report({'WARNING'}, "Crystallise")
return {'FINISHED'}
# check poll() to avoid exception.
if bpy.ops.object.mode_set.poll():
bpy.ops.object.mode_set(mode='EDIT')
# registering and menu integration
def register():
bpy.utils.register_class(OpCrystallise)
# unregistering and removing menus
def unregister():
bpy.utils.unregister_class(OpCrystallise)
if __name__ == "__main__":
register()
Comments
Please forgive my ignorance, but what is the purpose or function of this script? It seems fascinating, perhaps a bit too technologically advanced for my feeble mind to comprehend. Why would one want blender models for 3d engraving?For the record, I intend no offense whatsoever in asking this.
Hi Peter,
I use this script almost daily to engrave inside crystals. I work for an engraving company in New Zealand. One of our machines is a 3d laser. It has software that requires models to be made up of triangles. This script turns all objects into triangles. Saving me a lot of time.
Below is an example of what i do:-
Regards,
John
Add new comment