Librecad keeps adding blocks to block list

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

Librecad keeps adding blocks to block list

PaulyF
I make and use blocks a, b and c
Then after I work on the drawing for a while I look and see that my block list now includes
blocks a, a(0), a(1), a(2), a,(3), b, b(0), b(1), b(2), b(3), c, c(0), c(1), c(2), c(3) etc.

I need a clue.  Anybody have any ideas?
Thanks,
Paul
Reply | Threaded
Open this post in threaded view
|

Re: Librecad keeps adding blocks to block list

Lambertus
I could use an answer to this too.



My drawing now contains 375 empty(?) duplicates of just one of the blocks. This happens with all the blocks, and inflates the  file size. They can only be deleted one at a time, and that is very time consuming. Deleting them does not change the drawing, and the file size greatly reduces.
Reply | Threaded
Open this post in threaded view
|

Re: Librecad keeps adding blocks to block list

dellus
If you insert a block from the library browser repeatedly, it will always be another block in the drawing. Insert it from the blocks list.
In V 2.2.0 rc you can delete multiple blocks in one go. https://forum.librecad.org/Very-large-file-sizes-tp5720110p5720120.html
As a workaround for 2.1.3 you could select and copy all the content of the screen and repaste it into a new empty drawing. Must have the same Drawing Preferences of course.  
Reply | Threaded
Open this post in threaded view
|

Re: Librecad keeps adding blocks to block list

Lambertus
Thank you.
Nice that blocks can now be deleted in bulk in 2.2.0.
Cannot find a Linux version.

This particular block set is for adding 3-tab asphalt shingles to a roof (Canada).
I did that shingle by shingle from the drawing block list for one view of the roof (gable style).
Then that shingle, tar paper and roof sheathing was imported into the drawing for the other side of the building.
That was done by creating a new drawing of just the shingles, tar paper, and roof sheathing, and importing that file as a block into the other view.
The new drawing of the roofing was created by making a a copy of the roofed view and deleting all elements of the drawing that was not the roof covering. I did not edit the block list before that import, since at the time, I did not appreciate that block lists appear to expand.
Both files (one of each two views) have the same number of such blocks (375).



Reply | Threaded
Open this post in threaded view
|

Re: Librecad keeps adding blocks to block list

dellus
I do not understand how you got so many blocks into your drawing when you inserted the shingles from the drawing's block list. How many shingles? 375?
Maybe it has to do with making a block of the drawing already containing blocks, blocks in block. Confusing.
Does the workaround to copy and paste into a new drawing work to reduce the blocks number?
There is no Linux version readily available. There is a portable windows version which works well with Wine under Linux. Tested by me. https://portableapps.com/node/63458
Reply | Threaded
Open this post in threaded view
|

Re: Librecad keeps adding blocks to block list

Lambertus
Thank you.

There are 54 "3-tab" shingles in each of the two drawings.

Following your suggestion, I copied (crtl + C) and pasted (ctrl + V)  the shingles, the tar paper and the roof sheathing to a new file (Involves seven layers).
That removed all blocks from the block list except for "0.5-tab" shingle block (a block of a small piece of a "3-tab" shingle).
It removed the "1-tab" and "3-tab" blocks from the block list, even though the blocks are still visible in the drawing.
Highlighting the elements to copy also highlighted some ghost elements (invisible), in a similar configuration as the shingles, in the lower left of the drawing near the 0,0 coordinate. I saved the file and re-opened it. All the block elements that were no longer in the block list did not get saved and only the sheathing, tar paper and "0.5-tab" shingles remained. Still have some ghost elements near 0,0.

I had not used this technique before because when i copy and pasted into an existing drawing with layers, the paste would loose all layer information. Importing a file as a block was the only way to retain all layer information.

If you want to play with the files, they are uploaded here. Sorry about the large file with the many blocks.
shop-south_roofing-copy_test.dxf
shop-south_roofing-only_2021-03-28.dxf

RE: using Windows version through Wine.
I may do that because I might never finish these drawings using the Linux version

Version: 2.1.2
Compiler: GNU GCC 6.2.0
Compiled on: Sep 17 2016
Qt Version: 5.9.5
Boost Version: 1.62.0

On Ubuntu 18.04
Reply | Threaded
Open this post in threaded view
|

Re: Librecad keeps adding blocks to block list

Gary S
This post was updated on .
I can't say why there are so many duplicates either, but by turning the blocks off ("Hide all blocks" in the Block List widget) and then turning them on one by one you can begin to see which ones are being used.  It appears that only "0.5-tab", "1-tab" and "3-tab" are being used in the drawing (shop-south_roofing-only_2021-03-28.dxf).  All the others are legitimate blocks with associate entities and increases the files size, but it appears they can be safely deleted.  

Copying & pasting to a new drawing, whether selecting all of them individually or via a select window copies all blocks to the new drawing.

Selecting one of each and then copying & pasting will result in a single block of each.  Pasting a second time will add a subsequent set of blocks.  If you just paste a single block of each, they can then be inserted from the Block List without creating duplicates in the list.  But, that of course means you would almost be starting over...

So, removing all the extra blocks reduced the file from 1.3 MB to 69 kB:
shop-south_roofing-only_2021-03-29.dxf
Reply | Threaded
Open this post in threaded view
|

Re: Librecad keeps adding blocks to block list

Lambertus

Yes.
Each of the extra blocks has data and I had done the same as you suggested, testing each one to see if it was visible in the diagram. That is how I found out they were extra, and were created by the program somehow, since i did not make them.
Yes removing them all greatly reduces the file size, which is why it is important for me to delete them, since the other quirk of LibreCAD is that very large files will not permit selection of an object.

I did not have the same experience as you when copying and pasting the desired elements to a new drawing. For some reason I just get all the layers and just one block copied (0.5-tab). As you say the copy-paste thing does not really help me much, since I have to recreate the diagram through the copy paste routine; which in my case does not re-create all the needed blocks anyway (version and OS issue?).

My actual issues are:
 1. not understanding why the operation of LibreCAD finds it necessary to create unused copies of an existing block, and
 2. assuming it is necessary, then being able to efficiently delete the unused duplicate blocks (already determined to be outside the scope of LibreCAD development)

Thank you.

Reply | Threaded
Open this post in threaded view
|

Re: Librecad keeps adding blocks to block list

Gary S
This post was updated on .
The additional blocks may have been created at this step:

   "The new drawing of the roofing was created by making a a copy of the roofed view and deleting all elements of the drawing that was not the roof covering."

Copying blocks within a drawing will create additional blocks in the block list.

As Dellus mentioned., the latest version of LC does make it easier to remove multiple blocks.  Have you considered compiling it?  I'm using LC v2.2.0rc2 that I compiled on Debian Bullseye.  The new and improved features makes it a worthwhile effort...
Reply | Threaded
Open this post in threaded view
|

Re: Librecad keeps adding blocks to block list

dellus
In reply to this post by Lambertus
The copy and paste procedure gets different results in 2.1.3 and 2.2.0, as I just have found out. With this drawing, with 2.1.3 as Lambertus, with 2.2.0 as Gary.
I have suggested to try this method as in a test, where I had imported one block from the Library Browser several times, it worked. I thought it might be something similar with Lambertus' drawing.
Now I have tested if copying a block within a drawing really creates a new block in the block list - yes it does. Really dangerous. You have to know. It only happens with Copy and Paste, but not with the Modify - Move/Copy command.
We should check if this is common behavior in other CAD packages, standard. If not this should be changed, as it probably often produces mischief.
 
Reply | Threaded
Open this post in threaded view
|

Re: Librecad keeps adding blocks to block list

Gary S
In reply to this post by Lambertus
BTW, I also note in the drawing "shop-south_roofing-only_2021-03-28.dxf" all the layers are locked.  When you mention "since the other quirk of LibreCAD is that very large files will not permit selection of an object. ".  Check the drawing you have as locked layers will also prevent selecting an object.
Reply | Threaded
Open this post in threaded view
|

Re: Librecad keeps adding blocks to block list

Gary S
In reply to this post by dellus
"mischief" indeed!
Reply | Threaded
Open this post in threaded view
|

Re: Librecad keeps adding blocks to block list

Lambertus
Thank you both for spending time on this.

Here is some clarification in case it helps figure out what is happening.
1. How i used the blocks.
I drew a shingle and then saved it as a block.
Then i would place that block using the move/copy tool. I only use the move/copy tool and not crtl short cuts.
To place a new shingle of that type, i would use the move/copy tool to create and place a copy next to the first shingle.
After creating a row of 3 of them I would select and use the move/copy tool to copy the 3 to the next row of shingles.
I selected those two rows of 3 shingles and copied them to the next row and so on.
That created the roofing for the first view.

2. How i created the roofing in the second view (opposite side of building).
I created a diagram of just the elements i wanted (sheathing, tar paper, shingles).
In the second view i imported the file of the roofing elements as a block.

3. Selection problem of large files.
Dellus alerted me to this during the discussion about a selection problem with angle dimension set to zero.
For the architectural drawing of four building views, i created a new drawing and imported the four building views from their four separate files. Each view was imported as a block.
I could not select any element in that file of 12 Mb.
I had to edit the file because of another LibreCAD quirk, any hatch area in front reverts to being behind the elements from such a block import.
I understand the layer lock tool and its influence on selection. I use that all the time to control what gets selected.
Reply | Threaded
Open this post in threaded view
|

Re: Librecad keeps adding blocks to block list

Gary S
With my environment (^) appears the additional blocks are added in step 2.  After 'shingling' one half of the roof (via inserting blocks and "Move/Copy"), I saved just the shingles to a separate file and then imported it as a block for the second half of the roof.  The number of blocks went from three to 30+ (I only partially shingled the roof).  If you 'Move/Copy' the first view to create the second view you could avoid the problem.  As noted previously, Copy & Paste ([Ctrl]-C / [Ctrl}-V} will also cause the blocks to multiply in the block list.

[^: LC 2.20rc2+ on Debian Bullseye]
Reply | Threaded
Open this post in threaded view
|

Re: Librecad keeps adding blocks to block list

Lambertus
Interesting
As mentioned earlier the file of the view I started with has exactly the same number of duplicate blocks as the file to which the shingle set were imported.

Thank you
Reply | Threaded
Open this post in threaded view
|

Re: Librecad keeps adding blocks to block list

LordOfBikes
Administrator
Let me mention an option to move/copy blocks.
What many don't know, is that an insert has array parameters.
When inserting a block from library browser you have to use Modify / Properties tool and click on the inserted block.
Using the drawings block list, shows the array parameter in the tool option bar already, before the insert.
When you set X and Y multipliers and distances you will get a pattern from one block.
See https://librecad.readthedocs.io/en/latest/guides/blocks.html?highlight=insert#inserting-blocks

This would also help to avoid to flood the block list.
investing less than half an hour into Search function can save hours or days of waiting for a solution
Reply | Threaded
Open this post in threaded view
|

Re: Librecad keeps adding blocks to block list

Lambertus

Thank you.

I have used the linear array option when creating or copying elements (example: wall of 2x6 studs spaced 16" centre).
This should have worked well for drawing the shingles as well; just did not think of it at the time.
So, as long as it is an insert routine rather than a copy routine, the duplicate blocks would not be made?
Reply | Threaded
Open this post in threaded view
|

Re: Librecad keeps adding blocks to block list

Gary S
My first preference is to insert from the Block List.  "Move / Copy" seems to be okay.  Avoid Copy & Paste and importing drawing containing blocks.

Also, the origin of the block (0,0) is the insertion point for the block.  In the drawing provided earlier the shingles' origin were off to the far left and below the block itself.  If, for example, it was at the lower right corner of the shingle, it makes inserting the shingle block trivial.   With "Snap on end points" enabled, the next shingle can be placed to the previous shingle - almost like shingling a roof in the real world...
Reply | Threaded
Open this post in threaded view
|

Re: Librecad keeps adding blocks to block list

Lambertus

Used your guidance and made some test drawings of shingles using the blocks from the block list, copying using the move/copy tool and the matrix tool from block properties.

No duplicate blocks appear by inserting a block from the block list.
No duplicate blocks appear when using the move/copy tool to copy a drawn block, either as a single or a multiple.
Duplicate blocks only appeared when using the crtl+c copy and crtl+v past. Each paste creates one duplicate of the single block even if copy pasting many of the blocks at one time.

Tried to figure out the matrix tool and gave up.

In conclusion, what Gary S said works for not creating duplicate blocks in the drawing.

So, I went back through my archived versions of the two drawings (North and South sides of the building) and discovered:

1) that the shingle blocks were first created, and their drawing as roof shingles first done, in the North view on November 25, 2016. No duplicates are in the block list.

2) The duplicate blocks appeared in the block list of the South view November 26, 2016. The drawing had no shingles. In other words, even though the block list had the original and all duplicate shingle blocks I see today, the drawing had no shingles drawn. Therefore, I must have done something while copying the shingles from the North view to the South view to create the block duplicates.

3) The duplicate blocks appeared in the North view on April 20, 2020. I probably did that by copying the roof of the South view to the North View after changing the South view roof's rafter design, thereby importing the duplicate shingle block problem.

I tried to duplicate the creation of the duplicate shingles as in 2016, without success. Today I used crtl key copy paste between the files to recreate the duplicate block list. That did not work. Just same problem of just bringing over one of the blocks to the block list.

Unfortunately, what I did is still a mystery. It may be a consequence of not using an accepted methodology for copying between files. It is not a consequence of how I drew the shingles.

Thank you again for helping with this.