[Solved partially] Odd situation when Duplicate (DP) Block with Attributes

If you are having problems with QCAD, post here. Please report bugs through our Bug Tracker instead.

Always attach your original DXF or DWG file and mentions your QCAD version and the platform you are on.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
CVH
Premier Member
Posts: 3478
Joined: Wed Sep 27, 2017 4:17 pm

[Solved partially] Odd situation when Duplicate (DP) Block with Attributes

Post by CVH » Mon Mar 13, 2023 6:06 pm

I have a problem when I Duplicate (DP) a Block Reference with some Block Attributes.
Block Insert (BI) is the preferred method to add new instances of a Block.
Meaning you need to fill in the Attribute values from scratch or use the default, but there are other ways that clone an existent set.

Now before anyone starts asking why not using BI:
All Blocks and Attributes are queried by a script for this: https://www.qcad.org/rsforum/viewtopic.php?f=30&t=9878
I am merely investigating if there is a difference in how these entities are created.
For those who want to know: The queried id's are at random, Block Reference don't point to child's but Block Attributes point to parents.
Figuring out what belongs to which Block Reference seems to be harder than expected.
Anyway, that is for the Script Programming and Contributing forum ... :wink:

What works well:
All these 3 methods: Copy / Paste .. Copy with reference / Paste .. Move / Copy with n copies
clone the original Block Reference with Block Attributes as a whole new set.

Where the issue is:
Duplicate (DP) doesn't keep the set together, the newly created Block Attributes refer to the original Block Reference and not to the clone. :shock:

Rather similar as if we use the other 3 mentioned methods on a Block Attribute only, without selecting the Block Reference itself.
Then it is probably intended behavior ... There is no newly created Block Reference to associate with, to set as parent.
Selecting only a Block Attribute is possible if that is preferred by App.Prefs.
Selecting a Block Reference with Attributes always selects it with the associated Block Attributes together.
Only, cloning just a Block Attribute is also erogenous ... Which of the two Attributes will be displayed in the Property Editor? :?

Block&AttributesDuplicated.dxf
(108 KiB) Downloaded 156 times

In the example file I cloned the first column with the mentioned methods.
When selecting Block Reference A then all 5 Block Attributes will be selected, the 2 original and the 3 duplicated.
- The listed Block Attributes in the Property Editor is a mix of things: The ID is that of clone B, the Type is that of clone C. :shock:
Selecting Block Reference B will not select any Block Attributes, although it is based on Block 'NosyItem' what has 2 Block Attributes. :shock:
What happens if you select a Block Attributes depends on your Application Preferences.

Synchronize Attributes (UY) can worsen things.
- With nothing selected, clone B receives 2 new empty Block Attributes, empty is correct because there is no default value defined.
- Encountered that cloned Block Attributes are relocated, some do but not all.
Everything depends on if the file was saved and reloaded or what is selected or if other entities were added ...
... Not really sure, it seems not that easy to replicate this behavior.
- Associations may differ afterwards.

So, maybe:
- DP clones things incorrectly ... A bug.
- It should be prohibited to clone a Block Attribute on its own in any way.
- Block References should point to their Block Attributes.
instead of that (too) many Block Attributes point to their parent Block Reference ... :?

Regards,
CVH
Last edited by CVH on Wed Mar 15, 2023 10:43 am, edited 1 time in total.

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

Solved: Odd situation when Duplicate (DP) Block with Attributes

Post by CVH » Wed Mar 15, 2023 10:42 am

Kinda solved in silent for the upcoming release or snapshot.

Duplicate (DP) is refactored as Copy / Paste.
That was one of the methods that worked out correctly for cloning Blocks with Attributes.
Refer to:
https://github.com/qcad/qcad/commit/57a ... c588ba5f6f

One can still clone a Block Attribute on its own ... But why should we and what would be the reason for that?
It will point to its original parent Block Reference and mess up things in associations. :roll:

Thanks Andrew.
Going to close this as considered solved.

Regards,
CVH

Post Reply

Return to “QCAD Troubleshooting and Problems”