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

Block attribute has properties and functions derived from base class and the following specific properties:

Property Type Access Meaning
LC_PROP_ENT_...    Base class properties
RW Handle to Text style
Name of Text style
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

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
Used to sequentially retrieve all block attributes
lcBlkRefGetAtt Retrieves block attribute by a tag

See also

   Code sample 1,   Code sample 2,   Code sample 3