@hak_vz wrote:
....
@ВeekeeCZ and @kajanthangavel In your code you are extracting text bounding box. To mirror text object is this really necessary?
..... Instead of search for vlax-curve-getclosestpointto finding appropriate polyline segment is all what is needed.
Mine also uses the bounding box, and finds the closest point to the middle of that on the Mirror path object. The "appropriate polyline segment" may serve well enough for the Mirror axis when the path is a Polyline made of only line segments, but mine works with Polylines including arc segments and all other kinds of path objects with linearity [(vlax-curve-...)-class objects].
EDIT -- Further elaboration on the difference it makes:
If "finding appropriate polyline segment" means you would use the endpoints of that nearest segment for the Mirror axis, then if that segment is a line segment, it doesn't matter, but if it's an arc segment, here's the difference:

The white "test" Texts are the originals, and the yellow Polyline is the Mirroring path. The red ones are the result of using the endpoints of the nearest segment [the magenta Points] as the Mirror axis. The green ones are the result of using the direction of the path at its closest point to the midpoint of the object's bounding box [here done with my MAO command, but I assume similar results from other routines that take a similar approach].
And if "finding appropriate polyline segment" involves finding the place on the path that is closest to the object, then if it's not using the middle of its bounding box, presumably for Text it would have to use the insertion point. The results from that will vary depending on the justification of the Text, even when using the local direction of the path for the Mirror axis, not just the segment endpoints. Here, the Text is left-justified. Again, if the closest point is on a line segment, it doesn't matter, but with an arc segment, here's the difference:

The magenta Point is the closest point on the path to the Text's insertion point. Using the direction of the path at that point for the Mirror axis, the result is the red one. Using the closest point to the Text's bounding-box midpoint gives the green result [again, here done with MAO].
If the Text were Middle or Middle-Center or Middle-Left of Middle-right justified, and if its rotation were always perpendicular to the path as in these examples, it wouldn't matter [or not much -- there could be slight differences depending on which of those justifications and the specifics of the text content]. Likewise if it were Center or Bottom-Center or Middle-Center or Top-Center justified and its rotation were parallel to the path. But other justifications and/or rotations will have similar differences in results.
The effects are similar with path objects such as Ellipses, Splines, Arcs, and Circles. It wouldn't make a difference when the path is a Line or Ray or Xline, nor a Polyline line segment except for situations where a Text object is close to a bend in the Polyline, where again the justification could make a difference, because the nearest point on the Polyline to the insertion point could be on a different segment than the nearest point to the bounding-box midpoint.
Kent Cooper, AIA