user: Show practical ways to work with KinematicConstraint(Constraint) in a Blender add-on or script – include code.

assistant: # KinematicConstraint(Constraint)

base classes — [`bpy_struct`](bpy.types.bpy_struct.html#bpy.types.bpy_struct "bpy.types.bpy_struct"), [`Constraint`](bpy.types.Constraint.html#bpy.types.Constraint "bpy.types.Constraint")

*class* bpy.types.KinematicConstraint(*Constraint*)
:   Inverse Kinematics

    chain_count
    :   How many bones are included in the IK effect - 0 uses all bones

        Type:
        :   int in [0, 255], default 0

    distance
    :   Radius of limiting sphere

        Type:
        :   float in [0, 100], default 0.0

    ik_type
    :   Type:
        :   enum in [`'COPY_POSE'`, `'DISTANCE'`], default `'COPY_POSE'`

    iterations
    :   Maximum number of solving iterations

        Type:
        :   int in [0, 10000], default 0

    limit_mode
    :   Distances in relation to sphere of influence to allow

        - `LIMITDIST_INSIDE`
          Inside – The object is constrained inside a virtual sphere around the target object, with a radius defined by the limit distance.
        - `LIMITDIST_OUTSIDE`
          Outside – The object is constrained outside a virtual sphere around the target object, with a radius defined by the limit distance.
        - `LIMITDIST_ONSURFACE`
          On Surface – The object is constrained on the surface of a virtual sphere around the target object, with a radius defined by the limit distance.

        Type:
        :   enum in [`'LIMITDIST_INSIDE'`, `'LIMITDIST_OUTSIDE'`, `'LIMITDIST_ONSURFACE'`], default `'LIMITDIST_INSIDE'`

    lock_location_x
    :   Constraint position along X axis

        Type:
        :   boolean, default False

    lock_location_y
    :   Constraint position along Y axis

        Type:
        :   boolean, default False

    lock_location_z
    :   Constraint position along Z axis

        Type:
        :   boolean, default False

    lock_rotation_x
    :   Constraint rotation along X axis

        Type:
        :   boolean, default False

    lock_rotation_y
    :   Constraint rotation along Y axis

        Type:
        :   boolean, default False

    lock_rotation_z
    :   Constraint rotation along Z axis

        Type:
        :   boolean, default False

    orient_weight
    :   For Tree-IK: Weight of orientation control for this target

        Type:
        :   float in [0.01, 1], default 0.0

    pole_angle
    :   Pole rotation offset

        Type:
        :   float in [-3.14159, 3.14159], default 0.0

    pole_subtarget
    :   Type:
        :   string, default “”, (never None)

    pole_target
    :   Object for pole rotation

        Type:
        :   [`Object`](bpy.types.Object.html#bpy.types.Object "bpy.types.Object")

    reference_axis
    :   Constraint axis Lock options relative to Bone or Target reference

        Type:
        :   enum in [`'BONE'`, `'TARGET'`], default `'BONE'`

    subtarget
    :   Armature bone, mesh or lattice vertex group, …

        Type:
        :   string, default “”, (never None)

    target
    :   Target object

        Type:
        :   [`Object`](bpy.types.Object.html#bpy.types.Object "bpy.types.Object")

    use_location
    :   Chain follows position of target

        Type:
        :   boolean, default False

    use_rotation
    :   Chain follows rotation of target

        Type:
        :   boolean, default False

    use_stretch
    :   Enable IK Stretching

        Type:
        :   boolean, default False

    use_tail
    :   Include bone’s tail as last element in chain

        Type:
        :   boolean, default False

    weight
    :   For Tree-IK: Weight of position control for this target

        Type:
        :   float in [0.01, 1], default 0.0

    *classmethod* bl_rna_get_subclass(*id*, *default=None*, */*)
    :   Parameters:
        :   **id** (*str*) – The RNA type identifier.

        Returns:
        :   The RNA type or default when not found.

        Return type:
        :   [`bpy.types.Struct`](bpy.types.Struct.html#bpy.types.Struct "bpy.types.Struct") subclass

    *classmethod* bl_rna_get_subclass_py(*id*, *default=None*, */*)
    :   Parameters:
        :   **id** (*str*) – The RNA type identifier.

        Returns:
        :   The class or default when not found.

        Return type:
        :   type