(a)     Voluntary Dismissal; Effect Thereof.

(1)     By Parties. Except in actions where property has been seized or is in the custody of the court, an action may be dismissed by the plaintiff without order of court (A) by the plaintiff informing the defendant and clerk of the dismissal before the trial date fixed in the notice to appear, or before retirement of the jury in a case tried before a jury or before submission of a nonjury case to the court for decision, or (B) by filing a stipulation of dismissal signed by all parties who have appeared in the action. Unless otherwise stated, the dismissal is without prejudice, except that a dismissal operates as an adjudication on the merits when a plaintiff has once dismissed in any court an action based on or including the same claim.

(2)     By Order of the Court; If Counterclaim. Except as provided in subdivision (a)(1) of this rule, an action shall not be dismissed at a party’s instance except upon order of the court and on such terms and conditions as the court deems proper. If a counterclaim has been made by the defendant before the plaintiff dismisses voluntarily, the action shall not be dismissed against the defendant’s objections unless the counterclaim can remain pending for independent adjudication. Unless otherwise specified in the order, a dismissal under this subdivision is without prejudice.

(b)     Involuntary Dismissal. Any party may move for dismissal of an action or of any claim against that party for failure of an adverse party to comply with these rules or any order of court. After a party seeking affirmative relief in an action has completed the presentation of evidence, any other party may move for a dismissal on the ground that upon the facts and the law the party seeking affirmative relief has shown no right to relief without waiving the right to offer evidence in the event the motion is not granted. The court may then determine them and render judgment against the party seeking affirmative relief or may decline to render any judgment until the close of all the evidence. Unless the court in its order for dismissal otherwise specifies, a dismissal under this subdivision and any dismissal not provided for in this rule, other than a dismissal for lack of jurisdiction or for improper venue or for lack of an indispensable party, operates as an adjudication on the merits.

(c)     Dismissal of Counterclaim. The provisions of this rule apply to the dismissal of any counterclaim.

(d)     Costs. Costs in any action dismissed under this rule shall be assessed and judgment for costs entered in that action. If a party who has once dismissed a claim in any court of this state commences an action based on or including the same claim against the same adverse party, the court shall make such order for the payment of costs of the claim previously dismissed as it may deem proper and shall stay the proceedings in the action until the party seeking affirmative relief has complied with the order.

(e)     Failure to Prosecute. All actions in which it affirmatively appears that no action has been taken by filing of pleadings, order of court, or otherwise for a period of 6 months shall be dismissed by the court on its own motion or on motion of any interested person, whether a party to the action or not, after 30 days’ notice to the parties, unless a stipulation staying the action has been filed with the court, or a stay order has been filed, or a party shows good cause in writing at least 5 days before the hearing on the motion why the action should remain pending.