Blocks, which layer to use?

Use this forum for all posts and questions about the free QCAD Community Edition version 3

Moderator: andrew

User avatar
massimo
Full Member
Posts: 68
Joined: Tue Dec 02, 2014 2:30 pm

Blocks, which layer to use?

Post by massimo » Wed Jan 26, 2022 7:47 am

Hi,

what is a good design for blocks and their layers? What layer should a block belong to?
If I have drawings in some "steel" layer and make a block of only those "steel" elements, it's sometimes confusing if this block is not of the layer "steel" itself. So I try to set the same layer for blocks like the contained elements.
More confusing when a block contains many different layers. Should I have a generel "blocks" layer for those, or just use the generic "0" layer which is always there? Actually "0" layer should not belong to any element because it's like "no layer set" which is almost an error.
Community Version 3.28.2.0, Gentoo Linux on amd64

CVH
Premier Member
Posts: 3415
Joined: Wed Sep 27, 2017 4:17 pm

Re: Blocks, which layer to use?

Post by CVH » Wed Jan 26, 2022 8:06 am

massimo,

I assume it is of no issue unless you use properties byBlock ...
True, it still eludes me why we don't have a clue where a block resides.

Layer 0 is not an error ... It is the default layer. :wink:

The differences are compatibility.
Refer to: Application Preferences .. Layer .. Compatibility.

Regards,
CVH

User avatar
massimo
Full Member
Posts: 68
Joined: Tue Dec 02, 2014 2:30 pm

Re: Blocks, which layer to use?

Post by massimo » Wed Jan 26, 2022 9:48 am

Sorry, I don't understand your response. What do you mean with byBlock?
Does that mean, you agree with my thoughts that it is confusing to have a block of a layer and inside the block you have different layers?
To be honest, I don't see a requirement at all to have layer on blocks. Why should a block itself belong to a layer, while all the elements inside already have their layers? Hiding a complete block I can still do by hiding the block, so I don't need to hide the layer of that block.
To overcome this issue I try to keep the layer of blocks equal to its ingredients, but sometimes it's not possible and I could apply the 0 layer or some special block layer.
How do you deal with block layers?
Community Version 3.28.2.0, Gentoo Linux on amd64

CVH
Premier Member
Posts: 3415
Joined: Wed Sep 27, 2017 4:17 pm

Re: Blocks, which layer to use?

Post by CVH » Wed Jan 26, 2022 11:03 am

massimo,
First: A Block definition and a Block Reference are two distinct things. :wink:

massimo wrote:
Wed Jan 26, 2022 9:48 am
What do you mean with byBlock?
An entity can have General Properties "byLayer", "byBlock" or a specific one.
See Property Editor.

A Block is made up of entities each residing on a certain layer.
Common is that the properties of an entity are governed by what layer it is drawn on.
All in red on one, all dashed on another, red & dashed ...
Their properties are then "byLayer".
https://www.ribbonsoft.com/en/tutorial- ... ith-layers

A block reference is inserted in the Model on a certain layer, itself also a single entity with general properties.

How this is displayed is then governed by OR:
- The block reference properties.
- The layer properties on which the reference is placed.
- The block properties (the layer property is grayed out).
- The entities properties that make up the block.
- The layers properties on which these entities are drawn.

All depends on the given properties and what supersedes what.
That may differ for Layer 0 and the compatibility preference.
https://www.ribbonsoft.com/en/tutorial- ... attributes

Hiding a block would hide all references to that block definition.
Disregarding on what layer a reference is placed or the layers of the entities in it.

Hiding a layer would hide all its entities, including block references.
And thus also those entities on that layer that are used in certain block definitions.

Confusing at first, I agree, when nested the logic seems not straightforward. :wink:

Regards,
CVH

User avatar
ryancousins
Premier Member
Posts: 367
Joined: Thu Mar 19, 2020 3:47 am
Location: Michigan, USA

Re: Blocks, which layer to use?

Post by ryancousins » Wed Jan 26, 2022 7:15 pm

I believe this is an extension of this topic, but I apologize upfront if this deserves its own thread.

Do most people find that their block definitions consist of only one linetype, color, etc.? I find myself creating blocks that consist of multiple colors/line types. With this being the case, using layer 0 as the home for all of my definitions doesn't work for me. But perhaps I'm doing things the wrong way. Is it general practice in CAD that block definitions only have one color and linetype?

User avatar
andrew
Site Admin
Posts: 9036
Joined: Fri Mar 30, 2007 6:07 am

Re: Blocks, which layer to use?

Post by andrew » Wed Jan 26, 2022 9:05 pm

ryancousins wrote:
Wed Jan 26, 2022 7:15 pm
Do most people find that their block definitions consist of only one linetype, color, etc.? I find myself creating blocks that consist of multiple colors/line types.
That's definitely part of the idea behind blocks that you can in fact use different layers (with different colors, linetypes, lineweight) in them.

Blocks typically group entities which are all part of the same object in the real world (e.g. a bolt, a plant, a machine part, etc.).

Layers group entities with the same meaning in the real world (exterior walls, water pipes, center lines, invisible edges, etc.).

User avatar
Husky
Moderator/Drawing Help/Testing
Posts: 4935
Joined: Wed May 11, 2011 9:25 am
Location: USA

Re: Blocks, which layer to use?

Post by Husky » Thu Jan 27, 2022 12:10 am

@massimo, @ryancousins,
massimo wrote:
Wed Jan 26, 2022 7:47 am
More confusing when a block contains many different layers. Should I have a generel "blocks" layer for those, or just use the generic "0" layer which is always there?
General Block layer - No.
General using layer 0 - No.
ryancousins wrote:
Wed Jan 26, 2022 7:15 pm
Do most people find that their block definitions consist of only one linetype, color, etc.?
No. Not a professional ...

A drawing is a tool of communication. It has to speak a language which is understood on both sides. The designer and the reader. For those reason there are rules like for what is which Linetyp and which Lineweight used. Example: As a "Center line" is used the Linetyp Dash/Dot and for a "Hidden Line" is used a Dashed Line. If you use a Continuous Line for a center line the information is lost for the reader. This said - these are very important information and for a stress less communication absolute crucial. If you design a drawing or a block and step away from those rules a drawing becomes worthless. With other words - yes you should use different layer for blocks or find a different way to communicate those information like individual Linetypes.

However - there are different ways to skin a cat. Here is my style to work with blocks. Maybe it works for you too .... maybe not. :shock:

Blocks: I hate to deal with stacked blocks and most of the time I don't see a benefit to stack them. For those reason mostly every block in my drawings is autarch what means it is a single block. Of course it could be that I need multiple blocks to build such a block but finally I explode everything in that block to get rid of the stacked block hierarchy.

Layer in Blocks: It is necessary to think about for what that block is used. Most of the time it is possible that depending on which Attributes on what entities are used they need to be changed in the main drawing. Example: A "Flange" placed in front of an object needs to have continuous lines for the contour but placed behind an object those lines have to be dashed. That is how a designer can tell a reader that the flange belongs behind the object ...
Sure, you can place the block in Model_Space, explode it and then change those attributes to what it need to be. Lazy me - I try to avoid that with a "smart" block layer assignment what is easily to do with QCAD.

Block Layer.gif
Block Layer.gif (1.22 MiB) Viewed 12427 times
Is this a "one fits all" solution? No! If I have in this example to place the Flange only half behind an object I have to step in and explode that block to change those line information accordingly. Sucks .... but you can't have it all! On the other hand - not a big deal in QCAD! 8)

Husky-2022.01.26-04.png
Half covered
Husky-2022.01.26-04.png (30.2 KiB) Viewed 12427 times

Here my challenge to @massimo, @ryancousins ... and everybody else who likes to play with it.
Try to create a block of the Flange with the functionality shown in my animated gif. All information what you need to know are in this Topic and I only used layer ... :wink:

flange_mod.dxf
(107.09 KiB) Downloaded 438 times
Share your experience! :wink:
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."

User avatar
ryancousins
Premier Member
Posts: 367
Joined: Thu Mar 19, 2020 3:47 am
Location: Michigan, USA

Re: Blocks, which layer to use?

Post by ryancousins » Thu Jan 27, 2022 3:04 am

Andrew & Husky,

Thank you for your input. I agree with everything you say and I have always used many of the same methods as you mention. The thing that had me wondering was that I have read in a few places people suggesting that you should only create your blocks in Layer 0, and that this was what that layer was originally designed for in ACAD. That would work fine for a block that contains only one color/linetype, but in cases where you want a block definition to contain different types/colors of lines, having the definition live in layer 0 would mean that when you place a reference to the block in layer X, all of the geometry of the block would take on the properties of the X layer. The only way to avoid that would be to set specific parts of the block to fixed attribute values, but I always try to avoid this practice and let the layers dictate those values. Since many blocks would presumably be comprised of more than one type of line, the practice of only creating them in layer 0 doesn't really make sense to me.

CVH
Premier Member
Posts: 3415
Joined: Wed Sep 27, 2017 4:17 pm

Re: Blocks, which layer to use?

Post by CVH » Thu Jan 27, 2022 7:13 am

This eludes me: :oops:
ryancousins wrote:
Thu Jan 27, 2022 3:04 am
having the definition live in layer 0
The layer property for a Block is grayed, it are the entities, among them block references, that live on a layer.
What is then the 'byLayer' property of the Block definition :?: :!:

Then again I have the preference 'Display properties of current block and current layer' set active.
So with no selection it shows 'All(3)' and the Color, Lineweight and Linetype properties are quite confusing.
'All(3)' meaning a layer, not necessarily the active one, the active block, an unlisted layout called 'Model'.

It seems the General Properties retain a last known defined value.

Regards,
CVH

User avatar
ryancousins
Premier Member
Posts: 367
Joined: Thu Mar 19, 2020 3:47 am
Location: Michigan, USA

Re: Blocks, which layer to use?

Post by ryancousins » Thu Jan 27, 2022 1:23 pm

You're correct CVH, I mean the entities that make up the block definition placed in layer 0. I have seen people suggest the entities of a block should always be placed in layer 0, but this would mean all of the entities that make that block definition would take on the attributes of whatever layer the block referenced is placed in unless you used fixed attributes to override the style of some of the entities to make them different than the layer the reference was placed in. I guess I just don't like the idea of using fixed attributes like that.

CVH
Premier Member
Posts: 3415
Joined: Wed Sep 27, 2017 4:17 pm

Re: Blocks, which layer to use?

Post by CVH » Thu Jan 27, 2022 2:34 pm

ryancousins wrote:
Thu Jan 27, 2022 1:23 pm
I have seen people suggest the entities of a block should always be placed in layer 0,
Read those post too. :wink:
I can't agree fully as it would downgrade the functionality of blocks even further.

You may have read that I also group things in layers ... :roll:
Grouping main layers and then the usual layer construction as sub layers each.

For this grouping Blocks don't work for me, a block reference is one single thing of which I can't edit entities in place.
I have to avoid 'Edit Block In-place' as I also script under QCAD. :(
QCAD will crash in debugger mode on such files or any other that was open at the same time.
I only use BB to assist and in a temporary installation, wiping anything associated afterwards.

Sure, I still use blocks where they suit me. Nested ones too.
Fixed attributes are fine if there is a logic behind the use.
For engraving projects I usually draw my stock on a blue layer, the clamps too but in magenta.
Red is usually an error ... On any layer. Green is than the correction or the better solution.
In the end, all the green or red ones get their own sub layer, resetting the fixed attribs .

BTW ... Model_Space is also merely a Block, a special/default one. :P

Regards,
CVH

User avatar
massimo
Full Member
Posts: 68
Joined: Tue Dec 02, 2014 2:30 pm

Re: Blocks, which layer to use?

Post by massimo » Thu Jan 27, 2022 4:15 pm

Thank you all for the discussion. You all are of a more advanced level in QCad and general CAD than I am, so a bit difficult to follow.
Now I know what you mean with byLayer and byBlock.

Actually I only use byLayer for entities. Entities are lines, circles etc.? For those basic entities I always have set a layer and line/color byLayer. If the layer doesn't fit, I create a new layer. I never set explicit styles. Some similar policy like using "Styles" in LibreOffice Writer.

What is the reason to set byBlock for a line? Does it inherit the block layer which it is included later? What does "Color byBlock" mean, if a Block definition doesn't have a color, only layers have colors?

In your GIF I see that you insert a block reference upon different layers. So you have that block inserted on Layer "1.Object" and another instance on Layer "2.hidden". Does that mean, inside the block you are using byBlock which answers my previous question as well?

I never thought about that, and so far I don't have a use for that. That byBlock would mean, I can reference the same block in different styles, like having a Base class that I inherit but with different settings in the instance. If that's true, what happens then with nested blocks?

That all would explain that for my current work it never made a difference, which layer a block reference belongs to, it was just confusing, when hiding a layer, and some block was disappearing because it was using that layer by mistake.
Community Version 3.28.2.0, Gentoo Linux on amd64

User avatar
ryancousins
Premier Member
Posts: 367
Joined: Thu Mar 19, 2020 3:47 am
Location: Michigan, USA

Re: Blocks, which layer to use?

Post by ryancousins » Thu Jan 27, 2022 8:33 pm

massimo wrote:
Thu Jan 27, 2022 4:15 pm

I always have set a layer and line/color byLayer. If the layer doesn't fit, I create a new layer. I never set explicit styles.
That is the generally accepted best practice. You typically would not want to set explicit attributes like color if you can avoid it, but there are certainly special uses where this is helpful or necessary.
What is the reason to set byBlock for a line? Does it inherit the block layer which it is included later?
That is correct. This would allow the entities that make up the block to inherit the style of the layer where the block reference is placed.
What does "Color byBlock" mean, if a Block definition doesn't have a color, only layers have colors?
I'm not quite sure with this one, either.

User avatar
Husky
Moderator/Drawing Help/Testing
Posts: 4935
Joined: Wed May 11, 2011 9:25 am
Location: USA

Re: Blocks, which layer to use?

Post by Husky » Tue Feb 15, 2022 8:58 am

ryancousins wrote:
Thu Jan 27, 2022 8:33 pm
What does "Color byBlock" mean, if a Block definition doesn't have a color, only layers have colors?
I'm not quite sure with this one, either.
Welcome in the club .... :lol: :lol: :lol:

This "By Block" assignment is very frustrating to me too. My research brings me to the conclusion that the "by Block" assignment in QCAD fails or there is a different approach behind that what is unfortunately nowhere explained ...

What I found describing the "by Block" assignment in big CAD packets is in short:
"By Block" is meant to define attributes "on the fly" during inserting a block. With other words - no color, line weight or line typ is assigned to those chosen entities in a block. During inserting you have to chose those attributes which will then be adapted by "by Block" entities. I assume that part of this misconception is that we know how a layer assignment works with a clear definition of all attributes ... well, "By Block" has no immediate attribute assignment in the first place!

This said - there are a bunch of examples out there which will explain how it work. Nice - the only problem is it isn't working that way in QCAD. Honestly - I don't know why! As I already mentioned - It could be a bug or a different approach.

My last example which fails in QCAD too is very simple. Block of two circle, drawn on Layer 0, left circle assigned "By Layer", right circle assigned "By Block". Inserting into Model_Space affects both circle equally. Active Layer has no effect (left circle should be yellow / dash dot). That is not how it is described on many pages in the www for a "By Block" assignment ...

Husky-2022.02.14-02.png
Husky-2022.02.14-02.png (12.56 KiB) Viewed 11131 times
Husky-2022.02.14-03.png
Husky-2022.02.14-03.png (48.76 KiB) Viewed 11131 times


If I change Application Preferences to "Layer 0 behaves like regular Layer (QCAD)" then I get a clear result - works as expected ...

Husky-2022.02.14-06.png
Husky-2022.02.14-06.png (53.87 KiB) Viewed 11131 times

... but I lost the functionality of using layer 0.

Probably I missed something important? In that case - please enlighten me!

byBlock test.dxf
(105.19 KiB) Downloaded 413 times
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."

User avatar
andrew
Site Admin
Posts: 9036
Joined: Fri Mar 30, 2007 6:07 am

Re: Blocks, which layer to use?

Post by andrew » Tue Feb 15, 2022 9:07 am

Husky wrote:
Tue Feb 15, 2022 8:58 am
Probably I missed something important? In that case - please enlighten me!
Put the block contents on a different layer, not layer "0" and you're good to go. The application preference then does not matter at all. I think using layer "0" for block contents is a historical approach to get a similar effect as with the "By Block" attribute. You have to choose between using layer 0 or using the By Block approach for your block contents.

Post Reply

Return to “QCAD Community Edition”