Now, if I were to enter "JOIN" at the AutoCAD command prompt, select line #1, select line #2, then hit [enter] to end the command, I would see the message "2 objects converted to 1 polyline", and as you'd expect the two lines are now a single polyline.
However, if I were to enter (command "_join" line1 line2 "") to mimic the same as above, I see the message "0 lines joined to source, 1 object discarded from the operation" and the two lines are still two lines (not a single polyline)
(1) can someone please confirm this happens for them too?
(2) does anyone know of a workaround, or a different way to join two lines into a single polyline in lisp?
Thanks for the replies. Indeed, switching to PEDIT worked out best, and temporarily setting PEDITACCEPT=1 made it more robust (whether the user selects lines or polylines, the command (command "_PEDIT" ent1 "_J" ent2 "" "") works in both cases). I still dont understand why JOIN didn't work, and I'm daring enough to call it a bug.
AutoCAD commands change between versions; therefore, to enable backwards compatibility, invoking a command through AutoLISP will usually use the old version of the command so that there is less chance of a custom program breaking when a new version is released.
To force AutoLISP to use the newer version of a command, you can use the initcommandversion function, for example: