You would want to create a conditional replace system that is based on the MTEXT objects with the text value being the controlling element.
You also have some different layer elements that would be controlled by the original color. Consider adding more code for that.
This code will use blocks to insert based on the insertion points of the mtext entities.
Things to consider. This will not erase the old entities, you will want to do that when you get everything all done.
You will want to create blocks to meet the desired outcome. You can do it differently, but blocks will be probably the easiest solution.
This will not do anything with the hatch patterns, you can add code in for that if you wish too.
The insertion point may not come out the way you want since the mtext insertion point could prove to be erratic. You may want to use an osnap arodn that point to get what you want.
Good luck,
(defun c:quick();defines the new command
(setq myss (ssget "X" '((0 . "MTEXT")))) ; creates a selection set of MTEXT entities
(if myss ; verifies there is a selections set to process
(progn ; groups together processes
(setq mylen (sslength myss) ; how many mtext ents
mycnt 0 ; starting point counter
)
(while (< mycnt mylen) ; whiel loop to step through all ents
(setq myent (ssname myss mycnt) ; pick the index item out of the selection set using cnt variable
myentdata (entget myent); get the ents dxf data
myins (cdr (assoc 10 myentdata)) ; get the insertion point (dxf code 10)
mymtextval (cdr (assoc 1 myentdata)); get the text value in the ent
mycnt (1+ mycnt) ; bump our counter for the next ent on next iteration
blname "Unknown" ; set the blname variable to unknown to do nothing with.
)
(cond ; start conditionl block
((= mymtextval "(!") ; is the mtext value this?
(setq blname "switch") ; then set my blockname to this
)
((= mymtextval ")\"") ; Same as above
(setq blname "recloser")
)
((= mymtextval "kà")
(setq blname "regulator")
)
;;add more options here
)
(if (/= blname "Unknown") ; if there is a blockname found
(command "-insert" blname myins "" "" "") ; insert the block
)
)
)
)
(princ)
)