How to resolve hundreds of unwanted blocks?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

How to resolve hundreds of unwanted blocks?

widhi-muttaqien
LibreCAD keeps creating a new block definition whenever the user copy-pastes or cut-pastes an instance. I think this is an old bug that came back in version 2.2.1.

My question is, what if we already have hundreds of unwanted blocks created accidentally. Deleting and recreating them is a waste of time. How can we fix it, say, relink them all to just one block?
Reply | Threaded
Open this post in threaded view
|

Re: How to resolve hundreds of unwanted blocks?

dxli
Can you provide a procedure to trigger this bug behavior?

I tried:

1, File > New, create a new drawing;
2, Draw some lines;
3, Create a new block with lines from Step 2;
4, Edit block from Step 3;
5, Closing the editing window.

Expected:
1, only a single block after Step 5.

widhi-muttaqien wrote
LibreCAD keeps creating a new block definition whenever the user copy-pastes or cut-pastes an instance. I think this is an old bug that came back in version 2.2.1.

My question is, what if we already have hundreds of unwanted blocks created accidentally. Deleting and recreating them is a waste of time. How can we fix it, say, relink them all to just one block?
Reply | Threaded
Open this post in threaded view
|

Re: How to resolve hundreds of unwanted blocks?

widhi-muttaqien
This post was updated on .
Hi dxli.
Thank you for the help.

This is not about editing a block, but about copy-pasting (with Ctrl + C) or cut-pasting (with Ctrl + X) a block in the main drawing.
So after step 5. Try copy a block to other location. Or try cut and paste it. This is a very common workflow in architecture.

Example scenario. Say your building has 10 doors all of the same width of 90 cm. You create a block of that door, and name it for example "door 90". And place the block on each of the wall openings. Inserting the door block from the block list or using Move/copy command works perfectly fine. But when you try to perform copy and paste a door block (Ctr+C or Ctr+V) from 1 opening to the other, strangely LibreCAD created a new block "door 90-1", then "door 90-2", then "door 90-3", and so on. You realize it too late when you have 10 doors each link to a different block, not to the same block.
Reply | Threaded
Open this post in threaded view
|

Re: How to resolve hundreds of unwanted blocks?

perepujal
As a last ressource, one can try to edit the dxf in a text editor, or with an automatic processor like sed, of course after having backed up it
one just need to rename all ocurrences of "blockname-0" "blockname-1" etc to "blockname"

For example, with sed one could run

cat file.dxf | sed "s/block name-.*/block name/" > processedfile.dxf
should rename any block name-whatever to just block name in just one run and put the result in a file called "processedfile.dxf"

This works fine in a small dxf I made for testing, hope it works too for more complex drawings
HTH
Pere
Reply | Threaded
Open this post in threaded view
|

Re: How to resolve hundreds of unwanted blocks?

widhi-muttaqien
Hi perepujal,
Thank you for the help.
I ended up using QCAD to fix the file. I just need to choose all of the instances, and in the properties editor type in the name of the block link I want to target. And it is done. All the unwanted blocks can now be safely deleted.
I'll make a video tutorial about this on YouTube to address this issue, in case other users stumble upon the same problem. Also to alarm the developers about the bug.