SOLVED - HOW to Create a block WITH attribute

Use this forum to ask questions about how to do things in QCAD.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
Giuliano69
Active Member
Posts: 36
Joined: Mon Nov 23, 2020 4:37 pm

SOLVED - HOW to Create a block WITH attribute

Post by Giuliano69 » Wed May 10, 2023 8:20 pm

I've imported from a Acad drawing a Block with text attribute (see attached example)

I can use it in Qcad, BUT in the manual I do NOT find how to create a new one from scratch.

IS it possible to create it from scratch in QCAD?
HOW do I proceed ?

Giuliano

PS using 3.27.9.0 (3.27.9) under Ubuntu 22.04
Attachments
block with attribute.dxf
(100.35 KiB) Downloaded 192 times
Last edited by Giuliano69 on Wed May 17, 2023 9:53 pm, edited 1 time in total.

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

Re: HOW to Create a block WITH attribute

Post by Husky » Wed May 10, 2023 8:45 pm

Giuliano69 wrote:
Wed May 10, 2023 8:20 pm
IS it possible to create it from scratch in QCAD?
Yes. :wink:
Giuliano69 wrote:
Wed May 10, 2023 8:20 pm
HOW do I proceed ?
https://www.qcad.org/doc/qcad/latest/re ... on_en.html
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..."

Giuliano69
Active Member
Posts: 36
Joined: Mon Nov 23, 2020 4:37 pm

Re: HOW to Create a block WITH attribute

Post by Giuliano69 » Wed May 10, 2023 9:40 pm

Dear Husky,
thanks for you quick help.

I sTILL find a misbehavior ..

1- I can create the attribute (see attached example), creating the label and the predefined "value", BUT as you can see the text shown is still the "label" not the "value". And whatever text I insert in the field, it still keeps showing the "label" and not the "value".
2- One more "slight" difference is that the first imported example block (from Acad) does NOT have the "prompt" field; the Qcad created one does shows the field...

Any Idea about the strange behavior and the showed difference ?

BR

Giuliano
Attachments
block with attribute 2.dxf
(99.34 KiB) Downloaded 176 times

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

Re: HOW to Create a block WITH attribute

Post by Husky » Wed May 10, 2023 11:10 pm

1. I can't find any Attribute in the block definition ... :(
(Please recall the Attribute description, "Use this tool to add an attribute definition to a block definition.")

2. The found Attribute in Model_Space is without a "Prompt" info. Please make sure all question in the Attribute dialog are answered even if other CAD programs handle it differently.

3. Check out this modified drawing - would that suit what you are looking for?
block with attribute 2_mod.dxf
(99.51 KiB) Downloaded 188 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..."

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

Re: HOW to Create a block WITH attribute

Post by CVH » Thu May 11, 2023 5:25 am

Giuliano,

There is a difference between Attributes, Block Attributes and Attribute Definitions.
Attributes in Model Space are not associated with a Block Reference like Block Attributes.
I know of no way to create dissociated Attributes in QCAD but by scripting and a fixed bug while duplicating (DP) them.
An Attribute Definition is part of a Block definition, a Block Attribute template if you like.
When a Block Reference is inserted, a Block Attribute is created based on the Attribute Definition.

There is no visual difference between Attributes and Block Attributes.
The difference is that Block Attributes store the associated Block Reference id and are selected together with that Block Reference.
QCAD does not list the associated Block Reference as a property in the Property Editor.
On selecting a Block Attribute it depends on your Application Preferences if the associated Block Reference is selected together or not.
If not one can also select only the Block Reference with a second click on it.

On Block Insert QCAD list up the prompts (not the tags) in the Attributes drop-down box and the default values beside that.
That will be an empty field when there is no prompt defined.
One can easily edit the prompt in block edit mode with a double click on the Attribute Definition.
The prompt has no further meaning once a Block Attribute is created.

Maybe it is an idea to revert to the tag when the prompt is empty.
One could consider to enter a feature request here: https://www.ribbonsoft.com/bugtracker/

Regards,
CVH

Giuliano69
Active Member
Posts: 36
Joined: Mon Nov 23, 2020 4:37 pm

Re: HOW to Create a block WITH attribute

Post by Giuliano69 » Thu May 11, 2023 11:06 am

Hi guys,
thanks for your replies !

Unfortunately :-(( I cannot get the same result as Husky ?

Where I'm doing wrong ?
Here is the screen cast... the produced block with attribute does not behave like Husky's one...

https://drive.google.com/file/d/14g64Bp ... share_link


Giuliano

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

Re: HOW to Create a block WITH attribute

Post by CVH » Thu May 11, 2023 4:28 pm

Giuliano,

Please unhide the Block List ...
View .. Block List (GB) or just type the shortcut key sequence 'GB'.

After you have created a block from the selection that block will be listed in the Block List.
Now first edit the newly added block before you add an Attribute Definition.
Select it in the Block List (single left click) and edit it (BE) or double click it.
After that you need to return to the main drawing (EM) or double click on the Model_Space block.

Then the block with attributes should pop up when you insert the block (BI) in Model_Space.

Regards,
CVH

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

Re: HOW to Create a block WITH attribute

Post by Husky » Fri May 12, 2023 12:17 am

Creating a block with Attributes:

Creating Block with Attribute.gif
Creating Block with Attribute.gif (2.1 MiB) Viewed 4866 times


Using a block with Attributes in a drawing:

use of Block with Attribute.gif
use of Block with Attribute.gif (1.23 MiB) Viewed 4866 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..."

Giuliano69
Active Member
Posts: 36
Joined: Mon Nov 23, 2020 4:37 pm

Re: HOW to Create a block WITH attribute

Post by Giuliano69 » Wed May 17, 2023 9:53 pm

Hi Huscky
thanks for your help.
You solved my problem.
Maybe your solution could be added to the manual to better understand the attribute block.

One more question.
AFTER the creation of the block, and dragging the item from the window, the attribute get created.
BUT just after the definition, the attribute is NOT visible (even in your gif)

Why such behavior ?

Giuliano

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

Re: HOW to Create a block WITH attribute

Post by Husky » Wed May 17, 2023 10:29 pm

@Giuliano
Giuliano69 wrote:
Wed May 17, 2023 9:53 pm
Hi Huscky
thanks for your help.
I’m happy to be of assistance.
Giuliano69 wrote:
Wed May 17, 2023 9:53 pm
BUT just after the definition, the attribute is NOT visible (even in your gif)
Why such behavior ?
Good question! Honestly - I don't know. :oops: Maybe Andrew can enlighten both of us ...? :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..."

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

Re: SOLVED - HOW to Create a block WITH attribute

Post by CVH » Thu May 18, 2023 12:29 am

Giuliano69 wrote:
Wed May 17, 2023 9:53 pm
BUT just after the definition, the attribute is NOT visible (even in your gif)
Because it is common to add Attribute Definitions as entities while editing the related Block.
So that Block Attributes are created on inserting the block.

With 'Create Block from Selection (BC)':
All selected entities are moved to a block of choice but only a Block Reference of that block is generated in Model Space to replace them.
https://github.com/qcad/qcad/blob/maste ... ck.js#L172
If the moved entities where Attribute Definitions they are not replaced by Block Attributes in Model Space.

The work around is then: BC .. Delete the remaining selection .. Select the new block in the Block List .. Insert Block (BI)
The relative zero would still be the original insertion point.

Regards,
CVH

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

Re: SOLVED - HOW to Create a block WITH attribute

Post by CVH » Thu May 18, 2023 7:49 am

CVH wrote:
Thu May 11, 2023 5:25 am
I know of no way to create dissociated Attributes in QCAD but by scripting and a fixed bug while duplicating (DP) them.
EDIT: Hide the block in the Block List before inserting it.
One gets a transaction failure for the Block Reference but the Attributes are created as orphans.

Regards,
CVH

jjs3834
Newbie Member
Posts: 4
Joined: Tue Nov 01, 2022 5:45 pm

Re: SOLVED - HOW to Create a block WITH attribute

Post by jjs3834 » Thu Jul 27, 2023 5:19 pm

I have a question about blocks with attributes...hoping someone might know whats happening?
I am using a few blocks which were created before I started using QCad.
Now I have two separate blocks listed in my block list, one is an insertable block with editable attribute
and the other is just the parts in the first block. but I need both of them in the drawing to work.

what am I missing here?

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

Re: SOLVED - HOW to Create a block WITH attribute

Post by Husky » Thu Jul 27, 2023 6:39 pm

Sounds like block 1 is created partly and for no reasons with block 2.

Would it improve your workflow when you edit block 1, explode the block 2 reference and then delete block 2?
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..."

Post Reply

Return to “QCAD 'How Do I' Questions”