コード例 #1
0
def Add_Pocket(self, maxdepth, sname, new_cutter_diameter):
    bpy.ops.object.select_all(action='DESELECT')
    s = bpy.context.scene
    mpocket_exists = False
    for ob in s.objects:  # delete old medial pocket
        if ob.name.startswith("medial_poc"):
            ob.select_set(True)
            bpy.ops.object.delete()

    for op in s.cam_operations:  # verify medial pocket operation exists
        if op.name == "MedialPocket":
            mpocket_exists = True

    ob = bpy.data.objects[sname]
    ob.select_set(True)
    bpy.context.view_layer.objects.active = ob
    utils.silhoueteOffset(ob, -new_cutter_diameter/2, 1, 0.3)
    bpy.context.active_object.name = 'medial_pocket'

    if not mpocket_exists:     # create a pocket operation if it does not exist already
        s.cam_operations.add()
        o = s.cam_operations[-1]
        o.object_name = 'medial_pocket'
        s.cam_active_operation = len(s.cam_operations) - 1
        o.name = 'MedialPocket'
        o.filename = o.name
        o.strategy = 'POCKET'
        o.use_layers = False
        o.material_from_model = False
        o.material_size[2] = -maxdepth
        o.minz_from_ob = False
        o.minz_from_material = True
コード例 #2
0
    def execute(
        self, context
    ):  # this is almost same as getobjectoutline, just without the need of operation data
        ob = context.active_object
        if self.opencurve and ob.type == 'CURVE':
            bpy.ops.object.duplicate()
            obj = context.active_object
            bpy.ops.object.transform_apply(location=True,
                                           rotation=True,
                                           scale=True)  # apply all transforms
            bpy.context.object.data.resolution_u = 60
            bpy.ops.object.convert(target='MESH')
            bpy.context.active_object.name = "temp_mesh"

            coords = []
            for v in obj.data.vertices:  # extract X,Y coordinates from the vertices data
                coords.append((v.co.x, v.co.y))

            simple.remove_multiple('temp_mesh')  # delete temporary mesh
            simple.remove_multiple('dilation')  # delete old dilation objects

            line = LineString(
                coords
            )  # convert coordinates to shapely LineString datastructure
            print("line length=", round(line.length * 1000), 'mm')

            dilated = line.buffer(
                self.offset,
                cap_style=1,
                resolution=16,
                mitre_limit=self.mitrelimit)  # use shapely to expand
            polygon_utils_cam.shapelyToCurve("dilation", dilated, 0)
        else:
            utils.silhoueteOffset(context, self.offset, int(self.style),
                                  self.mitrelimit)
        return {'FINISHED'}
コード例 #3
0
ファイル: ops.py プロジェクト: AndreKravcenko/blendercam
	def execute(self, context):
		utils.silhoueteOffset(context,-self.diameter/2)
		o1=bpy.context.active_object

		utils.silhoueteOffset(context,self.diameter)
		o2=bpy.context.active_object
		utils.silhoueteOffset(context,-self.diameter/2)
		o3=bpy.context.active_object
		o1.select=True
		o2.select=True
		o3.select=False
		bpy.ops.object.delete(use_global=False)
		o3.select=True
		return {'FINISHED'}	
コード例 #4
0
ファイル: ops.py プロジェクト: Tob1112/blendercam
    def execute(self, context):
        utils.silhoueteOffset(context, -self.radius)
        o1 = bpy.context.active_object

        utils.silhoueteOffset(context, 2 * self.radius)
        o2 = bpy.context.active_object
        utils.silhoueteOffset(context, -self.radius)
        o3 = bpy.context.active_object
        o1.select = True
        o2.select = True
        o3.select = False
        bpy.ops.object.delete(use_global=False)
        o3.select = True
        return {"FINISHED"}
コード例 #5
0
ファイル: ops.py プロジェクト: craig321/myblendercontrib
    def execute(self, context):
        utils.silhoueteOffset(context, -self.diameter / 2)
        o1 = bpy.context.active_object

        utils.silhoueteOffset(context, self.diameter)
        o2 = bpy.context.active_object
        utils.silhoueteOffset(context, -self.diameter / 2)
        o3 = bpy.context.active_object
        o1.select = True
        o2.select = True
        o3.select = False
        bpy.ops.object.delete(use_global=False)
        o3.select = True
        return {'FINISHED'}
コード例 #6
0
ファイル: ops.py プロジェクト: AndreKravcenko/blendercam
	def execute(self, context):#this is almost same as getobjectoutline, just without the need of operation data
		utils.silhoueteOffset(context,self.offset)
		return {'FINISHED'}
コード例 #7
0
ファイル: ops.py プロジェクト: craig321/myblendercontrib
 def execute(
     self, context
 ):  #this is almost same as getobjectoutline, just without the need of operation data
     utils.silhoueteOffset(context, self.offset)
     return {'FINISHED'}
コード例 #8
0
    def execute(self, context):
        selected = context.selected_objects  # save original selected items

        simple.remove_multiple('intarsion_')

        for ob in selected:
            ob.select_set(True)  # select original curves

        #  Perimeter cut largen then intarsion pocket externally, optional

        diam = self.diameter * 1.05 + self.backlight * 2  # make the diameter 5% larger and compensate for backlight
        utils.silhoueteOffset(context, -diam / 2)

        o1 = bpy.context.active_object
        utils.silhoueteOffset(context, diam)
        o2 = bpy.context.active_object
        utils.silhoueteOffset(context, -diam / 2)
        o3 = bpy.context.active_object
        o1.select_set(True)
        o2.select_set(True)
        o3.select_set(False)
        bpy.ops.object.delete(
            use_global=False)  # delete o1 and o2 temporary working curves
        o3.name = "intarsion_pocket"  # this is the pocket for intarsion
        bpy.context.object.location[2] = -self.intarsion_thickness

        if self.perimeter_cut > 0.0:
            utils.silhoueteOffset(context, self.perimeter_cut)
            bpy.context.active_object.name = "intarsion_perimeter"
            bpy.context.object.location[2] = -self.base_thickness
            bpy.ops.object.select_all(action='DESELECT')  # deselect new curve

        o3.select_set(True)
        context.view_layer.objects.active = o3
        #   intarsion profile is the inside piece of the intarsion
        utils.silhoueteOffset(context, -self.tolerance /
                              2)  # make smaller curve for material profile
        bpy.context.object.location[2] = self.intarsion_thickness
        o4 = bpy.context.active_object
        bpy.context.active_object.name = "intarsion_profil"
        o4.select_set(False)

        if self.backlight > 0.0:  # Make a smaller curve for backlighting purposes
            utils.silhoueteOffset(context,
                                  (-self.tolerance / 2) - self.backlight)
            bpy.context.active_object.name = "intarsion_backlight"
            bpy.context.object.location[
                2] = -self.backlight_depth_from_top - self.intarsion_thickness
            o4.select_set(True)
        o3.select_set(True)
        return {'FINISHED'}