Preparing Blender Models for Export to 3d Laser

  • A curved object like this requires processing before it can be engraved.
    A curved object like this requires processing before it can be engraved. 
  • This is the object in edit mode. It is made of curves. Unsuitable for engraving.
    This is the object in edit mode. It is made of curves. Unsuitable for engraving. 
  • This is the object after running the script. Made up of little triangles. Perfect for engraving.
    This is the object after running the script. Made up of little triangles. Perfect for engraving. 

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:-

  1. Converting all objects to MESHs
  2. 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 :)

bl_info = {
    "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()

Files: 

Comments

Peter Egan

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.

john
john's picture

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