Table of Contents

Class vdBlock

Namespace
VectorDraw.Professional.vdPrimaries
Assembly
VectorDraw.Professional.dll

Represents a block definition containing a set of entities that can be inserted into a document by vdInsert object type.

public sealed class vdBlock : vdPrimary, IDisposable, IVDSerialise, IBaseObject, IComparable
Inheritance
vdBlock
Implements
Inherited Members

Examples

Example: Add a new block containing some entities and a new block reference to that block in the document model entities.

// create a new block with name "testBlock" and add a circle and a text to it, then insert 2 instances of this block in the model at different positions
var block = document.Blocks.Add("testBlock");
block.Entities.AddItem(new vdCircle(document, new gPoint(), 2.5));
block.Entities.AddItem(new vdText(document, "VectorDraw", new gPoint(0.0, 0.0, 0.0), 0.5, VdConstHorJust.VdTextHorCenter, VdConstVerJust.VdTextVerCen,null));
var ins1 = new vdInsert(document) { Block = block, InsertionPoint = new gPoint(-3.0, 0.0, 0.0) };
var ins2 = new vdInsert(document) { Block = block, InsertionPoint = new gPoint(3.0, 0.0, 0.0) };
document.Model.Entities.AddItem(ins1);
document.Model.Entities.AddItem(ins2);
document.Redraw(false);

Constructors

vdBlock()

Initializes the vdBlock object.

vdBlock(vdDocument)

Initializes the vdBlock object and registers it to the passed Document.

vdBlock(vdDocument, string)

Initializes the vdBlock object and registers it to the passed Document.

Properties

Deleted

Get/Set a property that marks the object as Deleted or not.

Entities

Get the collection of entities contained to the vdBlock object.

ExternalReference

Get the vdDocument object if the vdBlock object is an external reference.

ExternalReferencePath

Gets or sets the external reference file path for this block when the block represents an XREF. If this is set to a valid existing file path the block will be an XREF and the content of Model Entities of the file will be shown as the block content and
the Entities of this block will return the external reference model entities and also the ExternalReferences will updated by adding this document drawing.
If it is set to "" or null then the block will not be an XREF and the block content will be the one defined by its entities collection.

InsUnitScale

Returns the scale factor between drawing InsUnits and this block object InsUnits

Used by vdDocument.CommandAction.CmdInsert to multiply the passed block scale with this value

InsUnits

Get/Set a value of vdDocument.InsUnitsEnum type used for scaling when inserting this block to a drawing .

IsXref

Get if the vdBlock object is an external reference.

IsXrefUnloaded

Get/Set the unloaded status when the vdBlock IsXref true.

Name

Get/Set the name of the vdBlock object.

Origin

Get/Set the origin point of the vdBlock object.

StretchBlock

Specifies if the object will be streched or not, when the selected WorldToView matrix has different x,y scales and vdDocument.GlobalRenderProperties.StrechText is false.

VisibleOnForms

Get/Set a boolean value representing if the vdBlock will be viewed in Vectordraw forms.

Methods

AttributeSync()

Synchronizes the attributes of all inserts already added to the Document.

Bind()

Add the Model Entities of this ExternalReferencePath drawing to this Entities and their Table Dependencies to this Document

BoundingBox()

Gets the Bounding Box of the vdBlock object in WorldCoordinate System.

CompareTo(object)

Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

Contains(Type)

Check if a specific vdFigure type exists in the entities of the vdBlock object.

DeSerialize(DeSerializer, string, object)

This Function is called foreach field name of the vdBlock object when opening in vdml format.

Dispose()

Releases all resources used by this object.

GetCompareHashCode()

Returns a 32-bit signed integer hash code for this object instance.

GetNumReferences(bool)

Returns the number of objects that reference this object

GetReferenceObjects()

Returns a copy of the collection that contains all entities reference this object.

GetTableDependecies(vdTableDependeciesArgs)

Fills the passed vdTableDependeciesArgs args with all the table references of this object (vdLayer, vdBlock, vdDimstyle, vdLineType, vdTextstyle, vdImageDef, vdHatchPattern etc).

InitializeProperties()

Resets the properties of the vdBlock object to the Default values.

InternalSetOwner(vdBaseObject)

Internally used only.

Set the object owner

MatchProperties(vdPrimary, vdDocument)

Matches all the common properties(matches even the entities) from an vdBlock object and sets them to this object.

MatchPropertiesWithoutEntities(vdPrimary, vdDocument)

Matches all the common properties(without matching the entities) from an object and sets them to this object.

OnOwnerChanged()

This method is called when the object's owner is changed.

Serialize(Serializer)

This Function is called when saving the vdBlock object to vdml format.

ToDocument()

Creates and Returns a vdDocument object contaning to it's model all the vdFigure objects of the block entities.

ToString()

Gets a System.String that represents the name of the vdBlock Object.

Update()

Updates the objects of the vbBlock object after change of properties.

XrefReLoad()

Reloads the external reference.