Next: , Previous: Sublayer, Up: Concepts


3.8 Block

Blocks are like mini drawings. The figure shows a block, inserted at two different places in the drawing.

blocks.png

Inserting a block does not copy the objects of the block. A reference to the block is created in the form of a block insertion object. The block insertion object (or Block insert for short) has a number of attributes

A block can be inserted not only in a drawing but also in another block. DemoCAD lets you edit blocks recursively with option double-click, the code is worth studying.

In fact, there is little difference between a block and the true drawing, except that the true drawing has a drawing plane attached and is immediately visible. The true drawing can be considered the root block in the drawing’s block hierarchy and for programming purposes the true drawing is considered a block with a special block ID assigned, kCADRootBlockID.

A block has the following attributes

Methods
CADAddBlock, CADRemoveBlock, CADGetBlocks, CADGetBlockInfo, CADSetBlockName, CADGetBlockKey, CADSetBlockKey, CADAddInsertXY, CADAddInsert, CADObjInsert, CADGetInsertID, CADGetInsert, CADGetInsertXY, CADSetInsertID, CADSetInsert, CADSetInsertXY, CADGetInsertColor, CADSetInsertColor, CADClear.