Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guide offset #22

Open
bstartek opened this issue Nov 12, 2020 · 0 comments
Open

Guide offset #22

bstartek opened this issue Nov 12, 2020 · 0 comments

Comments

@bstartek
Copy link

Hi Cicero,
I add some function to Other-> Surface Result

Printer offset.
Add offtset -> block undercuts with (Import Base Box -> Create surface) and then create splint

Tell me what do you think.
Bartek

def printoffset_set_def(self, context):

    bpy.ops.object.mode_set(mode = 'EDIT')

    bpy.ops.mesh.select_all(action='SELECT')

    bpy.ops.mesh.extrude_region_shrink_fatten(MESH_OT_extrude_region={"use_normal_flip":False, "mirror":False}, TRANSFORM_OT_shrink_fatten={"value":-float(bpy.context.scene.print_offset_input), "use_even_offset":False, "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "release_confirm":False, "use_accurate":True})

    bpy.ops.object.mode_set(mode = 'OBJECT')

class printoffset_set(bpy.types.Operator):
    """Tooltip"""
    bl_idname = "object.printoffset_set"
    bl_label = "blblblblba"
    bl_options = {'REGISTER', 'UNDO'}


    def execute(self, context):
        printoffset_set_def(self, context)
        return {'FINISHED'}

bpy.utils.register_class(printoffset_set)

class OTHER_PT_SurfaceResult(bpy.types.Panel):
    bl_label = "Surface Result"
    bl_region_type = 'UI'
    bl_space_type = 'VIEW_3D'
    bl_options = {'DEFAULT_CLOSED'}
    bl_category = "Others"

    def draw(self, context):
        layout = self.layout

        context = bpy.context
        obj = context.object
        scn = context.scene

#        row = layout.row()
#        row.label(text="Convert MHA to DCM:")

        col = self.layout.column(align = True)
        #col.scale_y=1.5
        col.alignment = 'CENTER'
        col.prop(context.scene, "print_offset_input")
        
        row = layout.row()
        row = layout.row()
        row.operator("object.printoffset_set", text="Set offset", icon="OBJECT_ORIGIN") #Funkcja offsetu do uzupelnienia

        row = layout.row()
        row = layout.row()
        row.operator("object.importa_surface_result", text="Import Base Box", icon="MESH_CUBE")

        row = layout.row()
        row = layout.row()
        row.operator("object.cria_anti_retencao", text="Create Surface", icon="ALEMBIC")


        row = layout.row()
        row = layout.row()
        row.operator("object.apaga_anti_retencao", text="Remove Box", icon="CANCEL")


bpy.utils.register_class(OTHER_PT_SurfaceResult)

bpy.types.Scene.print_offset_input = bpy.props.StringProperty \
  (
    name = "Printer offset [mm]",
    description = "Type print offset. For example Form3 Surgical Guide Resin = 0.02 ",
    default = "0.02"
  )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant