Well, rejoining a block that's been exploded is just a matter of reinserting the block because exploding a reference doesn't purge the block definition.
But rejoining an MLINE or POLYLINE would probably require having saved the geometry before exploding. Their definitions are not automatically saved in the drawing by a name.
Now creating say anonymous blocks for every polyline or mline is possible, but without an effective name their definition is automatically purged upon eradication. Anyway, how would you recognize the arbitrary names? Would you be able to recognize an object by its handle?
John F. Uhden
Perhaps I have not made myself clear.
I would like to have a command (a lisp I guess) that would be able to explode a block or a multiple line and execute the join command after exploding...
@kibitotatohi ,
if you want to be 100% clear? post a sample dwg with your block and two views:
on the left the block, to its right, the exploded block version plus the join.
Moshe
there it goes
i tell what i see? a block created with as pasteblock and a better quick solution is to explode the block, another explode to be free from the pline and JOIN 😀
The point is to be a faster technician by simplifying operations that I do dozens of times a day.
In simplest terms, lightly tested [it works in your sample drawing]:
(defun C:XJ (/ ss n)
(if (setq ss (ssget '((0 . "INSERT,MLINE"))))
(repeat (setq n (sslength ss))
(command "_.explode" (ssname ss (setq n (1- n))))
(initcommandversion)
(command "_.join" "_previous" "")
)
)
(prin1)
)
The pieces resulting from EXPLODE conveniently become the Previous selection. The (initcommandversion) makes the JOIN command work in the same way it does at the command line [without it, it wants an initial individual source object selection, and doesn't seem to work as I expect even when I give it one -- maybe there's a way].
I see that your block consisted of separate lines, so that when exploded the JOIN command put them back together as a closed polyline, but not as the original block reference.
I also see that exploding the MLINE turned its parts into separate lines, which the JOIN command sorta put them back together as two separate polylines, but not as the original MLINE.
I take it that there is some kinda action that you want to take between the exploding and rejoining. Now you could set an Undo;Mark before the explosion and then Undo;Back, but that would undo your action in between as well.
What you could do is to WBlock the items before exploding them and insert them back after your inbetween work.
OR,
You could set an Undo;Mark before exploding, then WBlock your inbetween work, then Undo;Back, and then insert your WBlock.
It all sounds like a kludge to me. There must be a way around the explosions to get your inbetween work done.
John F. Uhden
@john.uhden wrote:I see that your block consisted of separate lines, so that when exploded the JOIN command put them back together as a closed polyline, but not as the original block reference.
I also see that exploding the MLINE turned its parts into separate lines, which the JOIN command sorta put them back together as two separate polylines, but not as the original MLINE.
....
Those are both as intended -- not going back to the original object types. See Messages 3 & 5.