Block Home

A block is a collection of one or more LiteCAD entities combined to create a single object. The Block reference entity uses Block data to display itself.
There are 3 types of blocks:
- Model Space
- Paper Space
- Usual block
"Model Space" block is a root block for a drawing. "Paper Space" block represents printing layout and contents an image of paper sheet. "Model Space" can be only one, and created automatically when you create a drawing. It is the first block in the blocks list, therefore you can access it by calling

hModelSpace = lcDrwGetFirstObject( hDrw, LC_OBJ_BLOCK );

Usual blocks are created with the lcDrwAddBlock... functions and you can insert them into Model\Paper Space blocks as a block reference.

These are the functions used to manage blocks in a drawing:

Function Meaning
lcDrwAddBlock Adds a new block into a drawing
lcDrwAddBlockFromDrw Adds a block into a drawing from other drawing
lcDrwAddBlockFromFile Adds a block into a drawing from other drawing's file
lcDrwAddBlockFile Adds entire drawing from a file as one block
lcDrwAddBlockPaper Adds "Paper space" type block into a drawing
lcDrwAddBlockCopy Adds a block into a drawing as a clone of exist block

lcDrwDeleteObject Deletes an object from a drawing
lcDrwCountObjects Counts a number of objects, by type
lcDrwSortObjects Sorts objects by LC_PROP_TABLE_PRIORITY
lcDrwGetFirstObject
lcDrwGetNextObject
Used to sequentially retrieve all objects
lcDrwGetObjectByName Retrieves an object by its name
lcDrwGetObjectByID
lcDrwGetObjectByIDH
Retrieves object by its identifier

Block functions:

Function Meaning
lcBlockSetViewRect Set area that will be visible in a window
lcBlockSetViewRect2 Set area that will be visible in a window
lcBlockSetPaperSize Set paper size for paper space block
lcBlockRasterize Save a block as raster image file
lcBlockRasterizeMem Save a block as a raster image (to memory buffer)
lcBlockUpdate Updates block extents
lcBlockMove Moves all entities of a block
lcBlockRotate Rotates all entities of a block
lcBlockScale Scales all entities of a block
lcBlockMirror Mirrors all entities of a block
lcPrintLayout Prints "Paper space" block, entire page
lcPrintBlock Prints any rectangular area of a block


These are the functions used to manage entities in a block:

Function Meaning
lcBlockClear Deletes all graphic objects (or by layer) from a block
lcBlockPurge Deletes all graphic objects marked as "deleted"
lcBlockSortEnts Sorts graphic objects by LC_PROP_ENT_PRIORITY

Add graphic objects
lcBlockAddPoint
lcBlockAddPoint2
Adds a point
lcBlockAddXline
lcBlockAddXline2P
Adds a consrtuction line
lcBlockAddLine
lcBlockAddLineDir
lcBlockAddLineTan
Adds a line
lcBlockAddPolyline
lcBlockAddSpline
Adds a polyline
lcBlockAddRect
lcBlockAddRect2
Adds a rectangle
lcBlockAddCircle Adds a circle
lcBlockAddArc
lcBlockAddArc3P
lcBlockAddFillet
Adds an arc
lcBlockAddEllipse Adds an ellipse
lcBlockAddText
lcBlockAddText2
lcBlockAddText3
Adds a text (single line)
lcBlockAddMText Adds a multiline text
lcBlockAddArcText Adds an arc text
lcBlockAddBlockRef Adds a block reference
lcBlockAddImageRef Adds a raster image reference
lcBlockAddEcw Adds a ECW image
lcBlockAddHatch Adds a hatch
lcBlockAddAttDef Adds a block's attribute definition
lcBlockAddDimLin
lcBlockAddDimHor
lcBlockAddDimVer
Adds a rotated dimension
lcBlockAddDimAli
lcBlockAddDimAli2
Adds an aligned dimension
lcBlockAddDimAng
lcBlockAddDimAng2
Adds an angular dimension
lcBlockAddDimRad
lcBlockAddDimRad2
Adds a radius dimension
lcBlockAddDimDia
lcBlockAddDimDia2
Adds a diameter dimension
lcBlockAddDimOrd Adds an ordinate dimension
lcBlockAddLeader Adds a leader
lcBlockAddViewport Adds a viewport
lcBlockAddBarcode Adds a barcode
lcBlockAddRPlan Adds a road plan
lcBlockAddArrow Adds an arrow
lcBlockAddSpiral Adds a spiral
lcBlockAddCamview Adds a camera view
lcBlockAddClone Adds a copy of an entity

Retrieve graphic objects
lcBlockGetFirstEnt
lcBlockGetNextEnt
lcBlockGetLastEnt
lcBlockGetPrevEnt
Used to sequentially retrieve all graphic objects from a block
lcBlockGetEntByID
lcBlockGetEntByIDH
Retrieves a graphic object by its identifier
lcBlockGetEntByKey Retrieves a graphic object by its key value
lcBlockGetBlkRefByTag Retrieves block references by attribute tag and value

Select and modify graphic objects
lcBlockUnselect Clear a selection set
lcBlockSelectEnt Select a graphic object
lcBlockSelErase Erase selected objects
lcBlockSelMove Move selected objects
lcBlockSelScale Scale selected objects
lcBlockSelRotate Rotate selected objects
lcBlockSelExplode Explode selected objects
lcBlockSelSplit Split selected objects
lcBlockSelMirror Mirror selected objects
lcBlockSelJoin Join selected objects
lcBlockSelAlign Align selected objects
lcBlockSelBlock Make new block from selected entities
lcBlockGetFirstSel
lcBlockGetNextSel
Used to sequentially retrieve all selected objects from a block


A block object has the following properties:

Property Type Access Meaning
LC_PROP_TABLE_...    Base class properties
LC_PROP_BLOCK_ID int
string
R Unique Identifier
Hexadecimal string (up to 16 characters)
LC_PROP_BLOCK_NAME string RW Block name
LC_PROP_BLOCK_DESCR string RW Block description
LC_PROP_BLOCK_DRW handle R Handle to owner drawing
LC_PROP_BLOCK_X float RW Basepoint X
LC_PROP_BLOCK_Y float RW Basepoint Y
LC_PROP_BLOCK_UFSCALING bool RW Uniform scaling
LC_PROP_BLOCK_UNITS int RW Units
LC_PROP_BLOCK_UNITSCALE float R description
LC_PROP_BLOCK_MODEL bool R "Model space" flag
LC_PROP_BLOCK_PAPER bool R "Paper space" flag
LC_PROP_BLOCK_STANDARD bool R "Usual block" flag
LC_PROP_BLOCK_LAYOUTNAME string RW Layout name
LC_PROP_BLOCK_LAYOUTORDER int RW Value is used for window tabs order
LC_PROP_BLOCK_HIDDEN bool R "Hidden block" flag
LC_PROP_BLOCK_NENTS int R Number of graphic objects in the block
LC_PROP_BLOCK_NSELENTS int R Number of selected objects in the block
LC_PROP_BLOCK_ATTRIBS bool R "Block has attributes" flag
LC_PROP_BLOCK_XMIN float R Block extents X min
LC_PROP_BLOCK_YMIN float R Block extents Y min
LC_PROP_BLOCK_XMAX float R Block extents X max
LC_PROP_BLOCK_YMAX float R Block extents Y max
LC_PROP_BLOCK_XCEN float R Block center X
LC_PROP_BLOCK_YCEN float R Block center Y
LC_PROP_BLOCK_DX float R Block width
LC_PROP_BLOCK_DY float R Block height
LC_PROP_BLOCK_VISLEF float R Area visible in a window, left
LC_PROP_BLOCK_VISBOT float R Area visible in a window, bottom
LC_PROP_BLOCK_VISRIG float R Area visible in a window, right
LC_PROP_BLOCK_VISTOP float R Area visible in a window, top
LC_PROP_BLOCK_SELXMIN float R Selected entities extents X min
LC_PROP_BLOCK_SELYMIN float R Selected entities extents Y min
LC_PROP_BLOCK_SELXMAX float R Selected entities extents X max
LC_PROP_BLOCK_SELYMAX float R Selected entities extents Y max
LC_PROP_BLOCK_SELXCEN float R Selected entities center X
LC_PROP_BLOCK_SELYCEN float R Selected entities center Y

   Only for paper space block
LC_PROP_PAPER_X0 float RW X coordinate of paper left-bottom corner
LC_PROP_PAPER_Y0 float RW Y coordinate of paper left-bottom corner
LC_PROP_PAPER_SIZE int R Paper size (LC_PAPER_A0 and others)
LC_PROP_PAPER_ORIENT int R Paper orientation (LC_PAPER_BOOK and others)
LC_PROP_PAPER_W float R Paper width, mm
LC_PROP_PAPER_H float R Paper height, mm
.