.NET

Reply
Valued Contributor
Matt S
Posts: 64
Registered: ‎05-05-2004
Message 1 of 6 (139 Views)

Can somebody explain attributes to me???

139 Views, 5 Replies
01-11-2006 08:49 PM
I have been trying to wrap my head around this, but I can't seem to figure it out.

What's the difference between AttributeDefinitions and AttributeReference's? The documentation seems to indicate that the definitions are what references are created from, is this correct?

I am trying to create a block from simple entities like lines and circles, and I owuld like to add some attributes. I create the entities, add them to a Blocktablerecord, but where do the attribute definitions go? If I try to add them to the btr, Autocad crashes. Am I supposed to add attribute definitions to the same btr as the other entities, or do they need there own blocktable record.?

I am just confused at this point, and any help is appreciated.

Oh, I am using c#
Distinguished Contributor
NathTay
Posts: 1,691
Registered: ‎12-15-2003
Message 2 of 6 (139 Views)

Re: Can somebody explain attributes to me???

01-11-2006 09:13 PM in reply to: Matt S
The AttributeDefinition is the attribute within the definition of the block. The AttributeReference is the attribute within the inserted instance of the block.

Regards - Nathan
*Fred Chateau
Message 3 of 6 (139 Views)

Re: Can somebody explain attributes to me???

01-20-2006 03:32 PM in reply to: Matt S
wrote ...

> The AttributeDefinition is the attribute within the definition of the
> block. The AttributeReference is the attribute within the inserted
> instance of the block.

Would it be correct to say that a block definition together with any
attributes describes a real object in memory or in a database while a block
instance is simply a reference to the block definition with added spatial
coordinates. If so, do attribute references point to a specific base
attribute of the same type, like an overridden method which normally
inherits from its base?

In other words, are the attributes in a block instance composed of the same
number and types as the attributes in the block definition, and needed only
when they differ in value from the base attributes?

--
Regards,

Fred Chateau
fchateauAtComcastDotNet
Distinguished Contributor
RonnieWilkins
Posts: 453
Registered: ‎04-07-2003
Message 4 of 6 (139 Views)

Re: Can somebody explain attributes to me???

01-22-2006 12:41 AM in reply to: Matt S
1. A block is a "Named Object", meaning that it is not visible to an AutoCAD User. They only ever see a reference to the definition. If you explode a block, you see what makes up a block, but you are not looking at the definition!

2. For a given block with a particular name there will always be only one definition. There could be many references to said definition.

3. All references to a given block definition will always be identical graphically except for attributes. Attributes are the only item within a block that can be different for each inserted block reference.

4. An attribute must be defined within the block definition. When a block reference is added to a drawing, an attribute reference is added for any attribute definitions within the block if any were defined.

5. An attribute consists of 3 main items:
a. Tag: think of this as a field/column name within a database.
b. Prompt: displayed to the user when asking them to fill in the value so they know what the attribute is used for.
c. Value: the editable part of the attribute, modified once a reference to the attributes owning block has been inserted into a drawing.

So...

When you define a block, add a BlockTableRecord to the BlockTable, you can define attributes for user's to fill out by adding one or more AttributeDefinitions to the BlockTableRecord.

When you or a user inserts the block into the drawing, you create a BlockReference in the drawing which displays what was defined within the block definition. If you added any AttributeDefinitions to the block definition, the user will be prompted to fill in the AttributeReferences for the BlockReference.

Make any sense?

Attached is an example of an exploded block showing the attribute definitions, as well as the inserted block reference and attribute references.
Ronnie Wilkins, Jr.
AMS CAD + CAFM Solutions
Sr. Solutions Developer
Autodesk Certified Instructor: Inventor
*Fred Chateau
Message 5 of 6 (139 Views)

Re: Can somebody explain attributes to me???

01-23-2006 07:22 AM in reply to: Matt S
wrote ...

Make any sense?

Thank you for your detailed and most informative answer.

I think maybe where I was confused was in what an attribute specifies. Do I
understand correctly that for example, the color inside a circle (or
anything visible as part of the entity) would not be considered an
attribute? If so, is any part of the visible entity defined in the block, or
does the block simply point to an entity definition or definitions within
it?

--
Regards,

Fred Chateau
fchateauAtComcastDotNet
Distinguished Contributor
RonnieWilkins
Posts: 453
Registered: ‎04-07-2003
Message 6 of 6 (139 Views)

Re: Can somebody explain attributes to me???

01-23-2006 09:26 AM in reply to: Matt S
An attribute in AutoCAD is an entity, in and of itself, that allows a different text value to be shown for each inserted block reference.

Think of an attribute as enhanced text, that only exists to be used with blocks.

You define the attribute in the block definition.

The block definition contains all objects shown in the block reference.


"Do I
understand correctly that for example, the color inside a circle (or
anything visible as part of the entity) would not be considered an
attribute?"

Correct, these would be properties...

"If so, is any part of the visible entity defined in the block, or
does the block simply point to an entity definition or definitions within
it?"

Yes & Yes

A block definition stores the definitions of objects it should show and the coordinates of these objects in relation to an insertion point.

A block reference uses the definition as a basis for showing the defined list of objects.

You use a block to store the information once in a drawing, then reuse the block by inserting block references into the drawing multiple times, though it is allowed to install a block reference only once.

From the end user perspective, they will only ever see one or more block references, they will not see the block definition.

When a user inserts a block reference into a drawing, they only add a point and a description that says what block should be shown (referenced) at said location.
Ronnie Wilkins, Jr.
AMS CAD + CAFM Solutions
Sr. Solutions Developer
Autodesk Certified Instructor: Inventor
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.