Block object |
A block definition containing a name and a set of objects.
VBA class name: |
AcadBlock |
---|---|
Create using: |
Blocks.Add |
Access via: |
Blocks.Item |
There are four types of blocks: the simple block, the XRef block, the layout block, and the dynamic block.
A simple block is a collection of objects that you can associate together to form a single object, or block definition. You can insert, scale, and rotate a simple block in a drawing. You can explode a simple block into its component objects, modify them, and redefine the block definition. Simple blocks can be defined from geometry in the current drawing, or by using another AutoCAD drawing. When you use another drawing to create a block, the new simple block is stored in the current drawing database; it is not updated if the original drawing changes. Inserting an instance of a simple block into the current drawing creates a BlockReference object.
An XRef block is an external link from another drawing to the current drawing. Because the XRef block represents a link to geometry, not the geometry itself, it is updated whenever the original drawing changes. Inserting an instance of an XRef block into the current drawing creates an ExternalReference object.
The layout blocks represent the geometry in the model space and paper space layouts. These blocks have a Layout object associated with them that contains the plot settings and other layout definition information. The block name of the active paper space layout is always *PAPER_SPACE. The other paper space layouts will have blocks named *PAPER_SPACEn, where n is an integer. Block names start with *PAPER_SPACE0, and the Integereger increments by 1 each time a new layout is inserted.
By default, the layout blocks in a new drawing have the following names:
Block Name |
Definition |
---|---|
*MODEL_SPACE | The model space layout. There is only one model
space layout per drawing. This block corresponds to the ModelSpace collection. |
*PAPER_SPACE | The first paper space layout created. If the model
space layout is currently active, this block contains the last
active paper space layout. This block corresponds to the PaperSpace collection. |
*PAPER_SPACE0 | The second paper space layout created. If this layout is activated, its block is renamed *PAPER_SPACE and becomes accessible from the PaperSpace collection; the first layout's block is renamed *PAPER_SPACE0. |
When you activate a new layout, it swaps block names with the layout that was formerly active. In this way, the block of the active layout is always named *PAPER_SPACE. For example, suppose Layout1 is active and Layout2 is associated with a block named *PAPER_SPACE0. If you then activate Layout2, it's block is renamed to *PAPER_SPACE, and Layout1's block is renamed to *PAPER_SPACE0.
Dynamic blocks enhance simple blocks by increasing their intelligence potential and adaptability. The internal geometry of a dynamic block instance can be adjusted independently of both its base definition and other instances. This flexibility is the central concept of dynamic blocks. Inserting an instance of a dynamic block into the current drawing creates a BlockReference object. From the block reference, you can get the DynamicBlockReferenceProperty object.
To identify a block's type, use the IsLayout, IsXRef, and IsDynamicBlock properties. If these properties are FALSE, then the block is a simple block. If the IsXRef property is TRUE, then the block is an external reference. If the IsLayout property is TRUE, then the block contains all the geometry associated with a layout. If the IsDynamicBlock property is TRUE, then the block is a dynamic block.
There is no limit to the number of objects a block can contain.
To insert a simple, XRef, or dynamic block into a drawing, use the InsertBlock method. To create a new layout block, use the Add method to add a new layout to the Layouts collection. When the new layout is created, an associated block for the layout will also be created.
To edit or query any of the blocks, use the following methods and properties:
Methods |
Properties |
Events |
Comments? |