(defun c:convert_arc_line ( / arc line)
(if (setq arc (ssget "_X" '((0 . "ARC")))) (command "_.pedit" "_m" arc "" "_Y" "") (princ (strcat "\nMohan there were no arc Object(s) found ... ")))
(if (setq line (ssget "_X" '((0 . "LINE")))) (command "_.pedit" "_m" line "" "_Y" "") (princ (strcat "\nMohan there were no line Object(s) found ... ")))
(princ (strcat "\nMohan total of " (itoa (sslength arc)) " Arc Object(s) & " (itoa (sslength line)) " Line Object(s) were converted to Polylines ... " ))
(princ))
Command: CONVERT_ARC_LINEwhen nothing is selected with ssget for arc and line they are still nil. You can't use sslength on a nil selection set.
This will default to: Mohan total of 0 Arc Object(s) & 0 Line Object(s) were converted to Polylines ...
if any arc or lines are converted it will update the 0 to that number.
---Edit
Might also want to limit your selection to model space or ctab (current tab). "_X" picks up any line or arc in the drawing even on other tabs but the command line pedit will only modify lines and arcs on current tab.
I change the PEDITACCEPT variable so you don't have to add "_Y".
That way it also works if it already is set to 1
---EditI was modifying to work through all layouts & model, still there is minor error !
Might also want to limit your selection to model space or ctab (current tab). "_X" picks up any line or arc in the drawing even on other tabs but the command line pedit will only modify lines and arcs on current tab.