Block Attributes Home

An attribute is a label or tag that attaches data to a block. Examples of data that might be contained in an attribute are part numbers, prices, comments, and owners' names. The tag is equivalent to a column name in a database table.

Attribute information extracted from a drawing can be used in a spreadsheet or database to produce a parts list or a bill of materials. You can associate more than one attribute with a block, provided that each attribute has a different tag.

Whenever you insert a block that has a variable attribute, LiteCAD assign default value for the attributes. Later user can change the attribute value with the "Edit Block Attribute" dialog or "Properties" window.

Attributes also can be "invisible". An invisible attribute is not displayed or plotted; however, the attribute information is stored in the drawing file and can be written to an extraction file for use in a database program.

To create an attribute, you first create an attribute definition, which describes the characteristics of the attribute. The characteristics include the tag (which is a name that identifies the attribute), the prompt displayed when you insert the block, value information, text formatting, location, and any optional modes (Invisible, Constant, and Preset).

After creating the attribute definition, you select it as one of the objects when you define the block. Then, after you insert the block, you can edit the attibutes values with the "Edit Block Attribute" dialog or "Properties" window.

To use several attributes together, define them and then include them in the same block. For example, you can define attributes tagged "Parts," "Materials," and "Thickness," and then include them in a block called PARTS_DATA.

To create an attribute definition programmatically use the following function:

Function Meaning
lcBlockAddAttDef Adds an attribute definition into a block

After you insert a block which contains an attributes to a drawing, each Block Insertion entity will have an attribute data and you can put specific attribute values to each block insertion.
There are the functions to access an attributes inside a block insertion entity:

Function Meaning
lcBlkRefGetFirstAtt
lcBlkRefGetNextAtt
Used to sequentially retrieve all block attributes
lcBlkRefGetAtt Retrieves block attribute by a tag
lcBlkRefGetAttVal Returns attribute value
lcBlkRefPutAttVal Sets attribute value

When you get an attribute handle - you can access the attribute properties:

Property Type Access Meaning
LC_PROP_ATT_MODE int RW Mode
LC_PROP_ATT_TSTYLE handle
string
RW Handle to Text style
Name of Text style
LC_PROP_ATT_TAG string RW Tag
LC_PROP_ATT_PROMPT string RW Prompt
LC_PROP_ATT_VALUE string RW Value
LC_PROP_ATT_ALIGN int RW Alignment type
LC_PROP_ATT_X float RW Insertion point X
LC_PROP_ATT_Y float RW Insertion point Y
LC_PROP_ATT_H float RW Text height
LC_PROP_ATT_WSCALE float RW Width factor (horisontal scale)
LC_PROP_ATT_ANGLE float RW Rotation angle
LC_PROP_ATT_OBLIQUE float RW Oblique angle
LC_PROP_ATT_X0 float R X coordinate of left-bottom corner
LC_PROP_ATT_Y0 float R Y coordinate of left-bottom corner
LC_PROP_ATT_XFIT float RW X coordinate of end point for alignment LC_TA_ALIGNED or LC_TA_FIT
LC_PROP_ATT_YFIT float RW Y coordinate of end point for alignment LC_TA_ALIGNED or LC_TA_FIT
LC_PROP_ATT_UPDOWN bool RW "Upside-down text" flag
LC_PROP_ATT_BACKWARD bool RW "Backward text" flag
LC_PROP_ATT_INVIS bool RW Mode: invisible attribute
LC_PROP_ATT_LOCKPOS bool RW Mode: locked position
LC_PROP_ATT_MTEXT bool RW Mode: multiline text

More functions used with block attributes:

Function Meaning
lcBlockGetBlkRefByTag Retrieves block references by attribute tag and value
lcDrwUpdateBlkRefs Updates all references of specified block

See also

Create a block with attributes
Add more attributes into a block
Modify attributes in block references (1)
Modify attributes in block references (2)
Retrieve block attribute value by Tag
Retrieve all attributes of all block's references
Rotate all block's references which match specified attribute
Sequentially switch LEDs