Copyright: Copyright (c) 1997 by SoftSource.  Build 1.0
Citation: Copyright (c) 1997 by SoftSource.


Common Entity APIs
Methods and Properties Common

to All Entity Interfaces

AutoDraw	Does the entity automatically update itself or not..

Break	Break the entity.

Color	What color is the entity?

Copy	Creates an exact copy of the entity.

Delete	Removes the entity from the drawing database

Dialog	Activates the user dialog box for the entity.

Erase	Erases the entity from the screen.

ExtendToSet	Extend to the entity out to the selection set.

Handle	Get the handle for entity.

HasXData	Does the entity have XData attached to it?

Intersection	Find an intersection with this and another entity.

Layer	What layer is the entity residing on?

Linetype	What linetype will the entity be drawn with?

Mirror	Mirrors the entity.

MirrorCopy	Make a mirror’d copy of the entity.

Move	Relocates the entity within the drawing.

Name	Retrieves the entity’s name.

Normal	Get/Set the normal for the entity.

PaperSpace	Is the entity in paperspace or modelspace?

Redraw	Causes the entity to specifically be redrawn

Regen	Causes the entity to specifically be regenerated

Rotate	Rotates the entity as desired.

Scale	Rescales the entity.

Snap2Center	Snap to the center of this entity

Snap2Endpoint	Snap to the nearest endpoint of this entity

Snap2Insertion	Snap to the nearest intersection.

Snap2Midpoint	Snap to the midpoint of the entity

Snap2Nearest	Snap to the nearest point on this entity

Snap2Perpendicular	Snap to the perpendicular.

Snap2Point	Snap to the given point entity.

Snap2Quadrant	Snap to the nearest quadrant.

Snap2Tangent	Snap to the tangent

Thickness	What is the thickness of the entity?

TrimToSet	Trim the entity to the selection set.

Type	Get the type of entity this really is.

Update	Allows the entity to do any necessary updating to itself

XData	Get/Set XData for the entity.


AutoDraw()
Methods and Properties Common to All Entities

AutoDraw

 See Also

BOOL GetAutoDraw()	(for C/C++ only)

void SetAutoDraw(BOOL)	(for C/C++ only)

BOOL AutoDraw	(for VB only)

Set or get the entity's autodraw state.  If the entity is set for autodraw, then it will automatically update itself when any of its values are drawn.  There are times when this can be inconvenient; for example, if you are creating a new complex entity, such as a polymesh.

When a new polymesh is first created, all the vertices are initially located at 0,0.  You would then want to go through each vertex point and assign its correct location within the drawing.  If autodraw is turned on, then this will produce an effect on the user's screen that you probably do not want (though it's interesting at least once).


Color()
Methods and Properties Common to All Entities

Color

 See Also

IColor GetColor()	(for C/C++ only)

void SetColor(IColor colr)	(for C/C++ only)

Color(IColor colr)	(for VB only)

This returns or sets the color applied to any entity in a Vdraft drawing.


Layer()
Methods and Properties Common to All Entities

Layer

 See Also

ILayer GetLayer()	(for C/C++ only)

void SetLayer(ILayer lyr)	(for C/C++ only)

Layer(ILayer lyr)	(for VB only)

This returns or sets the layer that any entity in the drawing is on.

Visual Basic Code Sample:

(Assuming that the object Vdraft has already been initialized for the Vdraft application and Dwg points to the current drawing in Vdraft...)

Dim Lyn As Object

Set Lyn = Dwg.Entities.AddLine()

Lyn.Where1.Set 10,5

Lyn.Where2.Set 44..5, 12.6

Dim Layr As Ojbect

Set Layr = Lyn.Layer()

Lyn.Regen	‘ causeth the line to be displayed


Linetype()
Methods and Properties Common to All Entities

Linetype

 See Also

ILinetype GetLinetype()	(for C/C++ only)

void SetLinetype(Ilinetype lt)	(for C/C++ only)

Linetype(ILinetype lt)	(for VB only)

Returns or sets the linetype used in drawing the entity.  Default is Continuous line type.


Thickness()
Methods and Properties Common to All Entities

Thickness

double GetThickness()	(for C/C++ only)

void SetThickness(double)	(for C/C++ only)

Thickness(double)	(for VB only)

The thickness of the given entity.  Thickness is similar to the height of the object.  But not really.  It isn’t a 3D object, just a thick 2D one.  Defaults to zero.


PaperSpace()
Methods and Properties Common to All Entities

PaperSpace

BOOL GetPaperSpace()	(for C/C++ only)

void SetPaperSpace(BOOL)	(for C/C++ only)

PaperSpace(BOOL)	(for VB only)

Is the entity in paper space or not?  Entities are either in paper space or in model space, not in both.


Normal()
Methods and Properties Common to All Entities

Normal

 See Also

IVector GetNormal()	(for C/C++ only)

void SetNormal(IVector vec)	(for C/C++ only)

Normal(IVector vec)	(for VB only)

Get or set the normal for the entity.


Redraw()
Methods and Properties Common to All Entities

Redraw

 See Also

void Redraw()

Redraw the particular entity.  Useful for getting just the one entity to refresh its display. You should try to use Update instead of Redraw  whenever you can.


Regen()
Methods and Properties Common to All Entities

Regen

 See Also

void Regen()

Regenerates the entity.  Useful for getting just this entity to regenerate itself, when you don’t want to regen the entire drawing.  You should try to use Update instead of Regen  whenever you can.


Update()
Methods and Properties Common to All Entities

Update

 See Also

void Update()

When Update is called, all the changes made to the entity are grouped under a single command & put on the undo list.  The entity is also updated on the screen (erased & regened).  This makes it much tidier to change entities & means that undo/redo properly erase, modify, & regen the entity also.  When the entity interface goes away (by going out of scope or setting entity=Nothing in VB), Update is automatically called.


Erase()
Methods and Properties Common to All Entities

Erase

void Erase()

Erase the entity from the Screen Only, not from the drawing database.  Might be useful when preparing to do long complex operations on a single entity, or before moving the entity, etc.


Delete()
Methods and Properties Common to All Entities

Delete

void Delete()

Eliminate the entity entirely from the drawing.  (Technically, the object isn’t removed from the database until the file is saved; it will be removed at that time.  But this is something you will rarely have to know about.)


Mirror()
Methods and Properties Common to All Entities

Mirror

void Mirror(IVector p1, IVector p2, const VARIANT& MirrorText)

MirrorText is a boolean value (passed in as a VARIANT so that it might be optional from VB) which determines whether text entities are to be mirror or not mirrored.


All_Entities::MirrorCopy
Methods and Properties Common to All Entities

MirrorCopy

MirrorCopy(IVector pt1, IVector pt2, [bool mirrortext])

Allows you to copy while mirroring the given entity.

The two vectors, pt1 and pt2, define the line around which the entity will be copied  and mirrored

The optional bool mirrortext tells whether text should be mirrored or just copied as is.


Move()
Methods and Properties Common to All Entities

Move

void Move(IVector offset)

Moves the given entity, using the specified Vector to give the offset from the entities current position to its new position.  The X, Y and Z values of the vector are the absolute displacement to new position.

See Also:

IVector


Copy()
Methods and Properties Common to All Entities

Copy

LPDISPATCH Copy(IVector offset)

Copy the given entity, using the specified Vector to given the offset from the position of this entity to the position of the new entity.

The return value will be an LPDISPATCH to whatever type of entity this one is.  That is, if you are copying a line, the LPDISPATCH will be the dispatch handle for the new line.


Scale()
Methods and Properties Common to All Entities

Scale

void Scale(IVector basepoint, IVector scale)

Scale the given object.  To shrink the object by 50% in only the X direction, the scale vector would take the values 0.5, 1, 1 for X, Y, Z.


Rotate()
Methods and Properties Common to All Entities

Rotate

 See Also

void Rotate(IVector basepoint, double angle)

Rotate the entity around the given basepoint by the given angle.  Rotation is relative the plane of the current UCS.


Dialog()
Methods and Properties Common to All Entities

Dialog

void Dialog()

Activates the dialog box for editing the given entity.


Name()
Methods and Properties Common to All Entities

Name

BSTR Name()	(read-only)

Returns the type of object that it is.  For example, a line object will return the name “Line”.

Visual Basic Code Sample:

Dim Vdraft As Object

Set Vdraft = CreateObject(“Vdraft.Application”)

Print Vdraft.ActiveDocument.Entities.Item(1).Name

C/C++ Code Sample:

Given a dispatch handle to an entity, this routine will retrieve the entity’s name.

void GetEntName(LPDISPATCH idisp)

{

    IEntity entity(idisp);	// get the object from the dispatch

    CString name;

    name = entity.GetName();	// get the entity’s name

//  &c...

}


Type()
Methods and Properties Common to All Entities

Type

veEntityType Type()	(read-only)

Returns the type of the entity.  That is, is it a line, a circle, a polyface mesh, what?

Notes:

2d & 3d Lines return veET_Line.

Block, endblock, & seqend are hidden from the programmer.

Polylines are broken into 2d, 3d, mesh, & face.

Vertices are broken into 2d, vertex (for 3d, mesh, & face plines), & face (face plines).

C/C++ Code Sample:

This property can be used to figure out what type of entity you have by the tail and allocating the correct entity object for it.  For example:

// given an LPDISPATCH, iDisp, for an entity of unknown type...

IEntity entity(iDisp);	// intermediate object for determination

switch ( entity.GetType() )	// process according to the entity type

{

    case veET_Line:	// it’s a line

    {

        ILine lyn(iDisp);

        double len = lyn.Length();	// length of line

        // do some line-specific-thing

        //

        break;

    }

    case veET_Circle:	// it’s a circle

    {

        ICircle cirk(iDisp);

        double rad = cirk.Radius();	// radius of circle

        // do some circle-specific-thing

        //

        break;

    }

    case veET_Point:

    case veET_Shape:

    case veET_Text:

    case veET_Arc:

    case veET_Trace:

    case veET_Solid:

    case veET_3DFace:

    case veET_Viewport:

    case veET_Attdef:

    case veET_Insert:

    case veET_2dPolyline:

    case veET_3dPolyline:

    case veET_Polymesh:

    case veET_Polyface:

    case veET_HorizontalDim:

    case veET_VerticalDim:

    case veET_RotatedDim:

    case veET_AlignedDim:

    case veET_Ang4PtDim:

    case veET_DiameterDim:

    case veET_RadiusDim:

    case veET_Ang3PtDim:

    case veET_OrdinateXDim:

    case veET_OrdinateYDim:

    default:

        // all other cases unhandled,

        // but you get the idea...

}


Handle()
Methods and Properties Common to All Entities

Handle

BSTR Handle()	(read-only)

Every entity has a handle.  Handles are unique for each entity in a given drawing.


HasXData()
Methods and Properties Common to All Entities

HasXData

 See Also

BOOL HasXData()	(read-only)

Does the given entity have any XData attached to it or not?

NOTE: All entities have an XData interface available, even if there is no actual XData currently attached to the given entity.  This flag tells you whether there is any data in the XData interface, as it were.


XData()
Methods and Properties Common to All Entities

XData

 See Also

IXData XData()	(read-only)

Retrieves the XData object attached to the given entity.  You can use HasXData() to determine if there is already some Xdata on this object.  If there is not, then calling this method will allow to create some Xdata for the entity.


Snap2Endpoint()
Methods and Properties Common to All Entities

Snap2Endpoint

IVector Snap2Endpoint(IVector closeto)

Returns closest entity end point to “closeto,” as a Vector


Snap2Midpoint()
Methods and Properties Common to All Entities

Snap2Midpoint

IVector Snap2Midpoint(IVector closeto)

Returns closest entity midpoint to “closeto,” as a Vector


Snap2Center()
Methods and Properties Common to All Entities

Snap2Center

IVector Snap2Center(IVector closeto)

Returns closest entity center point to “closeto,” as a Vector


Snap2Nearest()
Methods and Properties Common to All Entities

Snap2Nearest

IVector Snap2Nearest(IVector closeto)

Returns closest entity point of any type to “closeto,” as a Vector


Snap2Point()
Methods and Properties Common to All Entities

Snap2Point

IVector Snap2Point(IVector closeto)

Returns closest point entity to “closeto,” as a Vector


Snap2Quadrant()
Methods and Properties Common to All Entities

Snap2Quadrant

IVector Snap2Quadrant(IVector closeto)

Returns closest circle quadrant point to “closeto,” as a Vector


Snap2Insertion()
Methods and Properties Common to All Entities

Snap2Insertion

IVector Snap2Insertion(IVector closeto)

Returns closest block insertion point to “closeto,” as a Vector


Snap2Perpendicular()
Methods and Properties Common to All Entities

Snap2Perpendicular

IVector Snap2Perpendicular(IVector closeto, IVector prevpoint()

Returns closest point perpendicular to “closeto,” as a Vector


Snap2Tangent()
Methods and Properties Common to All Entities

Snap2Tangent

IVector Snap2Tangent(IVector closeto, IVector prevpoint)

Returns closest point tangent to “closeto,” as a Vector


Intersection()
Methods and Properties Common to All Entities

Intersection

 See Also

IVectors Intersection(IEntity entity, BOOL infinite1, BOOL infinite2)

Returns an intersection point between this entity and the indicated one.

Infinite1 and Infinite2 allow you to take two objects that do not currently actually interset and extend them toward infinity to check for intersections if extended.  Two line segments for instance, if not parallel, will eventually intersect if extended far enough.  Infinite1 is this entity and Inifinite2 is for extending the other entity (the “entity” parameter). These mostly applies to lines, arcs, & polylines.  Entities like 2d solids & 3d faces aren't affected.


ExtendToSet()
Methods and Properties Common to All Entities

ExtendToSet

BOOL ExtendToSet(IVector point)

Extend the entity to the current selection set.  “Point” is a point on this entity.


Trim2Set()
Methods and Properties Common to All Entities

TrimToSet

BOOL TrimToSet(IVector point)

Trims the entity using the current selection set.  “Point” is a point on this entity, indicating which part of the entity will be removed (relative to the selection set).


Break()
Methods and Properties Common to All Entities

Break

BOOL Break(IVector point1, IVector point2()

Breaks the entity at the two points.  The portion of the entity between the two points is removed.  For a line, this results in two entities where there was one before.  For a circle, this means there is still one entity.


Sample Code - C/C++
C/C++ Code Samples

 See Also

Care has been taken all the code samples in this document to ensure that they reflect the true state of affairs in Vdraft – and that they will actually work.  However, we can not guarantee that they are  flawless or even appropriate for your own uses.  You know, “you mileage may vary,” etc..

Further, all sample code has been constructed using only Microsoft Visual C/C++; other compilers may work, but we can make no guarantees about this.  All compilers have their own idiosyncrasies.  What is required is a package that is compatible with MSVC’s implementation of MFC and of ActiveX.

The Vdraft package ships with sample applications with full source code.  For C/C++, look under

\Vdraft\Programs\CPP\

AngDim	<- angular dimension example

CurveLdr	<- curved leader example

DrawX	<- line drawing example

These are live samples that, aside from really working, illustrate many important principals about working with Vdraft in C/C++.  This document also contains a number of code fragments scattered all about, as examples of the various individual interfaces; while not complete by any means, these fragments should still offer guidance for how to use the various interfaces.

Note that many of the entity interfaces have some sample code illustrating how you might use it.

Additionally, the following examples are available:

 A general automation example

 Creating a new circle in Vdraft

 Creating a Vdraft PlugIn module

 Interpreting XData.

 PlugIn samples

 Reading the IColors “table”

 Retrieving header variables

 Running through every entity in a drawing

 Starting Vdraft and getting an active document.

 Using the ILine.interface


Sample Code - Running Through Every Entity in a Drawing
C/C++ Sample Code

Running Through Every Entity in a Drawing

 See Also

This is a simple code fragment that acquires each entity in the currently active drawing and calls some other routine (ProcessEntity() – not defined in this example) to do something with each one of these.  This might be counting the number of each type of entity, or looking for XData belonging to this application, etc..

void CheckAllEntities()

{

    IVdraft app;	// for the Vdraft application

    if ( !app.CreateDispatch("Vdraft.Application", NULL) )

    {

        return;	// failed to find Vdraft

    }

    IDocument doc(app.GetActiveDocument());	// get the active drawing

    IEntities entities(doc.GetEntities());	// get the entities in the drawing

    int count = entities.GetCount();	// how many are there?

    for (int i=1; i<=count; i++)	// do for each one of them

    {

        ProcessEntity( entities.GetItem( cVariant(i) ) );	// call some function with the entity

    }

}


Sample Code - Retrieving Header Variables
C/C++ Sample Code

Retrieving Header/System Variables

This example illustrates a hypothetical application that needs to read every header variable in the the drawing.  This comes in two parts: the OnHeader() function, which might be attached to a dialog box button in the app and GetHeader() which retrieves every header variable.  Obviously, as presented, this is not very useful code, but it does illustrate how to get Vdraft, and how every header variable might be accessed.  See IHeader for more information.

void CAutoTestDlg::OnHeader()

{

IVdraft app;

if ( !app.CreateDispatch("Vdraft.Application", NULL) )

{

return;	// failed to find Vdraft

}

IDocument doc(app.GetActiveDocument());	// get the active document

GetAllHeaders( doc.GetHeader() );	// interface to the header vars

}

void GetAllHeaders(LPDISPATCH idisp)

{

CString prop_str;	// temp vars for storing the values

double prop_double;

int prop_int;

BOOL prop_bool;

IHeader header(idisp);	// create an IHeader object from the dispatch handle

prop_bool = header.GetAttributeDialog();

prop_int = header.GetAttributeMode();

prop_bool = header.GetAttributeRequest();

prop_bool = header.GetAxisMode();

IVector axis_unit = header.GetAxisUnit();

prop_str = axis_unit.Dump();

prop_bool = header.GetBlipMode();

prop_int = header.GetCirclePrecision();

prop_int = header.GetCoordinateDisplay();

prop_double = header.GetCurrentElevation();

prop_double = header.GetCurrentThickness();

prop_int = header.GetDragMode();

prop_int = header.GetDrawingCodePage();

prop_bool = header.GetFastZoom();

prop_bool = header.GetFillMode();

prop_bool = header.GetFlatLand();

prop_bool = header.GetHandles();

IVector limits_max = header.GetLimitsMax();

prop_str = limits_max.Dump();

IVector limits_min = header.GetLimitsMin();

prop_str = limits_min.Dump();

prop_bool = header.GetLimitsCheck();

prop_int = header.GetMaxActiveViewports();

prop_bool = header.GetMirrorText();

prop_double = header.GetPaperSpaceElevation();

IVector pspace_limits_max = header.GetPaperSpaceLimitsMax();

prop_str = pspace_limits_max.Dump();

IVector pspace_limits_min = header.GetPaperSpaceLimitsMin();

prop_str = pspace_limits_min.Dump();

prop_bool = header.GetPaperSpaceLimitsCheck();

prop_int = header.GetPolylineLinetypePattern();

prop_double = header.GetPolylineWidth();

prop_int = header.GetQuickText();

prop_int = header.GetRegenMode();

prop_int = header.GetShadeDiffuse();

prop_int = header.GetShadeEdge();

prop_double = header.GetSketchIncrement();

prop_bool = header.GetSketchPolyline();

prop_int = header.GetSplineFrame();

prop_int = header.GetSplineSegments();

prop_int = header.GetSplineType();

prop_int = header.GetSurfaceDensityM();

prop_int = header.GetSurfaceDensityN();

prop_int = header.GetSurfaceTabulations1();

prop_int = header.GetSurfaceTabulations2();

prop_int = header.GetSurfaceType();

prop_double = header.GetTextSize();

prop_double = header.GetTraceSize();

prop_int = header.GetTreeDepth();

prop_int = header.GetUCSIcon();

prop_int = header.GetUnitMode();

prop_int = header.GetUserInteger1();

prop_int = header.GetUserInteger2();

prop_int = header.GetUserInteger3();

prop_int = header.GetUserInteger4();

prop_int = header.GetUserInteger5();

prop_int = header.GetUserReal1();

prop_int = header.GetUserReal2();

prop_int = header.GetUserReal3();

prop_int = header.GetUserReal4();

prop_int = header.GetUserReal5();

prop_bool = header.GetUserTimer();

prop_bool = header.GetWorldView();

}


Sample Code - Starting Vdraft
C/C++ Sample Code

Starting Vdraft

 See Also

The following C++ sample code shows one method of getting Vdraft started up and of then getting a handle to a current document (creating one, if there isn’t one already active).

//  grab a pointer to Vdraft.  Open the application.

    IVdraft Vdraft;

   if (! Vdraft.CreateDispatch("Vdraft.Application", NULL))

    {

    //  Vdraft did not start.  Handle accordingly for your app…

    }

    CString AppName = Vdraft.GetName();	// this should return “Vdraft”

    ASSERT (AppName == “Vdraft”);

//  get a pointer to the currently active document

    IDocuments Dox(Vdraft.GetDocuments());

    if (Dox.Count() == 0)

    {

        Dox.Add(cVariant());

    }

    IDocument Doc(Vdraft.ActiveDocument());

    CString DocName = pDoc->GetFullName();	// get the name of the currently active document

    //

    //  (whatever other processing you need/want to do)

    //

From this point on you have access to Vdraft and all it wonders.  If you keep “pVdraft” as a global object, or wrap it up in a class, or something of the like, then it can be accessed at any time you need Vdraft.


Sample Code - Reading IColors
C/C++ Sample Code

Reading IColors

 See Also

Test reads every color in the IColors table for the active drawing.  This example shows using LPDISPATCH values as parameters, how to use all the methods belonging to IColors (excepting GetApplication() and GetParent())

//  Read all the colors in the colors “table”

// the parameter is the dispatch handle to the colors “table”

void ReadAllColors(LPDISPATCH idisp)

{

    IColors table(idisp);	// create the object from the dispatch handle

    ReadColor( table.GetActive() );

    ReadColor( table.GetSameAsLayer() );

    ReadColor( table.GetSameAsBlock() );

//  now read each table entry one by one

    int count = table.GetCount();

    for (int i=1; i<=count; i++)

    {

        ReadColor( table.GetItem( cVariant(i) ) );

    }

    table.Dialog();	// bring up the colors dialog box for the user

}

//  Read the values of the given IColor object,

//  using its dispatch handle

void ReadColor(LPDISPATCH idisp)

{

    CString sName,sVal;

    double dVal;

    int iVal;

    IColor entry(idisp);	// create the IColor object from the dispatch

    sName = entry.GetName();	// Name readonly

    IVal = entry.GetNumber();	// Number readonly

    dVal = entry.GetRed();	// Red readonly

    dVal = entry.GetGreen();	// Green readonly

    dVal = entry.GetBlue();	// Blue readonly

}


Sample Code - Interpreting XData
C/C++ Sample Code

Interpreting XData

 See Also

The following example shows how you might run through the XData attached to an entity.  “idisp” is a dispatch handle for an entity’s XData.  This might be retrieved by calling the XData() function on a given entity.

void TestXData(LPDISPATCH idisp)

{

    CString sVal;	// for holding the various values

    double dVal;

    int iVal;

    IXData xdata(idisp);	// create xdata object from dispatch handle

    while ( xdata.Next() )

    {

        iVal = xdata.GetIndex();	// get the xdata index

        iVal = xdata.GetGroup();	// get the group code (see DXF)

        switch ( xdata.GetType() )	// process according to the type of data it is

        {

            case veXDT_String:	// string data

                sVal = xdata.GetString();

                break;

            case veXDT_Control:	// XData control string

                iVal = xdata.GetControl();

                break;

            case veXDT_Layer:	// layer

            {

                ILayer layer( xdata.GetLayer() );	// retrieve it as a layer object

                sVal = layer.GetName();	// get the layer’s name

                break;

            }

            case veXDT_Handle:	// entity handle

                 sVal = xdata.GetHandle();

                 break;

            case veXDT_Vector:	// Vector data

            {

                IVector vec( xdata.GetVector() );

                sVal = vec.Dump();

                break;

            }

            case veXDT_Double:	// double floating point data

                dVal = xdata.GetDouble();

                break;

            case veXDT_Short:	// short integer

                iVal = xdata.GetShort();

                break;

            case veXDT_Long:	// long integer

                iVal = xdata.GetLong();

                break;

        }

   }

}


IEntity

(Interface Overview)

C++ Class Constructors:

IEntity()

IEntity(LPDISPATCH pDispatch)

IEntity(const IAngleSnap& dispatchSrc)

All drawing entities are IEntity objects.  They are also one other type of object, such as line, a circle or a polyface mesh.  IEntity gives you a way to deal with entities in the drawing without necessarily knowing what type of entity it really is.  In many cases, you will retrieve an entity from the drawing as an IEntity object, then check to see what its Type is.  This will tell you the actual type of the entity, allowing you to then retrieve it as a line or a polyface mesh in order to deal with those qualities peculiar to that exact type.

Visual Basic users will probably not have much need for this class, since VB figures out for you an object’s type and correctly deals with them for you, all behind the curtain while you look somewhere else.

Available Interfaces:

Application	(read-only)

Parent	(read-only)

APIs Common to All Entity Interfaces


I2DVertices

(Interface Overview)

 See Also

C++ Class Constructors:

I2DVertices()

I2DVertices(LPDISPATCH pDispatch)

I2DVertices(const I2DVertices& dispatchSrc)

This object is a collection of I2DVertex objects, used to describe I2DPolylines.

Available Interfaces:

Application	(read-only)

Parent	(read-only)

Count	How many vertices in the collection?

Item	Access a particular vertex

Remove	Remove one from the collection


I2DVertices::Count

 I2DVertices Class Overview

long GetCount()	(for C/C++ only)

long Count()	(for VB only)

Returns the number of I2DVertex objects in this collection.


I2DVertices::Item

 I2DVertices Class Overview

I2DVertex GetItem(long index)	(for C/C++ only)

I2DVertex Item(long index)	(for VB only)

Returns the specific I2DVertex referenced by its index position in the list.

NOTE: Unlike most of the Item() methods attached to Vdraft collection objects, this Item() method can not retrieve by name or handle, but only by index in the collection.


I2DVertices::Remove

 I2DVertices Class Overview

void Remove(long which)

Removes the specified I2DVertex object from this collection.


IFaceVertices

(Interface Overview)

 See Also

C++ Class Constructors:

IFaceVertices()

IFaceVertices(LPDISPATCH pDispatch)

IFaceVertices(const IFaceVertices& dispatchSrc)

This is a collection of IFaceVertex objects, used by IPolyface to describe how to assemble the vertex points in a polyface into faces.

Available Interfaces:

Application	(read-only)

Parent	(read-only)

Count	The number of face vertices in the collection.

Item	Access a particular face vertex

C/C++ Code Sample:

This sample shows a simple example of using the various interfaces to this entity.  The sample function takes an LPDISPATCH, a pointer to a dispatch handle.  This dispatch handle might, for example, have been retrieved using Vdraft’s IEntities.Item() method, or by having created the entity using the Add or Draw methods belonging to IEntities.

NOTE: IFaceVerticies comes from an IPolyface object not IEntities

void TestFaceVertices( IPolyface& polyface )

{

IFaceVertices list( polyface.GetFaceVertices() );

…

for (int i=1; i <= list.GetCount(); i++)	// do for each FaceVertex in the collection

DoSomething( list.GetItem(i) );	// pass an LPDISPATCH to the FaceVertex

}

// assume we're looping for all entities…

IEntity entity( entities.GetItem(cVariant(i)) );

if (entity.GetType() == veET_Polyface)

TestFaceVertices( IPolyface(entity. DetachDispatch()) );


IFaceVertices::Count

 IFaceVertices Class Overview

long GetCount()	(for C/C++ only)

long Count()	(for VB only)

Returns the number of IFaceVertex objects in this collection.


IFaceVertices::Item

 IFaceVertices Class Overview

IFaceVertex GetItem(long index)	(for C/C++ only)

IFaceVertex Item(long index)	(for VB only)

Returns the specific IFaceVertex referenced by its index position in the list.


IFaceVertex

(Interface Overview)

 See Also

C++ Class Constructors:

IFaceVertex()

IFaceVertex(LPDISPATCH pDispatch)

IFaceVertex(const IFaceVertex& dispatchSrc)

A face vertex is what describes how to link the vertices in a Polyface together into faces.

Available Interfaces:

Application	(read-only)

Parent	(read-only)

APIs Common to All Entity Interfaces

Corner	A corner for the given face

Visible	Get/Set edge visibility

SetCorners

SetVisibility	Is the edge visible or not?

C/C++ Code Sample:

This sample shows a simple example of using the various interfaces to this entity.

void DoFaceVertex(IFaceVertex& face)

{

    if (face.Type() != veET_FaceVertex)	// is this really a FaceVertex object?

    	return:	// no: quit out of here

    for (int i=1; i<=4; i++)

    {

        int prop_int = entity.GetCorner(i);

        entity.SetCorner(i, prop_int);

        BOOL prop_bool = entity.GetVisible(i);

        entity.SetVisible(i, prop_bool);

        }

}

IFaceVertices( polyface.GetFaceVertices() );

DoFaceVertex( IFaceVertex(vertices.GetItem(1)) );


IFaceVertex::Corner

 IHeader Class Overview

 See Also

short GetCorner(short which)	(for C/C++ only)

void SetCorner(short which, short NewVal)	(for C/C++ only)

short Corner(short which)	(for VB only)

A ‘Corner’ is an index in the vertices list of the vertex that defines this corner of a face.


IFaceVertex::Visible

 IHeader Class Overview

BOOL GetVisible(short which)	(for C/C++ only)

BOOL SetVisible(short which, BOOL val)	(for C/C++ only)

BOOL Visible(short which)	(for VB only)

Determines whether the edge starting from this vertex is visible or invisible.


IFaceVertex::SetCorners

 IHeader Class Overview

void SetCorners(short val1, short val2, short val3, short val4)

Allows you to set all the Corner properties at once.


IFaceVertex::SetVisibility

 IHeader Class Overview

void SetVisibility(BOOL f1, BOOL f2, BOOL f3, BOOL f4)

Allows you to set all the  properties at one time.


I2DPolyline

(Interface Overview)

 See Also

C++ Class Constructors:

I2DPolyline()

I2DPolyline(LPDISPATCH pDispatch)

I2DPolyline(const IHeader& dispatchSrc)

Available Interfaces: Application (read-only) Parent (read-only) Closed Curve EndWidth StartWidth Vertices (read-only) APIs Common to All Entity Interfaces
C/C++ Code Sample:

This sample shows a simple example of using the various interfaces to this entity.  The sample function takes an LPDISPATCH, a pointer to a dispatch handle.  This dispatch handle might, for example, have been retrieved using Vdraft’s IEntities.Item() method, or by having created the entity using the Add or Draw methods belonging to IEntities.

void Do2DPolyline(I2DPolyline& entity)

{

double prop_double;

int prop_int;

BOOL prop_bool;

if (entity.Type() != veET_2DPolyline)	// is it really a 2D Polyline

{

return;	// no: stop this process now.

}

prop_bool = entity.GetClosed();

entity.SetClosed(prop_bool);

prop_int = entity.GetCurve();

entity.SetCurve(prop_int);

prop_double = entity.GetEndWidth();

entity.SetEndWidth(prop_double);

prop_double = entity.GetStartWidth();

entity.SetStartWidth(prop_double);

}


I2DPolyline::Vertices

 I2DPolyline Class Overview

 See Also

I2DVertices GetVertices()	(for C/C++ only)

I2DVertices Vertices()	(for VB only)

Retrieves the vertices list that makes up this 2D Polyline.


I2DPolyline::Closed

 I2DPolyline Class Overview

BOOL GetClosed()	(for C/C++ only)

void SetClosed(BOOL)	(for C/C++ only)

BOOL Closed()	(for VB only)

Is this 2D polyline closed or not?


I2DPolyline::Curve

 I2DPolyline Class Overview

 See Also

vePolylineCurve GetCurve()	(for C/C++ only)

void SetCurve(vePolylineCurve)	(for C/C++ only)

vePolylineCurve SetCurve	(for VB only)

vePC_NoCurve the polyline is drawn from vertex to vertex vePC_Curved the polyline is drawn curve fit (currently you can't set this) vePC_Cubic the vertices are used as control points to draw a cubic spline vePC_Quadratic the vertices are used as control points to draw a quadratic spline


I2DPolyline::EndWidth

 I2DPolyline Class Overview

double GetEndWidth()	(for C/C++ only)

void SetEndWidth(double)	(for C/C++ only)

double SetEndWidth	(for VB only)

Gets or Sets the EndWidth of the 2D Polyline.  This value can be overridden for a specific vertex.


I2DPolyline::StartWidth

 I2DPolyline Class Overview

double GetStartWidth()	(for C/C++ only)

void SetStartWidth(double)	(for C/C++ only)

double SetStartWidth(double)	(for VB only)

Get or Set the starting width of the 2D Polyline.  Can be overridden for a specific vertex.


I3DPolyline

(Interface Overview)

 See Also

C++ Class Constructors:

I3DPolyline()

I3DPolyline(LPDISPATCH pDispatch)

I3DPolyline(const IHeader& dispatchSrc)

This class deals with 3D Polyline objects.

Available Interfaces:

Application	(read-only)

Parent	(read-only)

APIs Common to All Entity Interfaces

Closed

Curve

Vertices

Visual Basic Code Sample:

' make polyline with 4 vertices

Set polyline = Vdraft.ActiveDocument.Entities.Add3DPolyline(4)

' set  vertices

Set verts = polyline.Vertices

verts(1).Where.Set 1, 0, 0

verts(2).Where.Set 2, 1, 1

verts(3).Where.Set 3, 0, 3

verts(4).Where.Set 4, 2, 2

C/C++ Code Sample:

This sample shows a simple example of using the various interfaces to this entity.

void Do3DPolyline(I3DPolyline entity)

{

if (entity.Type() != veET_3DPolyline)	// is it really a 3D Polyline?

return;	// no: quit this scene

BOOL prop_bool = entity.GetClosed();	// get whether it’s closed or not

entity.SetClosed(prop_bool);	// set closed or not

vePolylineCurve curve = entity.GetCurve();	// get the curve type

entity.SetCurve(prop_int);	// set the curve

}


I3DPolyline::Vertices

 I3DPolyline Class Overview

 See Also

IVertices GetVertices()	(for C/C++ only)

IVertices Vertices	(for VB only)

Retrieves the vertices list that makes up the 3D Polyline.


I3DPolyline::Closed

 I3DPolyline Class Overview

BOOL GetClosed()	(for C/C++ only)

void SetClosed(BOOL)	(for C/C++ only)

BOOL Closed	(for VB only)

Is the polyline closed or not?


I3DPolyline::Curve

 I3DPolyline Class Overview

 See Also

vePolylineCurve GetCurve()	(for C/C++ only)

void SetCurve(vePolylineCurve)	(for C/C++ only)

vePolylineCurve Curve	(for VB only)

vePC_NoCurve	the polyline is drawn from vertex to vertex

vePC_Curved	the polyline is drawn curve fit (currently you can't set this)

vePC_Cubic	the vertices are used as control points to draw a cubic spline

vePC_Quadratic	the vertices are used as control points to draw a quadratic spline


IPolymesh

(Interface Overview)

 See Also

C++ Class Constructors:

IPolymesh()

IPolymesh(LPDISPATCH pDispatch)

IPolymesh(const IHeader& dispatchSrc)

Available Interfaces:

Application	(read-only)

Parent	(read-only)

APIs Common to All Entity Interfaces

ColumnClosed

ColumnCurve

ColumnSize	(read-only)

RowClosed

RowCurve

RowSize	(read-only)

Vertices

Visual Basic Code Sample:

' make polymesh with 2 columns & 3 rows

Set polymesh = entities.AddPolymesh(2, 3)

' make vertices

Set verts = polymesh.Vertices

For Column = 1 To 2

    For Row = 1 To 3

        Set vertex = verts((Column - 1) * 3 + Row)

        vertex.Where.Set Column, Row, Column * Row

    Next Row

Next Column

C/C++ Code Sample:

This sample shows a simple example of using the various interfaces to this entity

void DoPolymesh(IPolymesh& entity)

{

if (entity.Type() != veET_Polymesh)	// is it really a polymesh?

return;	// no: escape the scene

BOOL prop_bool = entity.GetColumnClosed();

entity.SetColumnClosed(prop_bool);

prop_bool = entity.GetRowClosed();

entity.SetRowClosed(prop_bool);

int prop_int = entity.GetColumnSize();	// Column Size readonly

prop_int = entity.GetRowSize();	// Row Size readonly

vePolylineCurve curve = entity.GetColumnCurve();

curve = entity.GetRowCurve();

}


IPolymesh::Vertices

 IPolymesh Class Overview

 See Also

IVertices GetVertices()	(for C/C++ only)

IVertices Vertices()	(for VB only)

Get the vertices that make up this polymesh object


IPolymesh::ColumnClosed

 IPolymesh Class Overview

BOOL GetColumnClosed()	(for C/C++ only)

void SetColumnClosed(BOOL)	(for C/C++ only)

BOOL ColumnClosed	(for VB only)

Is the mesh closed in the column dimension?


IPolymesh::RowClosed

 IPolymesh Class Overview

BOOL GetRowClosed()	(for C/C++ only)

void SetRowClosed(BOOL)	(for C/C++ only)

BOOL SetRowClosed	(for VB only)

Is the mesh closed in the row dimension?


IPolymesh::ColumnSize

 IPolymesh Class Overview

short GetColumnSize()	(for C/C++ only)

short ColumnSize	(for VB only)

Read-Only.  How many nodes are in the columns?


IPolymesh::RowSize

 IPolymesh Class Overview

short GetRowSize()	(for C/C++ only)

short RowSize	(for VB only)

Read-Only.  How many vertices are in the rows?


IPolymesh::ColumnCurve

 IPolymesh Class Overview

vePolylineCurve GetColumnCurve()	(for C/C++ only)

void SetColumnCurve(vePolylineCurve)	(for C/C++ only)

vePolylineCurve SetColumnCurve	(for VB only)

Sets or Gets the columncurve value for the polymesh object.


IPolymesh::RowCurve

 IPolymesh Class Overview

vePolylineCurve GetRowCurve()	(for C/C++ Only)

void SetRowCurve(vePolylineCurve)	(for C/C++ Only)

vePolylineCurve SetRowCurve	(for VB Only)

Sets or Gets the rowcurve value for the polymesh object.


IPolyface

(Interface Overview)

 See Also

C++ Class Constructors:

IPolyface()

IPolyface(LPDISPATCH pDispatch)

IPolyface(const IHeader& dispatchSrc)

Everything you ever wanted to know about polyface objects.  A polyface is basically a collection of Vertices in space followed by information on how to connect them together into faces.  Faces are made up of either three or four vertices each.  Individual vertices could belong to any number of faces.

Available Interfaces:

Application	(read-only)

Parent	(read-only)

APIs Common to All Entity Interfaces

Vertices

FaceVertices

Visual Basic Code Sample:

' make polyface with 4 vertices & 2 faces

Set polyface = ents.AddPolyface(4, 2)

' make vertices

Set verts = polyface.Vertices

verts(1).Where.Set 1, 1, 0

verts(2).Where.Set 2, 1, 1

verts(3).Where.Set 2, 2, 2

verts(4).Where.Set 1, 2, 0

' connect the dots

Set faces = polyface.FaceVertices

' vertices 1,2,4 define a face

faces(1).SetCorners 1, 2, 4, 0

' vertices 2,3,4 define a face

faces(2).SetCorners 2, 3, 4, 0

C/C++ Code Sample:

This sample shows a simple example of using the various interfaces to this entity

void TestPolyface( IPolyface& polyface )

{

IVertices vertices( polyface.GetVertices() );

long vertexcount = faces.GetCount();

for (int i=1; i<=vertexcount; i++)

DoVertex( IVertex(vertices.GetItem(i)) );

IFaceVertices faces( polyface.GetFaceVertices() );

long facecount = faces.GetCount();

for (int i=1; i<= facecount; i++)

DoFaceVertex( IFaceVertex(faces.GetItem(i)) );

}


IPolyface::Vertices

 IPolyface Class Overview

 See Also

IFaceVertices GetVertices()	(for C/C++ only)

IFaceVertices Vertices	(for VB only)

Retrieves the vertices for the given polyface object.


IPolyface::FaceVertices

 IPolyface Class Overview

IFaceVertices GetFaceVertices()	(for C/C++ only)

IFaceVertices FaceVertices	(for VB only)

Retrieves the face vertices for the given polyface object.


I2DVertex

(Interface Overview)

 I2DVertex Class Overview

 See Also

C++ Class Constructors:

I2DVertex()

I2DVertex(LPDISPATCH pDispatch)

I2DVertex(const IHeader& dispatchSrc)

A single vertex in a 2D Polyline. Available Interfaces: Application (read-only) Parent (read-only) APIs Common to All Entity Interfaces Bulge ControlPoint (read-only) CurveFit (read-only) EndWidth StartWidth Tangent Where
C/C++ Code Sample:

This sample shows a simple example of using the various interfaces to this entity

void Do2DVertex(I2DVertex& entity)

{

if (entity.Type() != veET_2DVertex)	// is it really a 2D Vertex?

return;	// no: quit

IVector where( entity.GetWhere() );

entity.SetWhere( where );

CString prop_str = where.Dump();

double prop_double = entity.GetEndWidth();

entity.SetEndWidth(prop_double);

prop_double = entity.GetStartWidth();

entity.SetStartWidth(prop_double);

prop_double = entity.GetBulge();

entity.SetBulge(prop_double);

prop_double = entity.GetTangent();

entity.SetTangent(prop_double);

BOOL prop_bool = entity.GetControlPoint();// Control Point readonly

prop_bool = entity.GetCurveFit();	// Curve Fit readonly

}


I2DVertex:: Where()
I2DVertex::Where

 I2DVertex Class Overview

 See Also

IVector GetWhere()	(for C/C++ only)

void SetWhere(IVector pt)	(for C/C++ only)

IVector Where	(for VB only)

This is the location of the vertex, that is, its coordinates are contained in the X, Y and Z quantities of the vector.


I2DVertex::EndWidth

 I2DVertex Class Overview

 See Also

double GetEndWidth()	(for C/C++ only)

double SetEndWidth()	(for C/C++ only)

double EndWidth	(for VB only)

Sets and gets the end width of the polyline segment defined by this vertex.


I2DVertex::StartWidth

 I2DVertex Class Overview

 See Also

double GetStartWidth()	(for C/C++ only)

void SetStartWidth(double)	(for C/C++ only)

double StartWidth	(for VB only)

Sets and Retrieves the Start width of the polyline segment defined by this node.


I2DVertex::Bulge

 I2DVertex Class Overview

double GetBulge()	(for C/C++ only)

void SetBulge(double)	(for C/C++ only)

double Bulge	(for VB only)

Bulge is defined as the tangent of one fourth of the included angle.

Gets and sets the bulge factor for the polyline segment defined by the vertex.  If the bulge is zero, a segement is drawn from the vertex to the next.  If the bulge is non-zero, an arc is drawn.


I2DVertex::Tangent

 I2DVertex Class Overview

double GetTangent()	(for C/C++ only)

void SetTangent(double)	(for C/C++ only)

double Tangent	(for VB only)

Gets and sets the Tangent for this vertex point of the 2D Polyline.  Used with spline and curve fit polylines.


I2DVertex::ControlPoint

 I2DVertex Class Overview

BOOL GetControlPoint()	(for C/C++ only)

BOOL ControlPoint	(for VB only)

Control points are “extra” points inserted into a polyline by the CAD system in order to smooth out the polyline for splining and curve fitting.  That is, these points are inserted as necessary between the points actually specified by the user; they were not specified by the user.

(read-only)  If the polyline is a spline, this value reflects whether the vertex is a control point or was added for the purpose of creating the spline.


I2DVertex::CurveFit

 I2DVertex Class Overview

BOOL GetCurveFit()	(for C/C++ only)

BOOL CurveFit	(for VB only)

Control points are “extra” points inserted into a polyline by the CAD system in order to smooth out the polyline for splining and curve fitting.  That is, these points are inserted as necessary between the points actually specified by the user; they were not specified by the user.

(read-only)  If the polyline is a curve fit polyline, this value reflects whether the vertex is a control point or was added for the purpose of creating the curve fitting.


IHeader

(Interface Overview)

C++ Class Constructors:

IHeader()

IHeader(LPDISPATCH pDispatch)

IHeader(const IHeader& dispatchSrc)

IHeader is a group of access functions for retrieving and setting the drawing variables.  Many of these functions are provided strictly for full compatbility with AutoCAD, as Vdraft doesn’t need all of these settings itself.  Be careful when changing any of these values; most of these do not affect Vdraft, but incorrect settings may have negative effects should the drawing be brought back into AutoCAD..  Some of the variables that AutoCAD stores in the header can be referenced in Vdraft through the relavent interface (e.g. IGripSnap).

(Some sample code appears after the list of members.)

Properties:

Application	(read-only)

AttributeDialog

AttributeMode

AttributeRequest

AxisMode

AxisUnit

BlipMode

CirclePrecision

CoordinateDisplay

CurrentElevation

CurrentThickness

DragMode

DrawingCodePage

FastZoom

FillMode

FlatLand

HandleSeed	(read-only)

Handles	(read-only)

LimitsCheck

LimitsMax

LimitsMin

MaxActiveViewports

MenuName

MirrorText

PaperSpaceElevation

PaperSpaceLimitsCheck

PaperSpaceLimitsMax

PaperSpaceLimitsMin

Parent	(read-only)

PolylineLinetypePattern

PolylineWidth

QuickText

RegenMode

ShadeDiffuse

ShadeEdge

SketchIncrement

SketchPolyline

SplineFrame

SplineSegments

SplineType

SurfaceDensityM

SurfaceDensityN

SurfaceTabulations1

SurfaceTabulations2

SurfaceType

TextSize

TraceSize

TreeDepth

UCSIcon

UnitMode

UserInteger1

UserInteger2

UserInteger3

UserInteger4

UserInteger5

UserReal1

UserReal2

UserReal3

UserReal4

UserReal5

UserTimer

WorldView

Visual Basic Code Sample:

Dim OldBlip As Integer

Dim Vdraft , Doc As Object

Set Vdraft = CreateObject(“Vdraft.Application”)

Set Doc = Vdraft.ActiveDocument

OldElev = Doc.Header.CurrentElevation

Doc.Header. CurrentElevation = 3

‘

‘   do whatever you need to do here

‘

Doc.Header. CurrentElevation = OldElev	‘ restore old setting


IHeader::AttributeDialog

 IHeader Class Overview

BOOL GetAttributeDialog()	(for C/C++ only)

void SetAttributeDialog(BOOL)	(for C/C++ only)

BOOL AttributeDialog	(for VB only)

Equivalent to the AutoCAD ATTDIA setting.  Attribute entry dialogs.  1 = On, 0 = Off.


IHeader::AttributeMode

 IHeader Class Overview

long GetAttributeMode()	(for C/C++ only)

void SetAttributeMode(long)	(for C/C++ only)

long AttributeMode	(for VB only)

Same as the AutoCAD ATTMODE setting.  0 = none, 1 = normal, 2 = all.


IHeader::AttributeRequest

 IHeader Class Overview

BOOL GetAttributeRequest()	(for C/C++ only)

void SetAttributeRequest(BOOL)	(for C/C++ only)

BOOL AttributeRequest	(for VB only)

Equivalent to the ATTREQ system variable in AutoCAD.  1 = On, 0 = Off.


IHeader::AxisMode

 IHeader Class Overview

BOOL GetAxisMode()	(for C/C++ only)

void SetAxisMode(BOOL)	(for C/C++ only)

BOOL AxisMode	(for VB only)

Equivalent to the AXISMODE setting in AutoCAD.  Axis on is nonzero.


IHeader::AxisUnit

 IHeader Class Overview

IVector GetAxisUnit()	(for C/C++ only)

void SetAxisUnit(IVector)	(for C/C++ only)

IVector AxisUnit	(for VB only)

Same as the AutoCAD AXISUNIT setting.  Axis X and Y tick spacing.


IHeader::BlipMode

 IHeader Class Overview

BOOL GetBlipMode()	(for C/C++ only)

void SetBlipMode(BOOL)	(for C/C++ only)

BOOL BlipMode	(for VB only)

Same as the AutoCAD BLIPMODE setting.  BlipMode is on if this is nonzero.


IHeader::CirclePrecision

 IHeader Class Overview

long GetCirclePrecision()	(for C/C++ only)

void SetCirclePrecision(long)	(for C/C++ only)

long CirclePrecision	(for VB only)

Similar to CIRCLERES AutoCAD setting.  Valid values are 1 to 20,000.  Default is 100.  Has to do with approximating a circle on the screen.


IHeader::CoordinateDisplay

 IHeader Class Overview

long GetCoordinateDisplay()	(for C/C++ only)

void SetCoordinateDisplay(long)	(for C/C++ only)

long CoordinateDisplay	(for VB only)

Same as the AutoCAD COORDS setting.

0 = static coordinate display,

1 = continuous update,

2 = “d<a” format


IHeader::CurrentElevation

 IHeader Class Overview

double GetCurrentElevation()	(for C/C++ only)

void SetCurrentElevation(double)	(for C/C++ only)

double CurrentElevation	(for VB only)

Affects the AutoCAD variable ELEVATION.  It’s the current 3D elevation relative to the current UCS.  This is used when drawing new objects.


IHeader::CurrentThickness

 IHeader Class Overview

double GetCurrentThickness()	(for C/C++ only)

void SetCurrentThickness(double)	(for C/C++ only)

double CurrentThickness	(for VB only)

Sets the current 3D thickness; used when drawing new objects.  Equivalent to the AutoCAD THICKNESS setting.


IHeader::DragMode

 IHeader Class Overview

long GetDragMode()	(for C/C++ only)

void SetDragMode(long)	(for C/C++ only)

long DragMode	(for VB only)

This is the AutoCAD DRAGMODE setting.  Sets object drag during editing operations.

0 = No Dragging

1 = On (if requested)

2 = Auto


IHeader::DrawingCodePage

 IHeader Class Overview

long GetDrawingCodePage()	(for C/C++ only)

void SetDrawingCodePage(long)	(for C/C++ only)

long DrawingCodePage	(for VB only)

Equivalent to the DWGCODEPAGE setting in AutoCAD.  Stores the drawing Code Page.


IHeader::FastZoom

 IHeader Class Overview

BOOL GetFastZoom()	(for C/C++ only)

void SetFastZoom(BOOL)	(for C/C++ only)

BOOL FastZoom	(for VB only)


IHeader::FillMode

 IHeader Class Overview

BOOL GetFillMode()	(for C/C++ only)

void SetFillMode(BOOL)	(for C/C++ only)

BOOL FillMode	(for VB only)


IHeader::FlatLand

 IHeader Class Overview

BOOL GetFlatLand()	(for C/C++ only)

void SetFlatLand(BOOL)	(for C/C++ only)

BOOL FlatLand	(for VB only)


IHeader::Handles

 IHeader Class Overview

BOOL GetHandles()	(for C/C++ only)

void SetHandles(BOOL)	(for C/C++ only)

BOOL Handles	(for VB only)

(Read-only)  If Handles is TRUE, all existing entities have a unique Handle and new entities are created using the next available handle (the HandleSeed variable).


IHeader::HandleSeed

 IHeader Class Overview

BSTR GetHandleSeed()	(for C/C++ only)

BSTR HandleSeed	(for VB only)

See Also:  IHeader::Handles


IHeader:: LimitsMax

IHeader:: LimitsMin

 IHeader Class Overview

IVector GetLimitsMax()	(for C/C++ only)

void SetLimitsMax(IVector)	(for C/C++ only)

IVector LimitsMax	(for VB only)

Same for:

IVector LimitsMin


IHeader:: LimitsCheck

 IHeader Class Overview

BOOL GetLimitsCheck()	(for C/C++ only)

void SetLimitsCheck(BOOL)	(for C/C++ only)

BOOL LimitsCheck	(for VB only)


IHeader::MaxActiveViewports

 IHeader Class Overview

long GetMaxActiveViewports()	(for C/C++ only)

void SetMaxActiveViewports(long)	(for C/C++ only)

long MaxActiveViewports	(for VB only)


IHeader:: MenuName

 IHeader Class Overview

double GetMenuName()	(for C/C++ only)

void SetMenuName(double)	(for C/C++ only)

double MenuName	(for VB only)


IHeader:: MirrorText

 IHeader Class Overview

double GetMirrorText()	(for C/C++ only)

void SetMirrorText(double)	(for C/C++ only)

double MirrorText	(for VB only)

Controls whether or not text is mirrored when a mirror command is executed.


IHeader:: PaperSpaceElevation

 IHeader Class Overview

double GetPaperSpaceElevation()	(for C/C++ only)

void SetPaperSpaceElevation(double)	(for C/C++ only)

double PaperSpaceElevation	(for VB only)

This is the elevation that new objects drawn in paperspace are drawn at.


IHeader:: PaperSpaceLimitsMax

IHeader:: PaperSpaceLimitsMin

 IHeader Class Overview

IVector GetPaperSpaceLimitsMax()	(for C/C++ only)

void SetPaperSpaceLimitsMax(IVector)	(for C/C++ only)

IVector PaperSpaceLimitsMax	(for VB only)

Same for:

IVector PaperSpaceLimitsMin


IHeader:: PaperSpaceLimitsCheck

 IHeader Class Overview

BOOL GetPaperSpaceLimitsCheck()	(for C/C++ only)

void SetPaperSpaceLimitsCheck(BOOL)	(for C/C++ only)

BOOL PaperSpaceLimitsCheck	(for VB only)


IHeader:: PolylineLinetypePattern

 IHeader Class Overview

long GetPolylineLinetypePattern()	(for C/C++ only)

void SetPolylineLinetypePattern(long)	(for C/C++ only)

long PolylineLinetypePattern	(for VB only)


IHeader:: PolylineWidth

 IHeader Class Overview

double GetPolylineWidth()	(for C/C++ only)

void SetPolylineWidth(double)	(for C/C++ only)

double PolylineWidth	(for VB only)

New polylines are drawn using this as the default width.


IHeader:: QuickText

 IHeader Class Overview

long GetQuickText()	(for C/C++ only)

void SetQuickText(long)	(for C/C++ only)

long QuickText	(for VB only)


IHeader:: RegenMode

 IHeader Class Overview

long GetRegenMode()	(for C/C++ only)

void SetRegenMode(long)	(for C/C++ only)

long RegenMode	(for VB only)


IHeader:: ShadeDiffuse

 IHeader Class Overview

long GetShadeDiffuse()	(for C/C++ only)

void SetShadeDiffuse(long)	(for C/C++ only)

long ShadeDiffuse	(for VB only)


IHeader:: ShadeEdge

 IHeader Class Overview

long GetShadeEdge()	(for C/C++ only)

void SetShadeEdge(long)	(for C/C++ only)

long ShadeEdge	(for VB only)


IHeader:: SketchIncrement

 IHeader Class Overview

double GetSketchIncrement()	(for C/C++ only)

void SetSketchIncrement(double)	(for C/C++ only)

double SketchIncrement	(for VB only)


IHeader:: SketchPolyline

 IHeader Class Overview

BOOL GetSketchPolyline()	(for C/C++ only)

void SetSketchPolyline(BOOL)	(for C/C++ only)

BOOL SketchPolyline	(for VB only)


IHeader:: SplineFrame

 IHeader Class Overview

long GetSplineFrame()	(for C/C++ only)

void SetSplineFrame(long)	(for C/C++ only)

long SplineFrame	(for VB only)


IHeader:: SplineSegments

 IHeader Class Overview

long GetSplineSegments()	(for C/C++ only)

void SetSplineSegments(long)	(for C/C++ only)

long SplineSegments	(for VB only)

When a spline is drawn, Vdraft approximates the spline by adding SplineSegments different segments between each control point.  This is the same as SPLINESEGS in AutoCAD.


IHeader:: SplineType

 IHeader Class Overview

long GetSplineType()	(for C/C++ only)

void SetSplineType(long)	(for C/C++ only)

long SplineType	(for VB only)

The is the type of spline to draw if you start drawing a spline without specifying which type.

5 - quadratic B-spline

6 - cubic B-spline


IHeader:: SurfaceDensityM

IHeader:: SurfaceDensityN

 IHeader Class Overview

long GetSurfaceDensityM()	(for C/C++ only)

void SetSurfaceDensityM(long)	(for C/C++ only)

long SurfaceDensityM	(for VB only)

Same for:

long SurfaceDensityN()


IHeader::SurfaceTabulations
IHeader:: SurfaceTabulations1, 2

 IHeader Class Overview

long GetSurfaceTabulations1()	(for C/C++ only)

void SetSurfaceTabulations1(long)	(for C/C++ only)

long SurfaceTabulations1	(for VB only)

Same for

SurfaceTabulations2()


IHeader:: SurfaceType

 IHeader Class Overview

long GetSurfaceType()	(for C/C++ only)

void SetSurfaceType(long)	(for C/C++ only)

long SurfaceType	(for VB only)


IHeader::TextSize

 IHeader Class Overview

double GetTextSize()	(for C/C++ only)

void SetTextSize(double)	(for C/C++ only)

double TextSize	(for VB only)


IHeader:: TraceSize

 IHeader Class Overview

double GetTraceSize()	(for C/C++ only)

void SetTraceSize(double)	(for C/C++ only)

double TraceSize	(for VB only)


IHeader:: TreeDepth

 IHeader Class Overview

long GetTreeDepth()	(for C/C++ only)

void SetTreeDepth(long)	(for C/C++ only)

long TreeDepth	(for VB only)


IHeader:: UCSIcon

 IHeader Class Overview

long GetUCSIcon()	(for C/C++ only)

void SetUCSIcon(long)	(for C/C++ only)

long UCSIcon	(for VB only)


IHeader:: UnitMode

 IHeader Class Overview

long GetUnitMode()	(for C/C++ only)

void SetUnitMode(long)	(for C/C++ only)

long UnitMode	(for VB only)


IHeader::UserInteger
IHeader:: UserInteger1 - 5

 IHeader Class Overview

long GetUserInteger1()	(for C/C++ only)

void SetUserInteger1(long)	(for C/C++ only)

long UserInteger1	(for VB only)

Same for:

long UserInteger2

long UserInteger3

long UserInteger4

long UserInteger5


IHeader:: UserReal
IHeader:: UserReal1 - 5

 IHeader Class Overview

long GetUserReal1()	(for C/C++ only)

void SetUserReal1(long)	(for C/C++ only)

long UserReal1	(for VB only)

Same for:

long UserReal2

long UserReal3

long UserReal4

long UserReal5


IHeader:: UserTimer

 IHeader Class Overview

BOOL GetUserTimer()	(for C/C++ only)

void SetUserTimer(BOOL)	(for C/C++ only)

BOOL UserTimer	(for VB only)

Turns on or off the user timer.  This value can be viewed in the Drawing Info dialog.


IHeader:: WorldView

 IHeader Class Overview

BOOL GetWorldView()	(for C/C++ only)

void SetWorldView(BOOL)	(for C/C++ only)

BOOL WorldView	(for VB only)


IVector

(Interface Overview)

 See Also

C++ Class Constructors:

IVector()

IVector(LPDISPATCH pDispatch)

IVector(const IVector& dispatchSrc)

IVector is two things: it is an object returned by some objects (the start and end points of a line, for instance, are IVector objects).  It is also an object you can simply create and use, making use of some of the vector functionality built into it.

IVector objects are frequently used to specify point data.  They are used as return values and as parameters to many function calls.  This is both because they are convenient for use this way (having x, y and z values in them).

Properties:

Application	(read-only)

Length	(read-only)

LengthSquared	(read-only)

Parent	(read-only)

X, Y, Z Components

Methods:

AddIn

CopyFrom

CrossProduct

Detach

Distance

DivideBy

DotProduct

Dump	default

MultiplyBy

Normalize

ScaleBy

Set

Set2D

Set3D

SubtractAway

Visual Basic Code Sample:

Set lyne = entities(1)

Set endpoint = lyne.EndPoint

Print endpoint	' prints the current endpoint even if the line has moved

endpoint.Set 1,2	' moves the endpoint

lyne.Update	' updates the display of the line on the screen

Set lyne = Nothing	' the tie between the line & vector is severed

endpoint.Set 2,1	' changes the vector but not the line


IVector::XYZ
IVector::  X, Y, Z Component Functions

 IVector Class Overview

double GetX()	(for C/C++ only)

void SetX(double)

double GetY()

void SetY(double)

double GetZ()

void SetZ(double)

double X	(for VB only)

double Y

double Z

Set and retrieve the X, Y and Z values of a given vector.

C/C++ Code Sample:

IVector Vec2( vdraft.CreateVector(cVariant(),cVariant(),cVariant()) ); //create a new vector

pVec2.Set3D(1.222, 3.0, 0.0);

IVector Vec3( vdraft.CreateVector(

cVariant(Vec2.GetX()),cVariant(Vec2.GetY()),cVariant(Vec2.GetZ())) );

Alternatively, the same code could be written like this:

IVector Vec2( vdraft.CreateVector(cVariant(1.222), cVariant(3.0), cVariant(0.0)) );

IVector Vec3( vdraft.CreateVector( cVariant(Vec2), cVariant(),cVariant() );


IVector::Length()
IVector::Length

 IVector Class Overview

 See Also

double GetLength()	(for C/C++ only)

double Length	(for VB only)

Returns the length of the given vector.

C/C++ Code Sample:

 	‘  given an existing vector pVec1…

double dLen = pVec1.GetLength();


IVector::Length2()
IVector::LengthSquared

 IVector Class Overview

 See Also

double GetLengthSquared()	(for C/C++ only)

double LengthSquared	(for VB only)

This returns the square of the length of the vector.

C/C++ Code Sample:

‘   given an existing vector pVec1…

double dLenSqrd = pVec1.GetLengthSquared();


IVector::CopyFrom()
IVector::CopyFrom

 IVector Class Overview

void CopyFrom(IVector vector)

Copy the values for this vector from the specified one.  Makes a copy of the values in the specified vector.


IVector::AddIn()
IVector::AddIn

 IVector Class Overview

void AddIn(IVector vector)

Adds the vector to the original object.

VB sample:

vec1 = vdraft.CreateVector 1,2,3

vec2 = vdraft.CreateVector 3,4,5

vec1.AddIn vec2	' vec1 is now 4,6,8


IVector::Detach()
IVector::Detach

 IVector Class Overview

void Detach()

This severs the link between the vector & where it came from.  For example, if you grabbed the center of the circle, any changes to the vector would change the circle.  After calling Detach, the circle will be unaffected by any changes to the vector.


IVector::SubtractAway()
IVector::SubtractAway

 IVector Class Overview

void SubtractAway(IVector vector)

Subtract a vector value from the current vector.


IVector::MultiplyBy()
IVector::MultiplyBy

 IVector Class Overview

void MultiplyBy(IVector vector)

Vector multiplication.  Multiplies this vector by the given vector.


IVector::DivideBy()
IVector::DivideBy

 IVector Class Overview

void DivideBy(IVector vector)

Vector division.  Divides this vector by the given vector.


IVector::ScaleBy()
IVector::ScaleBy

 IVector Class Overview

void ScaleBy(double factor)

Scales this vector by the given scalar amount.

C/C++ Code Sample:

// given an existing line object

IVector Start( Line.GetStartPoint() );

Start.ScaleBy(5.2);	// move the line’s endpoint out


IVector::Distance()
IVector::Distance

 IVector Class Overview

double GetDistance(IVector vector)	(for C/C++ only)

double Distance(IVector vector)	(for VB only)

Returns the distance between two vectors.


IVector::Normalize()
IVector::Normalize

 IVector Class Overview

BOOL Normalize()

Normalize the vector.  This divides the vector by its length, giving you a vector with a length of one that has the same direction as the original.

C/C++ Code Sample:

IVector Vec2;	// create a new vector

Vec2.Normalize();	// clear the vector


IVector::DotProduct()
IVector::DotProduct

 IVector Class Overview

double DotProduct(IVector vector)

Returns the dot product of this vector and the one passed in.

C/C++ Code Sample:

‘   given Vec1 as an existing IVector, (perhaps an

'    endpoint of some line in the current drawing)

Vec2.Set3D(3.5, 5.0, 0.0);

double dDot = Vec1.DotProduct(Vec2);


IVector::CrossProduct()
IVector::CrossProduct

 IVector Class Overview

IVectorCrossProduct(IVector vector)

Returns a vector containing the Cross Product of this vector and the one passed in as the parameter.


IVector::Set()
IVector::Set

 IVector Class Overview

 See Also

void Set(double x, double y, const VARIANT& z)

This sets the x, y and z values of the vector, all in one call.  For C++, it's easier to call Set2D or Set3D so that you don't need to pass the variant third parameter.

VB Sample:

vec.Set 1, 2

vec.Set 1, 2, 3


IVector::Set2D()
IVector::Set2D

 IVector Class Overview

 See Also

void Set2D(double x, double y)

This sets the x and y values only of the vector, all in one call.  If you do not need to set the Z component, then this function is simpler to use than IVector::Set().

VB Sample:

vec.Set 1, 2


IVector::Set3D()
IVector::Set3D

 IVector Class Overview

 See Also

void Set3D(double x, double y, double z)

This sets the x, y and z values of the vector, all in one call.  Under C++, if you are setting all three components (x, y and z) then this function will be easier to use than IVector::Set()

VB Sample:

vec.Set 1, 2, 3


IVector::Dump()
IVector::Dump

 IVector Class Overview

BSTR Dump()

A debug function, returns a string containing a “dump” of the vector’s contents.  Might return something like:  “10.0, 5.0, 12.2”


IVectors

(Interface Overview)

 See Also

C++ Class Constructors:

IVectors()

IVectors(LPDISPATCH pDispatch)

IVectors(const IVectors& dispatchSrc)

An IVectors object is a collection of IVector objects.  It would be returned, for example, by the Intersection method belonging to all entity objects (i.e., lines, circles, etc.).

Properties:

Application	(read-only)

Count	(read-only)

Item	(read-only)

Parent	(read-only)

Methods:

Add


IVectors::Add()
IVectors::Add

 IVectors Class Overview

void Add(IVector vec)

Adds a new IVector object to this collection of IVector objects.


IVectors::Count()
IVectors::Count

 IVectors Class Overview

long Count()	(for C/C++ only)

long Count	(for VB only)

Returns the number of vectors in this collection.  Each one in the collection is an IVector object.

Visual Basic Code Sample:

‘   given Veks, an IVectors object…

Dim Veq As Object

For I% = 1 To Veks.Count

Set Veq = Veks.Item(I%)

‘

‘   do something with the individual vector

‘

Next


IVectors::Item()
IVectors::Item

 IVectors Class Overview

IVector Item(long which)

(Read-Only)  Allows you to access a particular entry in this IVector collection.

Visual Basic Code Sample:

‘   given Veks, an IVectors object…

For I% = 1 To Veks.Count

Dim Veq As Object

Set Veq = Veks.Item(I%)

‘

‘   do something with the individual vector

‘

Next


IXData

(Interface Overview)

 See Also

C++ Class Constructors:

IXData()

IXData(LPDISPATCH pDispatch)

IXData(const IXData& dispatchSrc)

See Reading XData for sample code on reading and interpreting XData.

Available Interfaces:

Application	(read-only)

Parent	(read-only)

Add

AddApplicationID

Binary

Control

Double

FindApplicationID

Group	(read-only)

Handle

Index

Layer

Long

Next

Remove

Short

String

Type	(read-only)

Vector

Sample Visual Basic Sample Code:

The following code first makes sure that our application id, "MyApp", is added to the current drawing.  This is a necessary step for attaching xdata to an entity.  Then it sees if we've already attached xdata to this entity.  If so, it simply increments a counter we maintain in the entity.  If we haven't added xdata yet, we add a counter and a string.

Set doc = Vdraft.ActiveDocument

' first make sure our application name is registered in the drawing

 doc.ApplicationIDs.Add "MyApp"

' now get the xdata attached to the 1st entity in the drawing

Set ents = doc.Entities

Set entity = ents(1)

Set data = entity.XData

If data.FindApplicationID("MyApp") Then

    ' xdata is now positioned at our application id

    data.Next   ' step past the application id

    ' increment our counter

    If data.Group = 1070 Then

        data.Short = data.Short + 1

    End If

Else

    ' add our info

    data.AddApplicationID "MyApp"

    data.Add 1070, 1

    data.Add 1000, "This is a string"

End If


IXData::Group()
IXData::Group

 IXData Class Overview

short GetGroup()	(for C/C++ only)

Group	(for VB only)

Returns the group code for this XData item.  See DXF Codes for more information on the group codes and what they mean.  You can also refer to AutoCAD documentation concerning XData.


IXData::Type()
IXData::Type

 IXData Class Overview

veXDataType GetType()	(for C/C++ only)

veXDataType Type	(for VB only)

Read-only.  Returns the type that this XData item is.  This could be:

String	veXDT_String
Control	veXDT_Control
Layer	veXDT_Layer
Raw data	veXDT_RawData
Handle (i.e., entity handle)	veXDT_Handle
Vector	veXDT_Vector
Short	veXDT_Short
Long	veXDT_Long


IXData::Index()
IXData::Index

 IXData Class Overview

short GetIndex()	(for C/C++ only)

void  SetIndex(short )	(for C/C++ only)

short Index	(for VB only)

Your index in the entity’s xdata list.  Next also moves to the next one.


IXData::String()
IXData::String

 IXData Class Overview

BSTR GetString()	(for C/C++ Only)

void SetString(BSTR)	(for C/C++ Only)

BSTR String	(for VB Only)

Get or set the XData item as a string value if type is veXDT_String.


IXData::Control()
IXData::Control

 IXData Class Overview

BOOL GetControl()	(for C/C++ only)

void SetControl(BOOL)	(for C/C++ only)

BOOL Control	(for VB only)

Get or set the XData item control value if type is veXDT_Control.  This data type is used in structuring XData.  It’s stored as an open or close brace (i.e, "{" and "}").


IXData::Layer()
IXData::Layer

 IXData Class Overview

ILayer GetLayer()	(for C/C++ only)

void SetLayer(ILayer lyr)	(for C/C++ only)

ILayer Layer	(for VB only)

Get or set the XData item as a ILayer if type is veXDT_Layer.


IXData::Binary()
IXData::Binary

 IXData Class Overview

IBinary GetBinary()	(for C/C++ only)

void SetBinary(IBinary bin)	(for C/C++ only)

Binary(IBinary bin)	(for VB only)

Set or retrieve the XData item as binary data.

[Not yet implemented]


IXData::Handle()
IXData::Handle

 IXData Class Overview

BSTR GetHandle()	(for C/C++ only)

void SetHandle(BSTR str)	(for C/C++ only)

BSTR Handle	(for VB only)

Set or get the XData item as an entity handle if type is veXDT_Handle.


IXData::Vector()
IXData::Vector

 IXData Class Overview

IVector GetVector()	(for C/C++ only)

void SetVector(IVector vec)	(for C/C++ only)

Vector(IVector vec)	(for VB only)

Set or get the XData item as a Vector data object if type is veXDT_Vector.


IXData::Double()
IXData::Double

 IXData Class Overview

double GetDouble()	(for C/C++ only)

void SetDouble(double)	(for C/C++ only)

double Double	(for VB only)

Set or Get the XData item as a double floating point value.


IXData::Short()
IXData::Short

 IXData Class Overview

short GetShort()	(for C/C++ only)

void SetShort(short)	(for C/C++ only)

short Short	(for VB only)

Set or get the XData item as a short integer value if type is veXDT_Short.


IXData::Long()
IXData::Long

 IXData Class Overview

long GetLong()	(for C/C++ only)

void SetLong(long)	(for C/C++ only)

long Long	(for VB only)

Set or get the XData item as a long integer value if type is veXDT_Long.


IXData::Next()
IXData::Next

 IXData Class Overview

BOOL Next()

Move to the next XData item for this entity.


IXData::Add()
IXData::Add

 IXData Class Overview

BOOL Add(short Group, const VARIANT& data)

Add a new XData item for the given entity.

Group is the DXF group code.

Data is the data you wish to store in this XData item.  See cVariant for easy handling of the VARIANT parameter for C++.


IXData::AddApplicationID()
IXData::AddApplicationID

 IXData Class Overview

BOOL AddApplicationID(BSTR)	(read-only)

Allows you to add you ApplicationID string to an entity’s XData.  Essentially the same thing as a call to IXData.Add(1001, <id>).


IXData::Remove()
IXData::Remove

 IXData Class Overview

BOOL Remove()

Removes the current group/data pair of XData.


IXData::FindApplicationID

 IXData Class Overview

 See Also

BOOL FindApplicationID(BSTR appname)

Will locate the given application ID in the entity's XData, if any exists for that entity.  If the requested ID does not exist, it simply returns False, as in the example below.  This is useful for finding your applications’s XData on a particular entity.  Remember that there may be other XData on this entity than yours.

Visual Basic Code Sample:

The following command typed in from VB’s debug window (with Vdraft hooked up and all) will return False, unless you have actually registered an application ID “MyApp”.

?Vdraft.ActiveDocument.Entities.Item(1).Xdata.FindApplicationID ("MyApp")


ILine

(Interface Overview)

C++ Class Constructors:

ILine()

ILine(LPDISPATCH pDispatch)

ILine(const ILine& dispatchSrc)

The ILine class has to do with lines in a drawing.  Creating them, fetching them, changing them, counting them: anything you might want to do with a line.

Available Interfaces:

Application	(read-only)

Parent	(read-only)

APIs Common to All Entity Interfaces

EndPoint

Length	(read-only)

StartPoint

C/C++ Code Sample:

This sample shows a simple example of using the various interfaces to this entity.  The sample function takes an LPDISPATCH, a pointer to a dispatch handle.  This dispatch handle might, for example, have been retrieved using Vdraft’s IEntities.Item() method, or by having created the entity using the Add or Draw methods belonging to IEntities.

void DoLine(ILine& line)

{

ILine lyn(idisp);	// create an ILine object from the dispatch

if (lyn.Type() != veET_Line)	// be sure it’s really a line entity

return;	// it’s not a line!

IVector startpt( entity.GetStartPoint() );	// get the start point

lyn.SetStartPoint( startpt );	// set the start point

CString sVal = startpt..Dump();	// get the start point as a string

IVector endpt( entity.GetEndPoint() );	// get the end point

lyn.SetWhere2( endpt );	// set the end point

sVal = endpt.Dump();	// a “string” version of the point

double dVal = entity.GetLength();	// Length is read-only

}


ILine::StartPoint()
ILine::StartPoint

 Line Class Overview

IVector GetStartPoint()	(for C/C++ only)

IVector SetEndPoint()

IVector StartPoint	(for VB only)

This gets and sets the end point of the given line.

Note that this is the actual end point of the line.  If you modify the values of this vector, the line will be modified.  For example, to change the start point of a line, you might use GetStartPoint() to obtain the present values of the start point, then change the value of the vector thereby changing the start point of the line.


ILine::EndPoint()
ILine::EndPoint

 Line Class Overview

IVector GetStartPoint()	(for C/C++ only)

IVector SetEndPoint()

IVector StartPoint	(for VB only)

This gets or sets start point for the given line.

Note that this is the actual end point of the line.  If you modify the values of this vector, the line will be modified.  For example, to change the start point of a line, you might use GetEndPoint() to obtain the present values of the end point, then change the value of the vector thereby changing the end point of the line.


ILine:: Length()
ILine::Length

 Line Class Overview

double GetLength()	(for C/C++ Only)

double Length	(for VB Only)

Returns the length of the given line.

Visual Basic Code Sample:

‘    Visual Basic Example

Dim Vdraft As Object

Set Vdraft = CreateObject(“Vdraft.Application”)

Dim Lyn As Object

Lyn = Vdraft.ActiveDocument.Entities.AddLine()

Dim Len As Double

Len = Lyn.Length()

C/C++ Code Sample:

‘ C/C++ Example

‘ given an existing ILine object, Lyn

double dLen = Lyn.GetLength();


IDimension

(Interface Overview)

C++ Class Constructors:

IDimension()

IDimension(LPDISPATCH pDispatch)

IDimension(const IDimension& dispatchSrc)

Available Interfaces:

Application	(read-only)

Parent	(read-only)

APIs Common to All Entity Interfaces

Angle

Dxf10

Dxf11

Dxf12

Dxf13

Dxf14

Dxf15

Dxf16

HorizontalAngle

LeaderLength

Oblique

Style

String

TextAngle

IDimension is a collection of routines meant to give basic, somewhat generic access to Dimension entities.  This group will probably be expaned in the future to give more specific access to definite dimension types.  In the mean time, it’s really all here, particularly in the DXF codes.


IDimension::Angle

 Dimension Class Overview

double GetAngle(double)	(for C/C++ only)

void SetAngle()	(for C/C++ only)

double Angle	(for VB only)


IDimension::Dxf10

 Dimension Class Overview

IVector GetDxf10()	(for C/C++ only)

void SetDxf10(IVector)	(for C/C++ only)

IVector Dxf10	(for VB only)

C/C++ Code Sample:

//  given DimObj, a dimension object in the current drawing…

   double dVal = DimObj.GetAngle();

    DimObj.SetAngle(1.4159);	// set the angle

    IVector dxf10( DimObj.GetDxf10() );

//

//  do whatever with the data...

//

    DimObj.SetDxf10( dxf10 );

    CString sVal = dxf10.Dump();


IDimension::Dxf11

 Dimension Class Overview

IVector GetDxf11()	(for C/C++ only)

void SetDxf11(IVector vek)	(for C/C++ only)

IVector Dxf11	(for VB only)

See IDimension::Dxf10 for sample code.


IDimension::Dxf12

 Dimension Class Overview

IVector GetDxf12()	(for C/C++ only)

void SetDxf12(IVector)	(for C/C++ only)

IVector Dxf12	(for VB only)

See IDimension::Dxf10 for sample code.


IDimension::Dxf13

 Dimension Class Overview

IVector GetDxf13()	(for C/C++ only)

void SetDxf13(IVector vek)	(for C/C++ only)

IVector Dxf13	(for VB only)

See IDimension::Dxf10 for sample code.


IDimension::Dxf14

 Dimension Class Overview

IVector GetDxf14()	(for C/C++ only)

void SetDxf14(IVector vek)	(for C/C++ only)

IVector Dxf14	(for VB only)

See IDimension::Dxf10 for sample code.


IDimension::Dxf15

 Dimension Class Overview

IVector GetDxf15()	(for C/C++ only)

void SetDxf15(IVector vek)	(for C/C++ only)

IVector Dxf15	(for VB only)

See IDimension::Dxf10 for sample code.


IDimension::Dxf16

 Dimension Class Overview

IVector GetDxf16()	(for C/C++ only)

void SetDxf16(IVector vek)	(for C/C++ only)

IVector Dxf16	(for VB only)

See IDimension::Dxf10 for sample code.


IDimension::HorizontalAngle

 Dimension Class Overview

double GetHorizontalAngle()	(for C/C++ only)

void SetHorizontalAngle(double ang)	(for C/C++ only)

double HorizontalAngle	(for VB only)

See IDimension::Dxf10 for sample code.


IDimension::LeaderLength

 Dimension Class Overview

double GetLeaderLength()	(for C/C++ only)

vodi SetLeaderLength(double len)	(for C/C++ only)

double LeaderLength	(for VB only)


IDimension::Oblique

 Dimension Class Overview

double GetOblique()	(for C/C++ only)

void SetOblique(double obl)	(for C/C++ only)

double Oblique	(for VB only)


IDimension::Style

 Dimension Class Overview

IDimStyle Style()	(for C/C++ only)

void Style(IDimStyle sty)	(for C/C++ only)

IDimStyle Style	(for VB only)


IDimension::String

 Dimension Class Overview

BSTR String()	(for C/C++ only)

void SetString;(BSTR str)	(for C/C++ only)

BSTR String	(for VB only)


IDimension::TextAngle

 Dimension Class Overview

double GetTextAngle()	(for C/C++ only)

void SetTextAngle(double ang)	(for C/C++ only)

double TextAngle	(for VB only)


IPoint

(Interface Overview)

C++ Class Constructors:

IPoint()

IPoint(LPDISPATCH pDispatch)

IPoint(const IPoint& dispatchSrc)

Available Interfaces:

Application	(read-only)

Parent	(read-only)

APIs Common to All Entity Interfaces

Rotation

Where

C/C++ Code Sample:

This sample shows a simple example of using the various interfaces to this entity.  The sample function takes an LPDISPATCH, a pointer to a dispatch handle.  This dispatch handle might, for example, have been retrieved using Vdraft’s IEntities.Item() method, or by having created the entity using the Add or Draw methods belonging to IEntities..

void DoPoint(IPoint& entity)

{

IVector where( entity.GetWhere() );	// get the coordinates of the point

entity.SetWhere( where );	// set the coordinates of the point

CString sVal = where.Dump();	// string version of the coordinates

double dVal = entity.GetRotation();	// get the rotation for the point

entity.SetRotation(dVal);	// set the rotation for the point

}


IPoint::Where()
IPoint::Where

 Point Class Overview

IVector GetWhere()	(for C/C++ only)

void SetWhere(IVector)	(for C/C++ only)

IVector Where	(for VB only)

For retrieving or setting the coordinates of the point.  GetWhere() returns an IVector object containing the location of the point.  Changing the vector returned by Where changes the point.

For example, in C/C++, where “pt” is an already existing IPoint object:

IVector vec = pt.GetWhere();

vec.SetX( vec.GetX() *2.0);


IPoint::Rotation()
IPoint::Rotation

 Point Class Overview

double GetRotation()	(for C/C++ only)

void SetRotation(double)	(for C/C++ only)

double Rotation	(for VB only)

Points have a rotation value, to assist in displaying them in some of their alternate formats, such as cross hairs, bulls-eye, etc.  The rotation gives a starting point for such alignment.


ICircle

(Interface Overview)

C++ Class Constructors:

ICircle()

ICircle(LPDISPATCH pDispatch)

ICircle(const ICircle& dispatchSrc)

Available Interfaces:

Application	(read-only)

Parent	(read-only)

APIs Common to All Entity Interfaces

Area	(read-only)

Center

Circumference	(read-only)

Radius

Where

C/C++ Code Sample:

This sample shows a simple example of using the various interfaces to this entity.  The sample function takes an LPDISPATCH, a pointer to a dispatch handle.  This dispatch handle might, for example, have been retrieved using Vdraft’s IEntities.Item() method, or by having created the entity using the Add or Draw methods belonging to IEntities.

void DoCircle(ICircle& entity)

{

if (entity.Type() != veET_Circle)	// be sure it’s really a circle

return;	// it’s not a circle

IVector cntr( entity.GetCenter() );	// get the center point for the circle

entity.SetCenter( cntr );	// set the center point

CString prop_str = where.Dump();	// get point as a string

double prop_double = entity.GetRadius();	// get the radius

entity.SetRadius(prop_double);	// set the radius

prop_double = entity.GetCircumference();	// Circumference readonly

prop_double = entity.GetArea();	// Area readonly

}


ICircle::Center()
ICircle::Center

 Circle Class Overview

void SetCenter(IVector)	(for C/C++ only)

IVector GetCenter()	(for C/C++ only)

IVector Center	(for VB only)

Set or get the center point for the circle, the circle’s coordinates.

See Also ICircle::Where


ICircle::Radius()
ICircle::Radius

 Circle Class Overview

double GetRadius()	(for C/C++ only)

double Radius	(for VB only)

Sets and gets the radius of the circle.


ICircle::Circumference()
ICircle::Circumference

 Circle Class Overview

double GetCircumference()	(for C/C++ Only)

double Circumference	(for VB Only)

(read-only).  Returns the circle’s circumference.  To alter it, you would to alter the circle’s radius instead.


ICircle::Area()
ICircle::Area

 Circle Class Overview

double GetArea()	(for C/C++ only)

double Area	(for VB only)

Returns the area of the circle.  To alter it, you would to alter the circle’s radius instead.


ICircle::Where()
ICircle::Where

 Circle Class Overview

void SetWhere(IVector)	(for C/C++ only)

IVector GetWhere(void)	(for C/C++ only)

Where(void)	(for VB only)

Set or get the center point for the circle, the circle’s coordinates.

See Also ICircle::Center


IShape

(Interface Overview)

C++ Class Constructors:

IShape()

IShape(LPDISPATCH pDispatch)

IShape(const IShape& dispatchSrc)

Available Interfaces:

Application	(read-only)

Parent	(read-only)

APIs Common to All Entity Interfaces

Rotation

ShapeName

ShapeNumber

Size

Style

Where

XScaling

C/C++ Code Sample:

This sample shows a simple example of using the various interfaces to this entity

void DoShape(IShape& entity)

{

if (entity.Type() != veET_Shape)	// make sure it’s really shape

return;	// it’s not a shape

IVector where( entity.GetWhere() );	// get the coordinates of shape

entity.SetWhere( where );	// set the coordiantes

CString prop_str = where.Dump();	// show coordinates as a string

prop_str = entity.GetShapeName();	// get the shape’s name

entity.SetShapeName(prop_str);	// set the shape’s name

int prop_int = entity.GetShapeNumber();	// get the shape’s number

entity.SetShapeNumber(prop_int);	// set the shape’s number

double prop_double = entity.GetRotation();	// get the shape’s rotation

entity.SetRotation(prop_double);	// set the shape’s rotation

prop_double = entity.GetSize();	// get the size of the shape

entity.SetSize(prop_double);	// set the shape’s size

ITextStyle style( entity.GetStyle() );	// get the shape’s text style

entity.SetStyle(style);	// set the shape’s text style

prop_str = style.GetName();	// the text style’s name

prop_double = entity.GetXScaling();	// get the shape’s X Scaling

entity.SetXScaling(prop_double);	// set the shape’s X Scaling

}


IShape::Where()
IShape::Where

 IShape Class Overview

IVector GetWhere()	(for C/C++ only)

void SetWhere(IVector)	(for C/C++ only)

IVector Where	(for VB only)

The location of the shape.  It returns an IVector object.


IShape::ShapeName()
IShape::ShapeName

 IShape Class Overview

BSTR GetShapeName()	(for C/C++ only)

void SetShapeName(BSTR)	(for C/C++ only)

BSTR ShapeName	(for VB only)

Set or get the shape name.


IShape::ShapeNumber()
IShape::ShapeNumber

 IShape Class Overview

short GetShapeNumber()	(for C/C++ only)

void SetShapeNumber(short)	(for C/C++ only)

short ShapeNumber 	(for VB only)

Set or get the shape number.


IShape::Rotation()
IShape::Rotation

 IShape Class Overview

double GetRotation()	(for C/C++ only)

void SetRotation(double)	(for C/C++ only)

double Rotation	(for VB only)

Set or get the rotation (in radians) for the shape.


IShape::Size()
IShape::Size

 IShape Class Overview

double GetSize()	(for C/C++ only)

void SetSize(double)	(for C/C++ only)

double Size	(for VB only)

Set or get the size of the shape.


IShape::Style()
IShape::Style

 IShape Class Overview

ITextStyle GetStyle()	(for C/C++ only)

void SetStyle(ITextStyle)	(for C/C++ only)

ITextStyle Style	(for VB only)

Set or get the text style associated with the shape.


IShape::XScaling()
IShape::XScaling

 IShape Class Overview

double GetXScaling()	(for C/C++ only)

void SetXScaling(double)	(for C/C++ only)

double XScaling	(for VB only)

Set or get the X scaling for the shape.


IArc

(Interface Overview)

C++ Class Constructors:

IArc()

IArc(LPDISPATCH pDispatch)

IArc(const IArc& dispatchSrc)

Available Interfaces:

Application	(read-only)

Parent	(read-only)

APIs Common to All Entity Interfaces

Center

ChordedArea	(read-only)

EndAngle

EndPoint	(read-only)

Length	(read-only)

PieArea	(read-only)

Radius

StartAngle

StartPoint	(read-only)

Where

C/C++ Code Sample:

This sample shows a simple example of using the various interfaces to this entity.  The sample function takes an LPDISPATCH, a pointer to a dispatch handle.  This dispatch handle might, for example, have been retrieved using Vdraft’s IEntities.Item() method, or by having created the entity using the Add or Draw methods belonging to IEntities.

void DoArc(IArc& entity)

{

if (entity.Type() != veET_Arc)	// is it really an Arc?

return;	// no: it’s not an arc

IVector where( entity.GetCenter() );

entity.SetCenter( where );

CString prop_str = where.Dump();

double prop_double = entity.GetRadius();

entity.SetRadius(prop_double);

prop_double = entity.GetStartAngle();

entity.SetStartAngle(prop_double);

prop_double = entity.GetEndAngle();

entity.SetEndAngle(prop_double);

prop_double = entity.GetLength();	// Length is read-only

prop_double = entity.GetChordedArea();	// Chorded Area is read-only

prop_double = entity.GetPieArea();

IVector startpt( entity.GetStartPoint() );	// Where1 is read-only

prop_str = startpt.Dump();

IVector endpt( entity.GetEndPoint() );	// Where1 is read-only

prop_str = endpt.Dump();

}


IArc::Center()
IArc::Center

 IArc Class Overview

IVector GetCenter()	(for C/C++ only)

void SetCenter(IVector)	(for C/C++ only)

IVector Where	(for VB only)

Sets or gets the center point of the arc, the point.  Alternative for IArc:Where.

See Also: IArc::Where


IArc::Where()
IArc::Where

 IArc Class Overview

IVector GetWhere()	(for C/C++ only)

void SetWhere(IVector)	(for C/C++ only)

IVector Where	(for VB only)

Sets or gets the center point of the arc, the point.

See Also: IArc::Center


IArc::Radius()
IArc::Radius

 IArc Class Overview

double GetRadius()	(for C/C++ only)

void SetRadius(double)	(for C/C++ only)

double Radius	(for VB only)

Gets or sets the radius for the arc.


IArc::StartPoint()
IArc::StartPoint

 IArc Class Overview

double GetStartPoint()	(for C/C++ only)

double  StartPoint	(for VB only)

Read-Only  The starting point of the arc.


IArc::StartAngle()
IArc::StartAngle

 IArc Class Overview

double GetStartAngle()	(for C/C++ only)

void SetStartAngle(double)	(for C/C++ only)

double  StartAngle	(for VB only)

Gets or sets the starting point for the arc in terms of the angle from the currently defined base point.  Angles are specified in radians.


IArc::EndAngle()
IArc::EndAngle

 IArc Class Overview

double GetEndAngle()	(for C/C++ only)

void SetEndAngle(double)	(for C/C++ only)

double EndAngle	(for VB only)

Gets or sets the ending point for the arc in terms of the angle from the currently defined base point.  Angles are specified in radians.  This is relative to the base angle, or the same angle that start angle is relative to.


IArc::EndPoint()
IArc::EndPoint

 IArc Class Overview

double GetEndPoint()	(for C/C++ only)

double EndPoint	(for VB only)

Read-Only  Get the end point of the arc.


IArc::Length()
IArc::Length

 IArc Class Overview

double GetLength()	(for C/C++ only)

double Length	(for VB only)

Read-Only.  Returns the length of the given arc.


IArc::ChordedArea()
IArc::ChordedArea

 IArc Class Overview

double GetChordedArea	(for C/C++ only)

double ChordedArea	(for VB only)

Read-Only.  Returns the area defined by the given arc.


IArc::PieArea()
IArc::PieArea

 IArc Class Overview

double GetPieArea()	(for C/C++ only)

double PieArea	(for VB only)

Read-Only.  Returns the area defined by the arc as if it was defining a wedge of pie in a complete circle.


ISolid

(Interface Overview)

C++ Class Constructors:

ISolid()

ISolid(LPDISPATCH pDispatch)

ISolid(const ISolid& dispatchSrc)

Available Interfaces:

Application	(read-only)

Parent	(read-only)

APIs Common to All Entity Interfaces

Area	(read-only)

Circumference	(read-only)

Where

C/C++ Code Sample:

This sample shows a simple example of using the various interfaces to this entity.  The sample function takes an LPDISPATCH, a pointer to a dispatch handle.  This dispatch handle might, for example, have been retrieved using Vdraft’s IEntities.Item() method, or by having created the entity using the Add or Draw methods belonging to IEntities.

void DoSolid(ISolid& entity)

{

    if (entity.Type() != veET_Solid)	// is it really a Solid?

        return;	// no: quit

    double prop_double = entity.GetCircumference();

    prop_double = entity.GetArea();

//    get/set each of the corners, one by one

    for (int i = 1; i <= 4; i++)

    {

        IVector where = entity.GetWhere(cVariant(i));

        entity.SetWhere(cVariant(i), where);

        CString dmp = where.Dump();

    }

}


ISolid::Area()
ISolid::Area

 ISolid Class Overview

double GetArea()	(for C/C++ Only)

double Area	(for VB Only)

Read-Only.  Returns the area defined by the solid.


ISolid::Circumference()
ISolid::Circumference

 ISolid Class Overview

double GetCircumference()	(for C/C++ only)

double Circumference	(for VB only)

Read-Only.  Returns the circumference of the solid.


ISolid::Where()
ISolid::Where

 ISolid Class Overview

IVector GetWhere(short which)	(for C/C++ only)

void SetWhere(short which, IVector newValue)	(for C/C++ only)

IVector Where(short which)	(for VB only)

The location of the Solid, it’s coordinates.  Returns an IVector object.  There are four vertices that make up a solid; they are reference via the “which” parameter, as 1, 2, 3, or 4.


ITrace

(Interface Overview)

C++ Class Constructors:

ITrace()

ITrace(LPDISPATCH pDispatch)

ITrace(const ITrace& dispatchSrc)

Available Interfaces:

Application	(read-only)

Parent	(read-only)

APIs Common to All Entity Interfaces

Area

Circumference

Where

C/C++ Code Sample:

This sample shows a simple example of using the various interfaces to this entity.

void DoTrace(ITrace& entity)

{

    if (entity.Type() != veET_Trace)	// be sure it’s really a trace

        return;	// it’s not really a trace, quit

    prop_double = entity.GetCircumference();	// Circumference read-only

    prop_double = entity.GetArea();	// Area is read-only

    for (int i = 1; i <= 4; i++)

    {

        IVector where = entity.GetWhere(cVariant(i));

        entity.SetWhere(cVariant(i), where);

        CString dmp = where.Dump();

    }

}


ITrace::Area()
ITrace::Area

 ITrace Class Overview

double GetArea()	(for C/C++ Only)

double Area	(for VB Only)

Read-Only.  Returns the area of the trace.


ITrace::Circumference()
ITrace::Circumference

 ITrace Class Overview

double GetCircumference()	(for C/C++ Only)

double Circumference	(for VB Only)

Read-Only.  Returns the circumference of the trace.


ITrace::Where()
ITrace::Where

 ITrace Class Overview

IVector GetWhere(short which)	(for C/C++ only)

void SetWhere(short Which, IVector)	(for C/C++ only)

IVector Where	(for VB only)

The coordinates of the Trace.  Returns an IVector object.

Visual Basic Code Sample:

Dim Trace As Object

Set Trace = Vdraft.ActiveDocument.Entnties.AddTrace()

Trace.Where(1).Set 0,0

Trace.Where(2).Set 0,3

Trace.Where(3).Set 5,3

Trace.Where(4).Set 7,1

Set Trace = Nothing

If this is a subroutine then as soon as the subroutine returns, the object goes out of scope and it is updated in the drawing automatically.  Alternatively, as soon as Trace is set to Nothing, it will update automatically and the object appear on the screen.  You can also call the Update method on the object to explicitly cause it to update itself immediately, should you have need for that but yet not want to let the object go.  Alternatively, as soon as the Trace variable goes out of scope it will cause an update automatically


IFace

(Interface Overview)

C++ Class Constructors:

IFace()

IFace(LPDISPATCH pDispatch)

IFace(const IFace& dispatchSrc)

Available Interfaces:

Application	(read-only)

Parent	(read-only)

APIs Common to All Entity Interfaces

Area	(read-only)

Circumference	(read-only)

Visible

Where

C/C++ Code Sample:

void Test3DFace(IFace& entity)

{

    if (entity.Type() != veET_3DFace)	// is it really a Face?

        return;	// no: quit

    double dbl = entity.GetCircumference();	// Circumference readonly

    dbl = entity.GetArea();	// Area readonly

    for (int i = 1; i <= 4; i++)

    {

        IVector where = entity.GetWhere(cVariant(i));

        entity.SetWhere(cVariant(i), where);

        CString prop_str = where.Dump();

    }

}


IFace::Circumference()
IFace::Circumference

 IFace Class Overview

double GetCircumference()	(for C/C++ only)

double Circumference	(for VB only)

Returns the circumference around the given face.


IFace::Area()
IFace::Area

 IFace Class Overview

double GetArea()	(for C/C++ only)

double Area	(for VB only)

Returns the area defined by the given face.


IFace::Where()
IFace::Where

 IFace Class Overview

IVector GetWhere(short which)	(for C/C++ only)

void SetWhere(short which, IVector newValue)	(for C/C++ only)

IVector Where(short which)	(for VB only)

Retrieves the vertex points for the face.  A face consists of four points in space.

Visual Basic Code Sample:

Dim Face As Object

Set Face = Vdraft.ActiveDocument.Entnties.AddFace()

Face.Where(1).Set 0,0,0

Face.Where(2).Set 0,3,0

Face.Where(3).Set 5,3,0

Face.Where(4).Set 7,1,0

Set Face = Nothing

As soon as Face is set the Nothing, it will update itself automatically on the screen.  Note that the Z parameter, supplied in the above example, is optional under VB.

C/C++ Code Sample:

//   assume that iDoc already points to the drawing we are working with

//   assume that iVdraft already points to the application

IEntities iEnts(iDocGetEntities());

IFace face( iEnts.AddFace() );

face.SetWhere(1, iVdraft.NewVector(cVariant(0), cVariant(0), cVariant(0) ));

face.Update();	// or wait for face to go out of scope


IFace::Visible()
IFace::Visible

 IFace Class Overview

BOOL GetVisible(short which)	(for C/C++ only)

void SetVisible(short which, BOOL bNewValue)	(for C/C++ only)

BOOL Visible(short which)	(for VB only)

Determines whether this edge of the face is visible or invisible.


IInsert

(Interface Overview)

 See Also

C++ Class Constructors:

IInsert()

IInsert(LPDISPATCH pDispatch)

IInsert(const IInsert& dispatchSrc)

An insert is an insertion or an instance of a block.

Available Interfaces:

Application	(read-only)

Parent	(read-only)

APIs Common to All Entity Interfaces

Attributes	(read-only)

Block	(read-only)

Columns

ColumnSpacing

HasAttributes	(read-only)

Rotation

Rows

RowSpacing

Scaling

Where

C/C++ Code Sample:

This sample shows a simple example of using the various interfaces to this entity.  The sample function takes an LPDISPATCH, a pointer to a dispatch handle.  This dispatch handle might, for example, have been retrieved using Vdraft’s IEntities.Item() method, or by having created the entity using the Add or Draw methods belonging to IEntities.

void DoInsert(IInsert& entity)

{

    if (entity.Type() != veET_Insert)	// is it really an insert?

        return;	// not an insert; quit out of here

    IBlock block (entity.GetBlock() );

    CString prop_str = block.GetName();

    IVector where( entity.GetWhere() );

    entity.SetWhere( where );

    prop_str = where.Dump();

    IVector scaling( entity.GetScaling() );

    entity.SetScaling( scaling );

    prop_str = scaling.Dump();

    double prop_double = entity.GetRotation();

    entity.SetRotation(prop_double);

    int prop_int = entity.GetColumns();

    entity.SetColumns(prop_int);

    prop_double = entity.GetColumnSpacing();

    entity.SetColumnSpacing(prop_double);

    prop_int = entity.GetRows();

    entity.SetRows(prop_int);

    prop_double = entity.GetRowSpacing();

    entity.SetRowSpacing(prop_double);

    if ( entity.GetHasAttributes() )

        TestAttributes( entity.GetAttributes() );

}


IInsert::Block()
IInsert::Block

 IInsert Class Overview

 See Also

IBlock GetBlock()	(for C/C++ Only)

IBlock Block	(for VB Only)

Returns the block object that this is an insertion of.


IInsert::Attributes()
IInsert::Attributes

 IInsert Class Overview

IAttributes GetAttributes()	(for C/C++ Only)

IAttributes Attributes	(for VB Only)


IInsert::HasAttributes()
IInsert::HasAttributes

 IInsert Class Overview

BOOL HasAttributes()	(for C/C++ Only)

BOOL HasAttributes	(for VB Only)


IInsert::Where()
IInsert::Where

 IInsert Class Overview

IVector GetWhere()	(for C/C++ only)

void SetWhere(IVector vec)	(for C/C++ only)

IVector Where	(for VB only)

Retrieves or sets the insertion point for the given block insert.


IInsert::Scaling()
IInsert::Scaling

 IInsert Class Overview

IVector GetScaling()	(for C/C++ only)

void SetScaling(IVector vec)	(for C/C++ only)

IVector Scaling	(for VB only)

Returns a vector, three doubles showing the X, Y and Z scaling.


IInsert::Rotation()
IInsert::Rotation

 IInsert Class Overview

double GetRotation()	(for C/C++ only)

void SetRotation(double)	(for C/C++ only)

double Rotation	(for VB only)


IInsert::Columns()
IInsert::Columns

 IInsert Class Overview

short GetColumns()	(for C/C++ only)

void SetColumns(short)	(for C/C++ only)

short Columns	(for VB only)


IInsert::Rows()
IInsert::Rows

 IInsert Class Overview

short GetRows()	(for C/C++ only)

void SetRows(short)	(for C/C++ only)

short Rows	(for VB only)


IInsert::ColumnSpacing()
IInsert::ColumnSpacing

 IInsert Class Overview

double GetColumnSpacing()	(for C/C++ only)

void SetColumnSpacing(double)	(for C/C++ only)

double ColumnSpacing	(for VB only)


IInsert::RowSpacing()
IInsert::RowSpacing

 IInsert Class Overview

double GetRowSpacing()	(for C/C++ only)

void SetRowSpacing(double)	(for C/C++ only)

double RowSpacing	(for VB only)


IText

(Interface Overview)

C++ Class Constructors:

IText()

IText(LPDISPATCH pDispatch)

IText(const IText& dispatchSrc)

Available Interfaces:

Application	(read-only)

Parent	(read-only)

APIs Common to All Entity Interfaces

AlignPoint

Backwards

Height

Horizontal

ObliqueAngle

Rotation

Style

Text

UpsideDown

Vertical

Where

WhereJustified

XScaling

C/C++ Code Sample:

This sample shows a simple example of using the various interfaces to this entity.  The sample function takes an LPDISPATCH, a pointer to a dispatch handle.  This dispatch handle might, for example, have been retrieved using Vdraft’s IEntities.Item() method, or by having created the entity using the Add or Draw methods belonging to IEntities.

void TestText(IText& entity)

{

if (entity.Type() != veET_Text)	// is the entity really text?

return;	// no: return

IVector align( entity.GetAlignPoint() );

entity.SetAlignPoint( align );

CString prop_str = align.Dump();

BOOL prop_bool = entity.GetBackwards();

entity.SetBackwards(prop_bool);

double prop_double = entity.GetHeight();

entity.SetHeight(prop_double);

int prop_int = entity.GetHorizontal();

entity.SetHorizontal(prop_int);

prop_double = entity.GetObliqueAngle();

entity.SetObliqueAngle(prop_double);

prop_double = entity.GetRotation();

entity.SetRotation(prop_double);

IVector where( entity.GetWhere() );

entity.SetWhere( where );

prop_str = where.Dump();

IVector where_justified( entity.GetWhereJustified() );

entity.SetWhereJustified(where_justified);

prop_str = where_justified.Dump();

prop_str = entity.GetText();

entity.SetText(prop_str);

ITextStyle style( entity.GetStyle() );

entity.SetStyle(style);

prop_str = style.GetName();

prop_bool = entity.GetUpsideDown();

entity.SetUpsideDown(prop_bool);

prop_int = entity.GetVertical();

entity.SetVertical(prop_int);

prop_double = entity.GetXScaling();

entity.SetXScaling(prop_double);

}


IText:: AlignPoint()
IText:AlignPoint

 IText Class Overview

IVector GetAlignPoint()	(for C/C++ only)

void SetAlignPoint(IVector vec)	(for C/C++ only)

IVector AlignPoint	(for VB only)

Get or set the alignment point for the text.


IText::Backwards()
IText:Backwards

 IText Class Overview

BOOL GetBackwards()	(for C/C++ only)

void SetBackwards(BOOL)	(for C/C++ only)

BOOL Backwards	(for VB only)

Get or set whether the text is to be drawn backwards or not.


IText::Height()
IText:Height

 IText Class Overview

double GetHeight()	(for C/C++ only)

void SetHeight(double)	(for C/C++ only)

double Height	(for VB only)

Get or set the text height (in drawing units).


IText::Horizontal()
IText:Horizontal

 IText Class Overview

short GetHorizontal()	(for C/C++ only)

void SetHorizontal(short)	(for C/C++ only)

short Horizontal	(for VB only)


IText::ObliqueAngle()
IText:ObliqueAngle

 IText Class Overview

double GetObliqueAngle()	(for C/C++ only)

void SetObliqueAngle(double)	(for C/C++ only)

double ObliqueAngle	(for VB only)

Get or set the obliquing angle for the text.


IText::Rotation()
IText:Rotation

 IText Class Overview

double GetRotation()	(for C/C++ only)

void SetRotation(double)	(for C/C++ only)

double Rotation	(for VB only)

Get or set the angle of rotation (in radians) for the text.


IText::Where()
IText:Where

 IText Class Overview

IVector GetWhere()	(for C/C++ only)

void SetWhere(IVector vec)	(for C/C++ only)

IVector Where	(for VB only)

Get or set the text's loation in the drawing.


IText::WhereJustified()
IText:WhereJustified

 IText Class Overview

IVector GetWhereJustified()	(for C/C++ only)

void SetWhereJustified(IVector vec)	(for C/C++ only)

IVector WhereJustified	(for VB only)

Get or set the justification point for the text.


IText::Text()
IText:Text

 IText Class Overview

BSTR GetText()	(for C/C++ only)

void SetText(BSTR)	(for C/C++ only)

BSTR Text	(for VB only)

Get or set the actual text for the text entity.


IText::Style()
IText:Style

 IText Class Overview

ITextStyle GetStyle()	(for C/C++ only)

void SetStyle(ITextStyle styl)	(for C/C++ only)

ITextStyle Style	(for VB only)

Get or set the text style associated with the text entity.


IText::UpsideDown()
IText:UpsideDown

 IText Class Overview

BOOL GetUpsideDown()	(for C/C++ only)

void SetUpsideDown(BOOL)	(for C/C++ only)

BOOL UpsideDown	(for VB only)

Is the text being drawn upside down or not?


IText::Vertical()
IText:Vertical

 IText Class Overview

short GetVertical()	(for C/C++ only)

void SetVertical(short)	(for C/C++ only)

short Vertical	(for VB only)


IText::XScaling()
IText:XScaling

 IText Class Overview

double GetXScaling()	(for C/C++ only)

void SetXScaling(double)	(for C/C++ only)

double XScaling	(for VB only)

Get or set the X scaling for the text entity.


IAttdef

(Interface Overview)

C++ Class Constructors:

IAttdef()

IAttdef(LPDISPATCH pDispatch)

IAttdef(const IAttdef& dispatchSrc)

Available Interfaces:

Application	(read-only)

Parent	(read-only)

APIs Common to All Entity Interfaces

AlignPoint

Backwards

Constant

Height

Horizontal

ObliqueAngle

Preset

Prompt

Rotation

Style

Tag

Text

UpsideDown

Verify

Vertical

Visible

Where

WhereJustified

XScaling

C/C++ Code Sample:

This sample shows a simple example of using the various interfaces to this entity.

void DoAttdef(IAttdef& entity)

{

if (entity.Type() != veET_Attdef)	// is this really an attdef object?

return;	// no: quit

IVector align( entity.GetAlignPoint() );

entity.SetAlignPoint( align );

CString prop_str = align.Dump();

BOOL prop_bool = entity.GetBackwards();

entity.SetBackwards(prop_bool);

double prop_double = entity.GetHeight();

entity.SetHeight(prop_double);

int prop_int = entity.GetHorizontal();

entity.SetHorizontal(prop_int);

prop_double = entity.GetObliqueAngle();

entity.SetObliqueAngle(prop_double);

prop_double = entity.GetRotation();

entity.SetRotation(prop_double);

IVector where( entity.GetWhere() );

entity.SetWhere( where );

prop_str = where.Dump();

IVector where_justified( entity.GetWhereJustified() );

entity.SetWhereJustified( where_justified );

prop_str = where_justified.Dump();

prop_str = entity.GetText();

entity.SetText(prop_str);

ITextStyle style( entity.GetStyle() );

entity.SetStyle(style);

prop_str = style.GetName();

prop_bool = entity.GetUpsideDown();

entity.SetUpsideDown(prop_bool);

prop_int = entity.GetVertical();

entity.SetVertical(prop_int);

prop_double = entity.GetXScaling();

entity.SetXScaling(prop_double);

prop_bool = entity.GetVisible();

entity.SetVisible(prop_bool);

prop_bool = entity.GetConstant();

entity.SetConstant(prop_bool);

prop_bool = entity.GetVerify();

entity.SetVerify(prop_bool);

prop_bool = entity.GetPreset();

entity.SetPreset(prop_bool);

prop_str = entity.GetTag();

entity.SetTag(prop_str);

prop_str = entity.GetPrompt();

entity.SetPrompt(prop_str);

}


IAttdef::AlignPoint()
IAttdef::AlignPoint

 IAttdef Class Overview

IVector GetAlignPoint()	(for C/C++ only)

void SetAlignPoint(IVector vec)	(for C/C++ only)

IVector AlignPoint	(for VB only)


IAttdef::Backwards()
IAttdef::Backwards

 IAttdef Class Overview

BOOL GetBackwards()	(for C/C++ only)

void SetBackwards(BOOL)	(for C/C++ only)

BOOL Backwards	(for VB only)


IAttdef::Height()
IAttdef::Height

 IAttdef Class Overview

double GetHeight()	(for C/C++ only)

void SetHeight(double)	(for C/C++ only)

double Height	(for VB only)


IAttdef::Horizontal()
IAttdef::Horizontal

 IAttdef Class Overview

short GetHorizontal()	(for C/C++ only)

void SetHorizontal(short)	(for C/C++ only)

short Horizontal	(for VB only)


IAttdef::ObliqueAngle()
IAttdef::ObliqueAngle

 IAttdef Class Overview

double GetObliqueAngle()	(for C/C++ only)

void SetObliqueAngle(double)	(for C/C++ only)

double ObliqueAngle	(for VB only)


IAttdef::Rotation()
IAttdef::Rotation

 IAttdef Class Overview

double GetRotation()	(for C/C++ only)

void SetRotation(double)	(for C/C++ only)

double Rotation	(for VB only)


IAttdef::Where()
IAttdef::Where

 IAttdef Class Overview

IVector GetWhere()	(for C/C++ only)

void SetWhere(IVector vec)	(for C/C++ only)

IVector Where	(for VB only)

Returns or sets the location for the attribute definition.


IAttdef:: WhereJustified()
IAttdef::WhereJustified

 IAttdef Class Overview

IVector GetWhereJustified()	(for C/C++ only)

void SetWhereJustified(IVector)	(for C/C++ only)

IVector WhereJustified	(for VB only)


IAttdef::Text()
IAttdef::Text

 IAttdef Class Overview

BSTR GetText()	(for C/C++ only)

void SetText(BSTR)	(for C/C++ only)

BSTR Text	(for VB only)


IAttdef::Style()
IAttdef::Style

 IAttdef Class Overview

ITextStyle GetStyle()	(for C/C++ only)

void SetStyle(ITextStyle)	(for C/C++ only)

ITextStyle Style	(for VB only)


IAttdef::UpsideDown()
IAttdef::UpsideDown

 IAttdef Class Overview

BOOL GetUpsideDown()	(for C/C++ only)

void SetUpsideDown(BOOL)	(for C/C++ only)

BOOL UpsideDown	(for VB only)


IAttdef::Vertical()
IAttdef::Vertical

 IAttdef Class Overview

short GetVertical()	(for C/C++ only)

void SetVertical(short)	(for C/C++ only)

short Vertical	(for VB only)


IAttdef::XScaling()
IAttdef::XScaling

 IAttdef Class Overview

double GetXScaling()	(for C/C++ only)

void SetXScaling(double)	(for C/C++ only)

double XScaling	(for VB only)


IAttdef::Visible()
IAttdef::Visible

 IAttdef Class Overview

BOOL GetVisible()	(for C/C++ only)

void SetVisible(BOOL)	(for C/C++ only)

BOOL Visible	(for VB only)


IAttdef::Constant()
IAttdef::Constant

 IAttdef Class Overview

BOOL GetConstant()	(for C/C++ only)

void SetConstant(BOOL)	(for C/C++ only)

BOOL Constant	(for VB only)


IAttdef::Verify()
IAttdef::Verify

 IAttdef Class Overview

BOOL GetVerify()	(for C/C++ only)

void SetVerify(BOOL)	(for C/C++ only)

BOOL Verify	(for VB only)


IAttdef::Preset()
IAttdef::Preset

 IAttdef Class Overview

BOOL GetPreset()	(for C/C++ only)

void SetPreset(BOOL)	(for C/C++ only)

BOOL Preset	(for VB only)


IAttdef::Tag()
IAttdef::Tag

 IAttdef Class Overview

BSTR GetTag()	(for C/C++ only)

void SetTag(BSTR tag)	(for C/C++ only)

BSTR Tag	(for VB only)


IAttdef::Prompt()
IAttdef::Prompt

 IAttdef Class Overview

BSTR GetPrompt()	(for C/C++ only)

void SetPrompt(BSTR prmpt)	(for C/C++ only)

BSTR Prompt	(for VB only)


IAttributes

(Interface Overview)

C++ Class Constructors:

IAttributes()

IAttributes(LPDISPATCH pDispatch)

IAttributes(const IAttributes& dispatchSrc)

A collection of IAttribute objects.

Available Interfaces:

Application	(read-only)

Parent	(read-only)

APIs Common to All Entity Interfaces

Count

Item


IAttributes::Count

 IAttributes Class Overview

long GetCount()	(for C/C++ only)

long Count	(for VB only)

Get the number of items in the collection.


IAttributes::Item

 IAttributes Class Overview

IAttribute GetItem(long index)	(for C/C++ only)

IAttribute Item(long index)	(for VB only)

Retrieve the index'th item (attribute) in the collection.


IAttribute

(Interface Overview)

C++ Class Constructors:

IAttribute()

IAttribute(LPDISPATCH pDispatch)

IAttribute(const IAttribute& dispatchSrc)

Available Interfaces:

Application	(read-only)

Parent	(read-only)

APIs Common to All Entity Interfaces

AlignPoint

Backwards

Constant

Height

Horizontal

ObliqueAngle

Preset

Rotation

Style

Tag

Text

UpsideDown

Verify

Vertical

Visible

Where

WhereJustified

XScaling

C/C++ Code Sample:

This sample shows a simple example of using the various interfaces to this entity.  The sample function takes an LPDISPATCH, a pointer to a dispatch handle.  This dispatch handle might, for example, have been retrieved using Vdraft’s IEntities.Item() method, or by having created the entity using the Add or Draw methods belonging to IEntities.

void DoAttribute(IAttribute& entity)

{

if (entity.Type() != veET_Attribute)	// is it really an attribute?

return;	// no: quit

IVector align( entity.GetAlignPoint() );

entity.SetAlignPoint( align );

CString prop_str = align.Dump();

BOOL prop_bool = entity.GetBackwards();

entity.SetBackwards(prop_bool);

double prop_double = entity.GetHeight();

entity.SetHeight(prop_double);

int prop_int = entity.GetHorizontal();

entity.SetHorizontal(prop_int);

prop_double = entity.GetObliqueAngle();

entity.SetObliqueAngle(prop_double);

prop_double = entity.GetRotation();

entity.SetRotation(prop_double);

IVector where( entity.GetWhere() );

entity.SetWhere( where );

prop_str = where.Dump();

IVector where_justified( entity.GetWhereJustified() );

entity.SetWhereJustified( where_justified );

prop_str = where_justified.Dump();

prop_str = entity.GetText();

entity.SetText(prop_str);

ITextStyle style( entity.GetStyle() );

entity.SetStyle(style);

prop_str = style.GetName();

prop_bool = entity.GetUpsideDown();

entity.SetUpsideDown(prop_bool);

prop_int = entity.GetVertical();

entity.SetVertical(prop_int);

prop_double = entity.GetXScaling();

entity.SetXScaling(prop_double);

prop_bool = entity.GetVisible();

prop_bool = entity.GetConstant();

prop_bool = entity.GetVerify();

prop_bool = entity.GetPreset();

prop_str = entity.GetTag();

entity.SetTag(prop_str);

}


IAttribute::AlignPoint()
IAttribute::AlignPoint

 IAttribute Class Overview

IVector GetAlignPoint()	(for C/C++ only)

void SetAlignPoint(IVector vec)	(for C/C++ only)

IVector AlignPoint	(for VB only)

Sets/Gets the align point for the attribute text.


IAttribute::Backwards()
IAttribute::Backwards

 IAttribute Class Overview

BOOL GetBackwards()	(for C/C++ only)

void SetBackwards(BOOL)	(for C/C++ only)

BOOL Backwards	(for VB only)

Will the attribute be displayed backwards or not?


IAttribute::Height()
IAttribute::Height

 IAttribute Class Overview

double GetHeight()	(for C/C++ only)

void SetHeight(double)	(for C/C++ only)

double Height	(for VB only)

The height of the attribute text, in drawing units.


IAttribute::Horizontal()
IAttribute::Horizontal

 IAttribute Class Overview

short GetHorizontal()	(for C/C++ only)

void SetHorizontal(short)	(for C/C++ only)

short Horizontal	(for VB only)

Horizontal Justification


IAttribute::ObliqueAngle()
IAttribute::ObliqueAngle

 IAttribute Class Overview

double GetObliqueAngle()	(for C/C++ only)

void SetObliqueAngle(double)	(for C/C++ only)

double ObliqueAngle	(for VB only)

The angle of slant the attribute text is to be drawn at.  To what degree is it “italicized”


IAttribute::Rotation()
IAttribute::Rotation

 IAttribute Class Overview

double GetRotation()	(for C/C++ only)

void SetRotation(double)	(for C/C++ only)

double Rotation	(for VB only)

The angle of rotation for the attribute text as a whole.  That is, will it be drawn straight out along the X-axis, or at some angle from there (or from whatever angle base point has been set)?


IAttribute::Where()
IAttribute::Where

 IAttribute Class Overview

IVector GetWhere()	(for C/C++ only)

void SetWhere(IVector vec)	(for C/C++ only)

IVector Where	(for VB only)

This is the base point for the attribute.  The “handle point” at which it will inserted into the drawing.


IAttribute::WhereJustified()
IAttribute::WhereJustified

 IAttribute Class Overview

IVector GetWhereJustified()	(for C/C++ only)

void SetWhereJustified(IVector)	(for C/C++ only)

IVector WhereJustified	(for VB only)


IAttribute::Text()
IAttribute::Text

 IAttribute Class Overview

BSTR GetText()	(for C/C++ only)

void SetText(BSTR)	(for C/C++ only)

BSTR Text	(for VB only)


IAttribute::Style()
IAttribute::Style

 IAttribute Class Overview

ITextStyle GetStyle()	(for C/C++ only)

void SetStyle(ITextStyle)	(for C/C++ only)

ITextStyle Style	(for VB only)


IAttribute::UpsideDown()
IAttribute::UpsideDown

 IAttribute Class Overview

BOOL GetUpsideDown()	(for C/C++ only)

void SetUpsideDown(BOOL)	(for C/C++ only)

BOOL UpsideDown	(for VB only)


IAttribute::Vertical()
IAttribute::Vertical

 IAttribute Class Overview

short GetVertical()	(for C/C++ only)

void SetVertical(short)	(for C/C++ only)

short Vertical	(for VB only)


IAttribute::XScaling()
IAttribute::XScaling

 IAttribute Class Overview

double GetXScaling()	(for C/C++ only)

void SetXScaling(double)	(for C/C++ only)

double XScaling	(for VB only)


IAttribute::Visible()
IAttribute::Visible

 IAttribute Class Overview

BOOL GetVisible()	(for C/C++ only)

void SetVisible(BOOL)	(for C/C++ only)

BOOL Visible	(for VB only)


IAttribute::Constant()
IAttribute::Constant

 IAttribute Class Overview

BOOL GetConstant()	(for C/C++ only)

void SetConstant(BOOL)	(for C/C++ only)

BOOL Constant	(for VB only)


IAttribute::Verify()
IAttribute::Verify

 IAttribute Class Overview

BOOL GetVerify()	(for C/C++ only)

void SetVerify(BOOL)	(for C/C++ only)

BOOL Verify	(for VB only)


IAttribute::Preset()
IAttribute::Preset

 IAttribute Class Overview

BOOL GetPreset()	(for C/C++ only)

void SetPreset(BOOL)	(for C/C++ only)

BOOL Preset	(for VB only)


IAttribute::Tag()
IAttribute::Tag

 IAttribute Class Overview

BSTR GetTag()	(for C/C++ only)

void SetTag(BSTR)	(for C/C++ only)

BSTR Tag	(for VB only)


IVertices

(Interface Overview)

 See Also

C++ Class Constructors:

IVertices()

IVertices(LPDISPATCH pDispatch)

IVertices(const IVertices& dispatchSrc)

An IVertices object is a collection of IVertex objects.  In other words, it’s a collection of IVertex objects.

Available Interfaces:

Application	(read-only)

Parent	(read-only)

APIs Common to All Entity Interfaces

Count	How many IVertex objects are in this collection.

Item	Get access to a particular vertex.


IVertices::Count()
IVertices::Count

 IVertices Class Overview

long GetCount()	(for C/C++ only)

long Count	(for VB only)

Returns the number of IVertex objects in the collection.


IVertices::Item()
IVertices::Item

 IVertices Class Overview

IVertex GetItem(long index)	(for C/C++ only)

IVertex Item(long index)	(for VB only)

Returns the nth IVertex object in the list.

NOTE: Unlike most of the Item() methods attached to Vdraft collection objects, this Item() method can not retrieve by name or handle, but only by index in the collection.


IViewport

(Interface Overview)

C++ Class Constructors:

IViewport()

IViewport(LPDISPATCH pDispatch)

IViewport(const IVertex& dispatchSrc)

The IViewport class defines a viewport, that is, the “portal” on a view in the drawing.  There is one such item attached to each IView object (which corresponds to a paperspace viewport) in the drawing.  An IViewport object is an actual entity in the drawing database.

Available Interfaces:

Application	(read-only)

Parent	(read-only)

APIs Common to All Entity Interfaces

Height	The height of the viewport.

Status	The current status of the viewport

Where	The location within the drawing of the viewport.

Width	The width of the viewport.

C/C++ Code Sample:

This sample shows a simple example of using the various interfaces to this entity.  The sample function takes an LPDISPATCH, a pointer to a dispatch handle.  This dispatch handle might, for example, have been retrieved using Vdraft’s IEntities.Item() method, or by having created the entity using the Add or Draw methods belonging to IEntities.

void DoViewport(LPDISPATCH idisp)

{

CString prop_str;

double prop_double;

int prop_int;

IViewport entity(idisp);	// get an interface to the object

if (entity.Type() != veET_Viewport)	// is it really a Viewport?

{

return;	// no: quit

}

IVector where = entity.GetWhere();	// get the insertion point for the viewport

entity.SetWhere( where );	// set the insertion point

prop_str = where.Dump();	// get the insertion point as a string value

prop_double = entity.GetWidth();	// viewport width

entity.SetWidth(prop_double);

prop_double = entity.GetHeight();	// viewport height

entity.SetHeight(prop_double);

prop_int = entity.GetStatus();	// the viewport’s status

entity.SetStatus(prop_int);

}


IViewport::Height

 IViewport Class Overview

double GetHeight()	(for C/C++ only)

void SetHeight(double)	(for C/C++ only)

double Height	(for VB only)


IViewport::Status

 IViewport Class Overview

short GetStatus()	(for C/C++ only)

void SetStatus(short)	(for C/C++ only)

short Status	(for VB only)

Get or set the status of this viewport.  0 means the viewport is turned off.  Greater than zero indicates the stacking order of the viewport, relative to other viewports.


IViewport::Where

 IViewport Class Overview

IVertex GetWhere()	(for C/C++ only)

void SetWhere(IVertex)	(for C/C++ only)

IVertex Where	(for VB only)


IViewport::Width

 IViewport Class Overview

double GetWidth()	(for C/C++ only)

void SetWidth(double)	(for C/C++ only)

double Width	(for VB only)


IVertex

(Interface Overview)

 See Also

C++ Class Constructors:

IVertex()

IVertex(LPDISPATCH pDispatch)

IVertex(const IVertex& dispatchSrc)

Vertex objects are found in 3d polylines, polymeshes and polyfaces.  These are the vertices making up these larger objects.

Available Interfaces:

Application	(read-only)

Parent	(read-only)

Where	The location for the vertex.

C/C++ Code Sample:

This sample shows a simple example of using the various interfaces to this entity.  The sample function takes an LPDISPATCH, a pointer to a dispatch handle.  This dispatch handle might, for example, have been retrieved using Vdraft’s IEntities.Item() method, or by having created the entity using the Add or Draw methods belonging to IEntities.

void DoVertex(IVertex& entity)

{

if (entity.Type() != veET_Vertex)	// is it really a vertex object?

return;	// no: it’s not a vertex

IVector where( entity.GetWhere() );	// get the coordinates for the vertex

entity.SetWhere( where );	// set the coordinates

CString prop_str = where.Dump();	// get the coordinates as a string

}


IVertex::Where()
IVertex::Where

 IVertex Class Overview

IVector GetWhere()	(for C/C++ only)

void SetWhere(IVector vec)	(for C/C++ only)

IVector Where	(for VB only)

Sets and Retrieves the location of this vertex, that is, its 3D position in space.


IMatrix

(Interface Overview)

 See Also

C++ Class Constructors:

IMatrix()

IMatrix(LPDISPATCH pDispatch)

IMatrix(const IVertex& dispatchSrc)

The IMatrix class offers you basic matrix functionality wrapped up in a class for easy useage.  Matrices are essential for figuring out translations, rotations and many other needs.

Properties:

Application	(read-only)

Item	(read-only)

Parent	(read-only)

Methods: CopyFrom ECStoWCS Id Mirror Rotation Scaling Transform Translation WCStoECS


IMatrix::Item

 IMatrix Class Overview

LPDISPATCH GetItem(long which);	(for C/C++ only)

void SetItem(long which, LPDISPATCH newValue);	(for C/C++ only)

LPDISPATCH SetItem(long which)	(for VB only)


IMatrix::Id

 IMatrix Class Overview

void Id()	(for C/C++ only)

void Id	(for VB only)

Set the matrix to identity.  Effectively clears the matrix.  An IVector transformed by an identity matrix is unchanged.


IMatrix::ECStoWCS

IMatrix Class Overview

void ECStoWCS(IVector normal)

Convert from the entity’s own coordinates to world or drawing coordinates.  ECS stands for “Entity Coordinate System.” WCS stands for World Coordinate System.


IMatrix::WCStoECS

 IMatrix Class Overview

void WCStoECS(IVector normal)

Convert from world or drawing coordinates to the entity’s own coordinates.  ECS stands for “Entity Coordinate System.”  WCS stands for World Coordinate System.


IMatrix::CopyFrom

 IMatrix Class Overview

void CopyFrom(IMatrix mat)

Create a copy of the given matrix into this matrix object.


IMatrix::Translation

 IMatrix Class Overview

void Translation(IVector offset)


IMatrix::Mirror

 IMatrix Class Overview

void Mirror(IVector one, IVector two [, IVector normal])


IMatrix::Rotation

 IMatrix Class Overview

void Rotation(double angle [, IVector point [, IVector normal]]))

Rotate ‘angle’ around ‘point’ sticking out in direction ‘normal’


IMatrix::Scale
IMatrix::Scaling

 IMatrix Class Overview

void Scaling(IVector factors [, IVector point [, VARIANT normal]]))


IMatrix::Transform

 IMatrix Class Overview

void Transform(IVector)

Run the given vector through the transformation in the matrix.  This may move, rotate, scale, and/or mirror the vector.


cVdraftEvent

cPickEvent	cDrawEvent	cSelectEvent

cPickEvent, cSelectEvent and cDrawEvent are classes, derived from the cVdraftEvent base class, that encapsulate event handling under C/C++.  cPickEvent encapsulates the Vdraft pick event notifications.  cDrawEvent encapsulates Vdraft drawing event notifications, and cSelectEvent encapsulates Vdraft selection events.

The file VAngular.Cpp, in Vdraft\Programs\Cpp\AngDim, shows one example of using cSelectEvent.  The file VLeader.Cpp in Vdraft\Programs\Cpp\VCurveLdr shows a sample usage of cDrawEvent.

Besides making events just easier to use under C/C++, these classes also automatically take care of such issues as multiple overlapping events taking place across multiple drawings.  You do not have to track what event goes with what drawing and so forth in your own code; these classes do that for you.  In your event requests, you simply pass a pointer to the class object that is handling the particular requested event and, voila, the correct handler will be called.

Using these classes is optional, of course.  You can call into Vdraft directly for event requests and so forth.  The sample app DrawX, under Vdraft\Programs\Cpp\DrawX, does not use any of these wrapper classes.  It’s a good example of the mechanics of event request and notification in Vdraft.

See Also:

ISelectionEvents

IPickEvents

IApplicationEvents

PlugIns


ISelectionEvents

(Interface Overview)

C++ Class Constructors:

ISelectionvents()

ISelectionEvents(LPDISPATCH pDispatch)

ISelectionEvents(const IVdraft& dispatchSrc)

This collection of functions has to do with receiving notifications from Vdraft whenever the user has completed some selection process.  You can request the user to select a single entity, a group of entities, etc.  This gives you ability to make your application interactive with the user.

Properties:

Application	(read-only)

Name

Parent	(read-only)

StatusBar

Methods:

RequestSelect

RequestSingleSelect


ISelectionEvents::Name

ISelectionEvents Class Overview

BSTR GetName()	(for C/C++ only)

void SetName(BSTR)	(for C/C++ only)

BSTR SetName()	(for VB only)

This is the text to be displayed on popup menu & cursor tip.  The idea is that the user is in the middle of some pick event that your application has required (or stated or offered).  This piece of text helps keep the user clued in to what is going on.


ISelectionEvents::StatusBar

ISelectionEvents Class Overview

BSTR GetStatusBar()	(for C/C++ only)

void SetStatusBar(BSTR)	(for C/C++ only)

BSTR StatusBar	(for VB only)

This is the text to be displayed on status bar during a selection event initiated by your application.


ISelectionEvents::RequestSelect

ISelectionEvents Class Overview

boolean RequestSelect(long pluginid, [long userinfo])

Do the selection now.  Once you have set all the properties for this selection event the way you wish them, then you may initiate a selection event using this call.  When the user completes the selection task, Vdraft will send your application a notification, returning the optional userinfo value that you here pass in.

ISelectionEvents::RequestSingleSelect


ISelectionEvents::RequestSingleSelect

ISelectionEvents Class Overview

 See Also

boolean RequestSingleSelect(long pluginid, [long userinfo])

Do the selection now.  Once you have set all the properties for this selection event the way you wish them, then you may initiate a single selection event using this call.  When the user has selected a single entity, Vdraft will send your application a notification, returning the optional userinfo value that you here pass in.


IPickEvents

(Interface Overview)

C++ Class Constructors:

IPickEvents()

IPickEvents(LPDISPATCH pDispatch)

IPickEvents(const IVdraft& dispatchSrc)

The IPickEvents object is for telling Vdraft when you wish to be notified of certain types of mouse events, such as picks, right mouse menu activation, etc.

You can set up information about the pick - cursor tips, what'll appear on the popup, etc.  Then call SendPick to actually start the process.  Events will be sent back with (event==eVPE_PickEvents) & (vpinfo->pickEvent==<event>) & (vpinfo->userInfo==<info passed to SendPick so you know which document you're working with>).  The plugin will be notified when the user picks a point (eVPE_Pick and vpinfo->point is the point picked) or cancels (eVPE_Cancel).  You can also have various popup options enabled (done, properties, undo) & then you'll be notified when they're chosen.

Code samples showing how to implement pick events for interactively creating entities with the user are included with the Vdraft distribution disks.  You will find them under \Vdraft\Programs\Cpp and \Vdraft\Programs\VB.

If you are using VB, you may access this capability through the Vdraft Events OCX.  VB won’t let you receive notifications directly.

Properties:

Application	(read-only)

BasePoint

HelpToken

Name

NotifyDone

NotifyProperties

NotifyUndo

Parent	(read-only)

StatusBar

Methods:

RequestDraw

RequestPick

SendDraw

SendPick

SetCursorTipInfo

SetCursorTips

TriggerAngle

TriggerDiameter

TriggerHeight

TriggerLength

TriggerOffset

TriggerPick

TriggerPopup

TriggerRadius

TriggerScale

TriggerWidth


IPickEvents::RequestPick

IPickEvents Class Overview

BOOL RequestPick(long addonid, const VARIANT& userinfo);

Requests of Vdraft a pick notification.  That is, “tell me when the user has picked something.”


IPickEvents::RequestDraw

IPickEvents Class Overview

BOOL RequestDraw(long addonid, const VARIANT& userinfo);

Requests of Vdraft a draw notification.  That is, “tell me when the user has finished drawing something.”


IPickEvents::TriggerPick

IPickEvents Class Overview

BOOL TriggerPick(LPDISPATCH point);

Sends a pick back into Vdraft.  That is, supplies a pick so the user doesn’t have to.

For example, if you started drawing a 2-point rectangle, you could call TriggerPick to choose the 1st point.  The cursor tips then report width & height, so you could call TriggerHeight to fix the height & allow the user to pick the width.


IPickEvents::TriggerPopup

IPickEvents Class Overview

BOOL TriggerPopup(short event);

Sends a popup back into Vdraft.


IPickEvents::TriggerLength

IPickEvents Class Overview

BOOL TriggerLength(double Length);

Sends a length back into Vdraft, as though the user had entered it.  Same as typing in a length in the coords box on Vdraft toolbar.


IPickEvents::TriggerAngle

IPickEvents Class Overview

BOOL TriggerAngle(double angle);

Sends an angle back into Vdraft as though the user had entered in an angle.


IPickEvents::TriggerOffset

IPickEvents Class Overview

BOOL TriggerOffset(LPDISPATCH offset);

Sends an offset back into Vdraft as though the user had entered it in.


IPickEvents::TriggerScale

IPickEvents Class Overview

BOOL TriggerScale(LPDISPATCH scale);

Sends a scale value back into Vdraft as though the user had entered it in.


IPickEvents::TriggerHeight

IPickEvents Class Overview

BOOL TriggerHeight(double height);

Sends a height value back into Vdraft as though the user had entered it in.  This might be used, for example, to allow the user to pick only a width.


IPickEvents::TriggerWidth

IPickEvents Class Overview

BOOL TriggerWidth(double width);

Sends a width value back into Vdraft as though the user had entered it in.  This might be used, for example, to allow the user to pick only a height.


IPickEvents::TriggerRadius

IPickEvents Class Overview

BOOL TriggerRadius(double radius);

Sends a radius value back into Vdraft as though the user had entered it.


IPickEvents::TriggerDiameter

IPickEvents Class Overview

BOOL TriggerDiameter(double diameter);

Sends a diameter value back into Vdraft as though the user had entered it.  Useful when you wish to some parameters for an entity predefined, allowing the user to select only certain others.


IPickEvents::Name

IPickEvents Class Overview

BSTR GetName	(for C/C++ only)

void SetName(BSTR)	(for C/C++ only)

BSTR Name	(for VB only)

Appears on the popup after Done, Cancel, & before Props


IPickEvents::StatusBar

IPickEvents Class Overview

BSTR GetStatusBar	(for C/C++ only)

void SetStatusBar(BSTR)	(for C/C++ only)

BSTR StatusBar	(for VB only)

Status bar message goes away once pick is done.  This is NOT the actual status bar, it is the message that would be displayed on the status bar when the pick event is activated.


IPickEvents::NotifyDone

IPickEvents Class Overview

boolean GetNotifyDone()	(for C/C++ only)

void SetNotifyDone(boolean)	(for C/C++ only)

boolean NotifyDone()	(for VB only)

enable Done on popup & notify plugin if picked


IPickEvents::NotifyProperties

IPickEvents Class Overview

boolean GetNotifyProperties()	(for C/C++ only)

void SetNotifyProperties(boolean)	(for C/C++ only)

boolean NotifyProperties()	(for VB only)

Properties on popup


IPickEvents::NotifyUndo

IPickEvents Class Overview

boolean NotifyUndo()	(for C/C++ only)

void SetNotifyUndo(boolean)	(for C/C++ only)

boolean NotifyUndo()	(for VB only)

Undo on popup


IPickEvents::BasePoint

IPickEvents Class Overview

IVector GetBasePoint()	(for C/C++ only)

void SetBasePoint(IVector)	(for C/C++ only)

IVector BasePoint	(for VB only)

basepoint used for perp. snap, cursor tips, etc.

The basepoint will be used for perpendicular snap, relative coordinates, & possibly cursor tips.  If you call SetCursorTipInfo, cursor tips which reflect length, angle, offset, etc. will automatically be generated relative to the basepoint.


IPickEvents::SendDraw

IPickEvents Class Overview

boolean SendDraw(long pluginid, VARIANT userinfo)

If something is currently being drawn (e.g. a line, a dimension), the plugin will be notified when the current action is completely done or aborted or a point has been picked.  The event will be eaVPE_Draw - the specific event will be in info->drawEvent.  If it was a point pick, the point will be in info->point.

This is useful if you want to chain together Vdraft commands.  Say you wanted to have the user draw an arc with an arrow head at one end.  You could call entities->Draw3PointArc() then pickevents->SendDraw(...).  When the user gets done drawing the arc, the plugin will be notified so it can add the arrow.  This could also be used in conjunction with the Trigger<blah> functions to allow the user to pick some values & have others automatically filled in.

VB users can call this function directly, if you so choose.  You should check out the VB OCX that ships with Vdraft, however.


IPickEvents::SendPick

IPickEvents Class Overview

boolean SendPick(long pluginid, VARIANT userinfo)

notify on pick


IPickEvents::SetCursorTips

IPickEvents Class Overview

void SetCursorTips(BSTR tip1, VARIANT tip2, VARIANT tip3, VARIANT tip4);

The cursor tips are those bits of text that show up next to the mouse cursor while certain drawing or selection events are in process. Allows you to set up to four lines of cursor tip for your own drawing event.

Visual Basic Code Sample:

C/C++ Code Sample:


IPickEvents::SetCursorTipInfo

IPickEvents Class Overview

void SetCursorTipInfo(eaCursorTipInfo tipinfo, IDispatch* basepoint);


IPickEvents::HelpToken

IPickEvents Class Overview

long GetHelpToken()	(for C/C++ only)

void SetHelpToken(long)	(for C/C++ only)

long HelpToken(long)	(for VB only)

This is to provide Vdraft with a help token that it can feed back to your application should the user request help during the requested Pick Event.  Ideally, it will simply be a help topic id that you will simply pass to your winhelp and your help file.


IApplicationEvents

(Interface Overview)

IApplicationEvents Class Overview:

C++ Class Constructors:

IApplicationEvents()

IApplicationEvents(LPDISPATCH pDispatch)

IApplicationEvents(const IApplicationEvents& dispatchSrc)

This collection of methods and properties has to do with getting notifications back from Vdraft about certain types of user interface issues, such as adding menu items, keyboard commands and so.  Visual Basic users should refer to the Vevents OCX

Properties:

Application	(read-only)

Parent	(read-only)

Methods:

AddKeyboardCommand

AddToolsCommand

AddToolsOption

RemoveToolsOption


IApplicationEvents::AddToolsCommand

IApplicationEvents Class Overview

boolean AddToolsCommand(long pluginid, long menuid, BSTR menutext, BSTR statusbar);

Add an entry to the Vdraft Tools menu.  This command only works for PlugIns.

Pluginid is the id that Vdraft gives you when your DLL exported functions are called by Vdraft.

Menuid is a value you assign to this menu item that you wish to have returned to you when the menu item is chosen by the user.  Since it’s a long, it could be a pointer to some structure, as readily as a simple id number.

Menutext is the text that is to actually appear on the menu.

Statusbar is the text that should appear on the status bar when the user has the mouse over the menu entry.

AddToolsCommand adds a menu item called 'menutext' to the Tools.  When the menu item is hilighted, 'statusbar' appears on the status bar as short help.  When the user picks the item, vfCommand will be called by Vdraft with info->eventid set to the menuid if no additional options have been registered.

#define MENUID	1

#define OPTOINID1	1

#define OPTIONID2	2

events->AddToolsCommand(info->pluginid, MENUID, "&My Menu Item", "Status bar help.");

events->AddToolsOption(info->pluginid, MENUID, OPTIONID1, "&First Button");

events->AddToolsOption(info->pluginid, MENUID, OPTIONID2, "&Second Button");


IApplicationEvents::AddToolsOption

IApplicationEvents Class Overview

boolean AddToolsOption(long pluginid, long menuid, long eventid, BSTR buttontext);

If you've called AddToolsOption, then a dialog will be displayed with a button for each option that was added.  When a button is pressed, the event will be eaVPE_ToolCommand & info->eventid will represent the option chosen.

See Also: AddToolsCommand


IApplicationEvents::RemoveToolsOption

IApplicationEvents Class Overview

boolean RemoveToolsOption(long pluginid, long menuid, long eventid);

Pluginid is the id that Vdraft gives you when your DLL exported functions are called by Vdraft.

See Also: AddToolsCommand


IApplicationEvents::AddKeyboardCommand

IApplicationEvents Class Overview

boolean AddKeyboardCommand(long pluginid, long eventid, BSTR keystrokes);

Creates a new keyboard command for the user.  This enables you to effectively cerate your own “short cut keys” as well as other types of keyboard commands for the user.

Pluginid is the id that Vdraft gives you when your DLL exported functions are called by Vdraft.

NOTE: An important point to keep in mind is that keyboard commands registered with Vdraft only work when Vdraft has the focus.  That is, if you put up a dialog box from your add-on and the dialog box has the focus, none of the keyboard commands will function until focus is restored to Vdraft.


::Parent()
Parent

 See Also

LPDISPATCH Parent()

Parent belongs to all Vdraft objects.  Return type is dependent on what the object’s parent object is.  For example, called on an IVertex object belonging to a 3d polyline would return the IVertices object this vertex belongs to (the I3DPolyline object contains an IVertices object with contains several IVertex objects)..  In some cases, such as with IEntity objects, there can be more than one type of parent object.  What is always returned is the object that is this exact items parent.

All Vdraft objects contain a Parent property.  Is a read-only value, returning a dispatch interface to the parent of the object.

Note that calling Parent() on the IVdraft object returns itself.


::Application()
Application

 See Also

IVdraft Application()

All Vdraft objects contain an Application property.  Is a read-only value, returning a dispatch interface to the Vdraft application, or instance thereof, that the particular object belongs to.


IVdraft

(Interface Overview)

 See Also

IVdraft Class Overview:

It’s the application class, provides the initial IDispatch linkage as well as providing basic information, such as the application’s full path, number of documents currently open etc.  All roads into Vdraft begin here.

C++ Class Constructors:

IVdraft() IVdraft(LPDISPATCH pDispatch) IVdraft(const IVdraft& dispatchSrc)

Properties:

Application	(read-only)

Parent	(read-only)

ActiveDocument	(read-only)

ApplicationEvents	(read-only)

Documents	(read-only)

FullName	(read-only)

Maximized	(read-only)

Minimized	(read-only)

Name	(read-only), default

Visible

WindowHandle	(read-only)

Methods:

NewMatrix

NewVector

Quit

The Starting Place for all Vdraft Applications:

Getting your first link to Vdraft, as an Automation object

Visual Basic Code Sample:

Dim Vdraft As Object

On Error GoTo Err1	‘ error trapping

Set Vdraft = CreateObject(“Vdraft.Application”)

GoTo Successul

Err1:

‘ handle the error.  Vdraft did not load up or was not found.

‘ might ask the user if (s)he wishes to continue off-line or to load

‘ up Vdraft manually before continuing…

Successful:

‘ continue on with whatever you are doing…

C/C++ Code Sample:

IVdraft Vdraft;

BOOL bSuccess = Vdraft.CreateDispatch("Vdraft.Application", NULL);

if (!bSuccess)

{

//  handle error.  Vdraft did not start or was not located.

}


IVdraft::ApplicationEvents()
IVdraft::ApplicationEvents

 IVdraft Class Overview

void GetApplicationEvents()	(for C/C++ only)

void ApplicationEvents()	(for VB only)

Returns an interface to the ApplicationEvents object.


IVdraft::Visible()
IVdraft::Visible

 IVdraft Class Overview

BOOL GetVisible()	(for C/C++ only)

BOOL SetVisible(BOOL)	(for C/C++ only)

BOOL Visible	(for VB only)

This tells you whether Vdraft is currently visible to the user or not.  If the user started Vdraft before starting the add-on application then Vdraft will be visible automatically.  If the application is started first and it starts Vdraft, Vdraft’s visibility to the user is optional; it can be controlled.  If you turn Vdraft “off” be sure that you turn it on again.  Otherwise it may well remain behind, lost and forgotten.

Visual Basic Code Sample

Turn Vdraft “off” to the user; make it invisible.

‘ Make Vdraft invisible to the user

Dim Vdraft As Object

Set Vdraft = CreateObject(“Vdraft.Application”)

Vdraft.Visible = False

C/C++ Code Sample:

In this sample, the idea is that you may wish to make Vdraft not visible for a period of time in order to do some special processing, after which the previous visibility setting is restored.

IVdraft Vdraft ();

Vdraft.CreateDispatch("Vdraft.Application", NULL);

BOOL prevVisible = Vdraft.GetVisible();

‘

‘	do whatever

‘

Vdraft.SetVisible(prevVisible);	// restore previous setting


IVdraft::ActiveDocument()
IVdraft::ActiveDocument

 IVdraft Class Overview

 See Also

IDocument ActiveDocument()	(read only)

Returns the currently active document.  This object can then be used to access the elements in that document.

Visual Basic Code Sample:

Dim Vdraft, Doc As Object

Set Vdraft = CreateObject(“Vdraft.Application”)

Set Doc = Vdraft.ActiveDocument


IVdraft::Minimized
IVdraft::Minimized/Maximized

 IVdraft Class Overview

 See Also

BOOL GetMinimized()	(for C/C++ only)

void SetMinimized(BOOL)	(for C/C++ only)

BOOL Minimized	(for VB only)

Same for:

Maximized()

These two settings: Minimized() and Maximized() control the minimize and maximize state of Vdraft.  If Maximize() is called, it does NOT steal focus away from the application that called this function.


IVdraft::NewMatrix()
IVdraft::NewMatrix

 IVdraft Class Overview

 See Also

IMatrixNewMatrix()

NewMatrix gives you an identity matrix.


IVdraft::NewVector()
IVdraft::NewVector

 IVdraft Class Overview

 See Also

IVectorNewVector()

IVectorNewVector(IVector vec)

IVectorNewVector(double x [, double y [, double z]]))

NewVector without parameters gives you a vector of (0,0,0).  You can also pass it another vector or (x,y,z), where y & z are optional.


IVdraft::FullName()
IVdraft::FullName

 IVdraft Class Overview

 See Also

BSTR GetFullName()	(for C/C++ only)

BSTR FullName	(for VB only)

Returns the name of the Vdraft executable along with its path.  For example: “C:\VDRAFT\VDRAFT.EXE”


IVdraft::Name()
IVdraft::Name

 IVdraft Class Overview

BSTR Name()	(read-only)

Returns the name of the Vdraft executable, “Vdraft”

Visual Basic Code Sample:

Dim Name$

Name$ = Vdraft.Name

C/C++ Code Sample:

IVdraft Vdraft;

Vdraft.CreateDispatch("Vdraft.Application", NULL);

CString csName = Vdraft.Name();


IVdraft::Documents()
IVdraft::Documents

 IVdraft Class Overview

 See Also

IDocuments GetDocuments()	(for C/C++ only)

IDocuments Documents	(for VB only)

This returns a dispatch interface to the documents table in Vdraft.  This allows you access to all of the currently active drawings, and, in turn, each of their elements, such as their tables, drawing entities, etc.

Visual Basic Code Sample:

Dim Vdraft, Dok As Object

Set Vdraft = CreateObject(“Vdraft.Application”)

Idx% = 1	‘ start with first document

‘

‘   loop through all active documents

For Idx% = 1 To Dok.Count

Set Dok = Vdraft.Documents.Item(Idx%)

‘

‘   do whatever you need here with this document

Next


IVdraft::Quit()
IVdraft::Quit

 IVdraft Class Overview

void Quit()

This method will close down Vdraft, cause it to do a normal shut down and exit.

Sample Code for Visual Basic

Dim Vdraft As Object

Set Vdraft = CreateObject(“Vdraft.Application”)

…

Vdraft.Quit

Sample Code for C/C++

IVdraft Vdraft ();

BOOL bSuccess = Vdraft.CreateDispatch("Vdraft.Application", NULL);

…

Vdraft.Quit();


IVdraft::WindowHandle()
IVdraft::WindowHandle

 IVdraft Class Overview

void WindowHandle()	(for C/C++ only)

void WindowHandle	(for VB only)

Read-Only.  The returns the window handle (HWND) to the Vdraft main window.


IDocuments

(Interface Overview)

 See Also

C++ Class Constructors:

IDocuments()

IDocuments(LPDISPATCH pDispatch)

IDocuments(const IDocuments& dispatchSrc)

This interface provides access to the collection of all documents currently active in Vdraft.  It is a collection of IDocument objects.

Properties:

Application	(read-only)

Count	(read-only)

Item	(read-only), default

Parent	(read-only)

Methods:

Add

Close

New

Print

Save

Visual Basic Code Sample:

Dim Vdraft, Dox as Objects

Set Vdraft = CreateObject(“Vdraft.Application”)

Set Dox = Vdraft.Documents	‘ get the documents collection


IDocuments::Add

 IDocuments Class Overview

 See Also

IDocument Add(BSTR)

If you pass in no parameter to this function (or an empty VARIANT – see cVariant for more info) if you are working in MSVC -- see cVariant) then this function will create a new document.  It will use whatever the user last used to create a new drawing (current template or prototype drawing).

If you give it a parameter, it assumes that is the name of a specific drawing that is to be loaded up.

If you want to specify a template or prototype, use IDocuments::New.


IDocuments::New

 IDocuments Class Overview

 See Also

IDocument New(BSTR)

This function allows you to create a new drawing using a specific template or prototype drawing.  If you specify no parameter (or pass in an empty VARIANT in C/C++ -- see cVariant), then the new file dialog box will be activated, allowing the user to create the new drawing.


IDocuments::Close()
IDocuments::Close

 IDocuments Class Overview

 See Also

void Close()	(for C/C++ only)

CloseOut	(for VB only)

This closes all open documents.  Equivalent to calling each individual document’s Close method one at a time.

Visual Basic Code Sample:

‘ assuming that ‘Vdraft’ is already initialized for the Vdraft app

Vdraft.Documents.Close


IDocuments::Save

 IDocuments Class Overview

void Save()

Saves all modified drawings without prompting.


IDocuments::Print

 IDocuments Class Overview

void Print()	(for C/C++ only)

void PrintAll()	(for VB only)

Prints all drawings without a print dialog


IDocuments::Count

 IDocuments Class Overview

int Count()	(read-only)

Returns the number of documents currently active in Vdraft.


IDocuments::Item

 IDocuments Class Overview

IDocument Item(short Idx)

Returns an interface to a specific active document in Vdraft.


IDocument

(Interface Overview)

 See Also

C++ Class Constructors:

IDocument()

IDocument(LPDISPATCH pDispatch)

IDocument(const IDocument& dispatchSrc)

This interface provides everything you want to know about or do with or to a particular drawing (document) in Vdraft.  Through this object you will gain access to the various collections and interfaces that exist within a particular drawing.

Properties:

Application	(read-only)

ApplicationIDs	(read-only)

Blocks	(read-only)

Colors	(read-only)

Commands	(read-only)

DimStyles	(read-only)

Entities	(read-only)

EntitySnap	(read-only)

FullName	(read-only)

Header	(read-only)

Layers	(read-only)

Linetypes	(read-only)

Name	(read-only)

NamedViews	(read-only)

Parent	(read-only)

Path	(read-only)

PickEvents	(read-only)

Saved	(read-only)

Selection	(read-only)

SelectionEvents	(read-only)

StatusBar

TextStyles	(read-only)

Ucses	(read-only)

Units	(read-only)

Views	(read-only)

Methods:

Activate

Close

Print

PrintPreview

PrintPreviewClose

PrintSetup

Redraw

Regen

Save

SaveAs

Visual Basic Code Sample:

Dim Vdraft, Dok As Object

Set Vdraft = CreateObject(“Vdraft.Application”)

Idx% = 1	‘ start with first document

‘

‘   loop through all active documents

While Idx% <= Dok.Count

Set Dok = Vdraft.Documents.Item(1)

‘   Dok is now an IDocument object

Print Dok.FullName	‘   display the dwg’s full name

Wend


IDocument::FullName()
IDocument::FullName

 IDocument Class Overview

 See Also

BSTR GetFullName()	(for C/C++ only)

BSTR FullName	(for VB only)

Returns the name of the document plus its path, if it’s been saved.  If it has not yet been saved, then its temporary name (as assigned by Vdraft when the drawing document was started) is what will be returned.  A name can not be assigned to a document without saving that document to disk.


IDocument::Name()
IDocument::Name

 IDocument Class Overview

 See Also

BSTR GetName()	(for C/C++ only)

BSTR Name	(for VB only)

This returns the name of the document, not including its path.  If the drawing has not yet been saved, then the name is the temporary name that Vdraft assigned when the document was first created.


IDocument::Path()
IDocument::Path

 IDocument Class Overview

 See Also

BSTR GetPath()	(for C/C++ only)

BSTR Path	(for VB only)

This returns the path of the drawing, if it has been saved.  If the drawing has not yet been saved, there is no path and the call will return an empty string.


IDocument::Saved()
IDocument::Saved

 IDocument Class Overview

 See Also

BOOL GetSaved()	(for C/C++ only)

BOOL Saved	(for VB only)

Returns TRUE if the current document has no unsaved changes in it.  This is, for example, how you can determine whether then current drawing needs to be saved before exiting your own application.

Visual Basic Code Sample:

‘   ‘Dok’ is the document we have been working with

If Dok.Saved = False Then

‘   ask user if (s)he wants to save the changes or not

    If MsgBox(“Save your Changes?”, 36) = IDYES

        Dok.Save	‘ save it

    End If

End If


IDocument::EntitySnap()
IDocument::EntitySnap

 IDocument Class Overview

 See Also

IEntitySnap GetEntitySnap()	(for C/C++ only)

IEntitySnap EntitySnap	(for VB only)

Returns an interface to an IEntitySnap.  That is, the group of all the entity snap settings.


IDocument::StatusBar()
IDocument::StatusBar

 IDocument Class Overview

SetStatusBar()	(for C/C++ only)

StatusBar	(for VB only)

This value is write-only.  That is, you can set it, but you can not read its current value.

This interface allows you to display messages for the user using Vdraft’s own status bar text area.  This is useful for putting up messages for the user, such as progress messages (e.g., “now working on part 3…”), etc.  Combined with custom Cursor Tips, this is also a very effective method for providing the user with prompting about what (s)he needs to do next.

NOTE: Important Flash!  If the document you are working with does not currently have the foreground focus, the status bar will not update immediately.  It will update once the drawing becomes active (e.g., gets clicked on by the user or your own app issues an Activate on that drawing).

Visual Basic Code Sample:

Dim Vdraft As Object

Set Vdraft = CreateObject(“Vdraft.Application”)

Vdraft.ActiveDocument.StatusBar = “This is a test message”


IDocument::PickEvents()
IDocument::PickEvents

 IDocument Class Overview

 See Also

IPickEvents PickEvents()

Returns the IPickEvents interface for the given document.


IDocument::Units()
IDocument::Units

 IDocument Class Overview

 See Also

IUnits GetUnits()	(for C/C++ only)

IUnits Units	(for VB only)

Returns an interface to the units in the drawing.  Allows you access to retrieving or changing the current units settings.


IDocument::Entities()
IDocument::Entities

 IDocument Class Overview

 See Also

IEntities GetEntities()	(for C/C++ only)

IEntities Entities	(for VB only)

Returns an interface to the collection of all entities in the drawing.  This is your first step in accessing, creating, deleting or altering drawing entities.


IDocument::Layers()
IDocument::Layers

 IDocument Class Overview

 See Also

ILayers GetLayers()	(for C/C++ only)

ILayers Layers	(for VB only)

Returns an interface to the layers table in the drawing.  It is a collection of ILayer objects


IDocument::Linetypes()
IDocument::Linetypes

 IDocument Class Overview

 See Also

ILineTypes GetLinetypes()	(for C/C++ only)

ILineTypes Linetypes	(for VB only)

Returns an interface to the linetypes table in the drawing.  The linetypes table is a collection of all the ILinetype objects currently in the drawing.  This object also gains you access to creating new ones.

Complete code for the LineTyper application is included with Vdraft.  This application is a tool for creating, editing and viewing line types in any loaded drawing.  It is a Visual Basic applcation.  Look in Vdraft\Programs\VB\LineType.


IDocument::Blocks()
IDocument::Blocks

 IDocument Class Overview

 See Also

IBlocks GetBlocks()	(for C/C++ only)

IBlocks Blocks	(for VB only)

Returns an interface to the blocks table in the drawing.  The blocks table is a collection of IBlock objects.


IDocument::DimStyles()
IDocument::DimStyles

 IDocument Class Overview

 See Also

IDimStyles GetDimStyles()	(for C/C++ only)

IDimStyles DimStyles	(for VB only)

Returns an interface to the dimension styles table in the drawing.  It is a collection of IDimStyle objects.


IDocument::TextStyles()
IDocument::TextStyles

 IDocument Class Overview

 See Also

ITextStyles GetTextStyles()	(for C/C++ only)

ITextStyles TextStyles	(for VB only)

Returns an interface to all of the text styles currently in the drawing.  From here you can add new ones, remove or change existing ones.


IDocument::Redraw()
IDocument::Redraw

 IDocument Class Overview

void Redraw()

Causes the document to redraw itself.  See also Regen.


IDocument::Regen()
IDocument::Regen

 IDocument Class Overview

void Regen()

Causes the document to be completely regenerated.  See also Redraw


IDocument::Ucses()
IDocument::Ucses

 IDocument Class Overview

 See Also

IUcses GetUcses()	(for C/C++ only)

IUcses Ucses	(for VB only)

Returns an interface to the collection of saved UCSes in the drawing.


IDocument::NamedViews()
IDocument::NamedViews

 IDocument Class Overview

 See Also

INamedViews GetNamedViews()	(for C/C++ only)

INamedViews NamedViews	(for VB only)

Returns an interface to the current named views in the drawing.  That is, this is the way to gain access to the named views in the drawing or create new ones.


IDocument::Views()
IDocument::Views

 IDocument Class Overview

 See Also

IViews GetViews()	(for C/C++ only)

IViews Views	(for VB only)

Returns an interface to all the views currently in the drawing.


IDocument::Commands()
IDocument::Commands

 IDocument Class Overview

 See Also

ICommands GetCommands()	(for C/C++ only)

ICommands Commands	(for VB only)

Returns an interface to the Commands object in the drawing.  This allows you access to such things as the Undo/Redo list, as well as executing macro commands and especially for grouping together whole series of commands under one entry in the Undo list.


IDocument::Colors()
IDocument::Colors

 IDocument Class Overview

 See Also

IColors GetColors()	(for C/C++ only)

IColors Colors	(for VB only)

Returns an interface pointer to the color palette in the drawing.

Visual Basic Code Sample:

The follow VB code sample will print out the string “Red”, because color entry 1 has the name “Red”

‘   assume that ‘Vdraft’ object is already initialized

Dim Kolor As Object

Set Kolor = Vdraft.ActiveDocument.Colors

Print Vdraft.ActiveDocument.Colors.Item(1)


IDocument::Selection()
IDocument::Selection

 IDocument Class Overview

 See Also

ISelection GetSelection()	(for C/C++ only)

ISelection Selection	(for VB only)

Returns an interface to the current selection set.  There is always a current selection set, though it may not always have anything in it.


IDocument::Activate()
IDocument::Activate

 IDocument Class Overview

 See Also

void Activate()

Causes the drawing to become active.  This also gives Vdraft focus if it does not already have it.  Activating a drawing will also allow the status bar to update its text.

Visual Basic Code Sample:

‘ MyDok is the document you have been working with

MyDok.Activate

MyDok.StatusBar = “My User Prompt Message”


IDocument::ApplicationIDs()
IDocument::ApplicationIDs

 IDocument Class Overview

 See Also

IApplicationIDs GetApplicationIDs()	(for C/C++ only)

ApplicationIDs	(for VB only)

Allows you to registser your application with in a drawing by name, and to retrieve the collection of all application names currently active in Vdraft.

This has use when dealing with IXData on a particular entity.  Because any amount of XData may be attached to any entity, and because any number of applications might be doing work on a given drawing, there must be a way for one application to recognize its data from that of another application.  The ApplicationID gives you this.

When moving through XData on a particular entity, you will ordinarily search through all of the XData looking for your own application name.  From that point on the data belongs to your application, until you reach a new ApplicationID.


IDocument::Header()
IDocument::Header

 IDocument Class Overview

IHeaderGetHeader()	(for C/C++ only)

Returns an interface to the drawing variables (sometimes called “system variables” or “header variables”).

See Also: IHeader


IDocument::Print()
IDocument::Print

 IDocument Class Overview

 See Also

void Print(VARIANT copies)	(for C/C++ only)

void PrintOut (VARIANT copies)	(for VB only)

Prints this drawing.  No dialog box, no passing go first.  Just print it out now.  Copies specifies the number of copies to be printed.


IDocument::PrintPreview()
IDocument::PrintPreview

 IDocument Class Overview

 See Also

void PrintPreview()

Activates the Print Preview dialog box.


IDocument::PrintPreviewClose

 IDocument Class Overview

 See Also

void PrintPreviewClose()

Closes the Print Preview dialog box.


IDocument::PrintSetup()
IDocument::PrintSetup

 IDocument Class Overview

 See Also

void PrintSetup()

Activates the Print Setup dialog box.


IDocument::Save()
IDocument::Save

 IDocument Class Overview

 See Also

void Save()

Save changes to disk.  If the file has ever been saved, does not require a file name.  If the file has not yet been saved, this will bring up a SaveAs dialog box for the user to fill in the file name and path information.


IDocument::SaveAs()
IDocument::SaveAs

 IDocument Class Overview

 See Also

void SaveAs(BSTR filename)

Save the drawing to the indicated file name.  If no file name is specified, then the save as dialog box will be activated.

Visual Basic Code Sample:

Vdraft.Activedocument.SaveAs ""	‘ bring up the save as dialog box


IDocument::Close()
IDocument::Close

 IDocument Class Overview

 See Also

void Close(const VARIANT& saveChanges, const VARIANT& filename)	(for C/C++ only)

void CloseOut(const VARIANT& saveChanges, const VARIANT& filename) 	(for VB only)

Closes the document.  For Visual Basic, use CloseOut (“Close” is a reserved word in VB).


IDocument::SelectionEvents()
IDocument::SelectionEvents

 IDocument Class Overview

ISelectionEvents GetSelectionEvents()	(for C/C++ only)

ISelectionEvents SelectionEvents	(for VB only)

Returns an interface to the current selection set.


IGridSnap

(Interface Overview)

C++ Class Constructors:

IGridSnap()

IGridSnap(LPDISPATCH pDispatch)

IGridSnap(const IGridSnap& dispatchSrc)

This interface contains all the settings for grid snap.  Whether it’s on or not, the size and spacing of the grid, etc.

Properties: Application (read-only) Display DisplaySpacing Isometric IsometricSpacing Origin Parent (read-only) Snap SnapSpacing Methods: Dialog Update


IGridSnap::Display()
IGridSnap::Display

 IGridSnap Class Overview

BOOL GetDisplay()	(for C/C++ only)

BOOL SetDisplay()	(for C/C++ only)

BOOL Display()	(for VB only)

Display the grid on the screen or not?


IGridSnap::Snap()
IGridSnap::Snap

 IGridSnap Class Overview

BOOL GetSnap()	(for C/C++ only)

void SetSnap(BOOL)	(for C/C++ only)

Snap(BOOL)	(for VB only)

Is the Grid Snap on or off?


IGridSnap::DisplaySpacing

 IGridSnap Class Overview

IVector GetDisplaySpacing()	(for C/C++ only)

void SetDisplaySpacing(IVector)	(for C/C++ only)

DisplaySpacing(IVector)	(for VB only)

What’s the displayed spacing of the grid, if it’s visible?  This defaults to Same As Snap.  Uses and IVector object for setting or getting the value since spacing can be set differently in X and Y directions.


IGridSnap::SnapSpacing()
IGridSnap::SnapSpacing

 IGridSnap Class Overview

IVector GetSnapSpacing()	(for C/C++ only)

void SetSnapSpacing(IVector vec)	(for C/C++ only)

SnapSpacing(IVector vec)	(for VB only)

What’s the spacing between the nodes of the grid?


IGridSnap::Origin()
IGridSnap::Origin

 IGridSnap Class Overview

IVector GetOrigin()	(for C/C++ only)

void SetOrigin(IVector)	(for C/C++ only)

Origin(IVector)	(for VB only)

The coordinates in the drawing for the center point of the grid.


IGridSnap::Update()
IGridSnap::Update

 IGridSnap Class Overview

void Update

Causes the screen display to update.  You can make several changes at once to the grid, then call Update.  This way the user sees it change only once.


IGridSnap::Isometric

 IGridSnap Class Overview

BOOL GetIsometric()	(for C/C++ only)

void SetIsometric(BOOL)	(for C/C++ only)

BOOL Isometric(BOOL)	(for VB only)

Turn Isometric grid snap on or off.


IGridSnap::IsometricSpacing

 IGridSnap Class Overview

double GetIsometricSpacing()	(for C/C++ only)

void SetIsometricSpacing(double)	(for C/C++ only)

double IsometricSpacing(double)	(for VB only)

Get or Set the Isometric Grid Snap spacing.


IAngleSnap

(Interface Overview)

C++ Class Constructors:

IAngleSnap()

IAngleSnap(LPDISPATCH pDispatch)

IAngleSnap(const IAngleSnap& dispatchSrc)

The settings and values related to Angle Snap.

Properties: Application (read-only) Parent (read-only) Angle BaseAngle Ortho Snap Methods: Dialog


IAngleSnap::Snap()
IAngleSnap::Snap

 IAngleSnap Class Overview

BOOL GetSnap()	(for C/C++ only)

void SetSnap(BOOL)	(for C/C++ only)

Snap(BOOL)	(for VB only)

Is Angle Snap on or off?  You can read it or set it as you need.


IAngleSnap::Angle()
IAngleSnap::Angle

 IAngleSnap Class Overview

double GetAngle()	(for C/C++ only)

void SetAngle(double)	(for C/C++ only)

Angle(double)	(for VB only)

The Angle setting for the Angle Snap.  That is, what angles from the base point will we snap to.


IAngleSnap::BaseAngle()
IAngleSnap::BaseAngle

 IAngleSnap Class Overview

double GetBaseAngle()	(for C/C++ only)

void SetBaseAngle(double)	(for C/C++ only)

BaseAngle(double)	(for VB only)

Same as the Base Angle setting in the Angle Snap dialog box.


IAngleSnap::Ortho

 IAngleSnap Class Overview

BOOL GetOrtho()	(for C/C++ only)

void SetOrtho(BOOL)	(for C/C++ only)

BOOL Ortho(BOOL)	(for VB only)

Sets or Gets the ortho angle snap setting.


IAngleSnap::Dialog

 IAngleSnap Class Overview

void Dialog()

Activates the angle snap dialog box in Vdraft.


IEntities

(Interface Overview)

C++ Class Constructors:

IEntities()

IEntities(LPDISPATCH pDispatch)

IEntities(const IEntities& dispatchSrc)

This interface gives you access to the entities that actually make up the drawing.

Available Interfaces:

Application	(read-only)

Parent	(read-only)

Add3DPolyline

AddArc

AddAttdef

AddCircle

AddDimension

AddFace

AddInsert

AddLine

AddPoint

AddPolyface

AddPolymesh

AddShape

AddSolid

AddText

AddTrace

AddViewport

Count	(read-only)

Draw2DCubicSpline

Draw2DPolyline

Draw2DQuadraticSpline

Draw2DSpline

Draw2PointCircle

Draw2PointRectangle

Draw3DCubicSpline

Draw3DPolyline

Draw3DQuadraticSpline

Draw3DSpline

Draw3PointArc

Draw3PointArcs

Draw3PointCircle

Draw3PointRectangle

DrawAlignedDim

DrawAngularDim

DrawAttdef

DrawBaselineDim

DrawCenterMidpointPolygon

DrawCenterStartEndArc

DrawCenterVertexPolygon

DrawCircle

DrawContinuousDim

DrawDiameterDim

DrawDonut

DrawDoubleLine

DrawDoubleLines

DrawEdgePolygon

DrawFace

DrawHorizontalDim

DrawInsert

DrawLeader

DrawLine

DrawLines

DrawOrdinateXDim

DrawOrdinateYDim

DrawPoint

DrawRadiusDim

DrawRotatedDim

DrawSolid

DrawStartCenterEndArc

DrawStartDirectionEndArc

DrawStartEndCenterArc

DrawText

DrawTrace

DrawVerticalDim

DrawViewport


IEntities::Count()
IEntities::Count

 IEntities Class Overview

long Count()

Gives you the number of entities in the drawing.  New drawings default to zero, of course.


IEntities::Last()
IEntities::Last

 IEntities Class Overview

LPDISPATCH GetLast()	(for C/C++ only)

LPDISPATCH Last	(for VB only)

Returns the entity that was last added to the drawing.

From C++, you may want to first retrieve to object as an IEntity, use the Type() property to find out what sort of entity it is exactly and then re-retrieve it as that type of entity.  Or not, if IEntity contains all the properties or methods you need.

Visual Basic Code Sample:

‘   draw a line from 0,0 to 10,10

Vdraft.ActiveDocument.Entities.AddLine()

Vdraft.ActiveDocument.Entities.Last.Where1.Set(0,0)

Vdraft.ActiveDocument.Entities.Last.Where1.Set(10,10)


IEntities::Item()
IEntities::Item

 IEntities Class Overview

 See Also

LPDISPATCH GetItem(BSTR handle)	(for C/C++ only)

LPDISPATCH GetItem(long index)

LPDISPATCH Item(BSTR handle)	(for VB only)

LPDISPATCH Item(long index)

Returns the indicated entity, either by its name or as the nth entity in the entities group.  The function returns an LPDISPATCH that may be used to create an IEntity object or an object of the actual type this entity is, such an ILine.  (VB need not worry about that too much; it’s just another object to VB.)

It can be helpful when browsing through the entire entities list, either for the heck of it or because you are looking for something in particular, to retrieve everything first as an IEntity object, then find out what its type is (IEntity.Type()).  This will tell you whether its a line, circle, pface mesh or whatever.  Then, if you wish to do something more with that entity, you can re-retrieve it as the correct type of object.

A Handle is unique value that identities a given entity.

Visual Basic Code Sample:

Dim Ent as Object

Set Ent = Vdraft.ActiveDocument.Entities.Item(1)	‘ get first entity in list


IEntities::Add3DPolyline

 IEntities Class Overview

I3DPolyline Add3DPolyline(short numvertices)

Creates a new 3D Polyline object of the given number of vertices.  The number of vertices in a 3DPolyline object can not be changed once it is set.  So to add more nodes to an existing polyline, you would need to create a new polyline of the desired size and then copy the nodes from the existing polyline into it.


IEntities::AddAttdef()
IEntities::AddAttdef

 IEntities Class Overview

IAttdef AddAttdef()

Creates a new Attribute Definition (Attdef) entity in the drawing.


IEntities::AddCircle()
IEntities::AddCircle

 IEntities Class Overview

ICircle AddCircle()

Creates a new circle in the given drawing.

Visual Basic Code Sample:

Sub DrawCircle()

‘   get Vdraft

Dim Vdraft, NewCirc As Object

Set Vdraft = CreateObject(“Vdraft.Application”)

‘   create new circle

Set NewCirc = Vdraft.ActiveDocument.Entities.AddCircle()

NewCirc.Where.Set 10, 10

NewCirc.Radius = 1.414

End Sub

C/C++ Code Sample:

This code performs the same function as the above VB example, with the same assumptions.  As soon as the function returns, the variable NewCirc goes out of scope, releasing the entity, which causes it automatically update itself and show up on the drawing screen.

void DrawCircle()

{

//	there is no error checking shown here in this example.  Ordinarily, you

//	would check each return value as well as all your asumptions first.

IVdraft Vdraft;	// grab vdraft.

Vdraft.CreateDispatch("Vdraft.Application", NULL);

IDocument Doc(Vdraft.GetActiveDocument());	// for currently active doc

IEntities Ents(Doc.GetEntities());	// the drawing entities

ICircle NewCirc(Ents.AddCircle());	// create a new line

IVector where1(NewCirc.Where());	// start point of line

where.Set2D(10, 10);	// set it

NewCirc.SetRadius(1.414);	// set radius of circle

}


IEntities::AddArc()
IEntities::AddArc

 IEntities Class Overview

IArc AddArc()

Creates a new arc entity.  The parameters for the arc will then need to be set separately.  All values default to zero.


IEntities::AddDimension()
IEntities::AddDimension

 IEntities Class Overview

IDimension AddDimension()

Creates a new dimension entity in the given drawing.  All values default to zero and will need to be set separately.


IEntities::AddFace()
IEntities::AddFace

 IEntities Class Overview

IFace AddFace()

Creates a new face entity in the drawing.  The vertex points for the corners will need to set and the entity updated (either explicity or because the object goes out of scope) before it will show up.


IEntities::AddInsert()
IEntities::AddInsert

 IEntities Class Overview

IInsert AddInsert(BSTR blockname)

Creates a new insertion of an existing block in the drawing.  You will need to set its basepoint separately to give it the correct location in the drawing.


IEntities:: AddLine()
IEntities::AddLine

 IEntities Class Overview

ILine AddLine()

Creates a new line entity in the drawing.  You will need to set the line’s Where1 and Where2 points separately.


IEntities::AddText()
IEntities::AddText

 IEntities Class Overview

IText AddText()

Creates a new text entity in the drawing.  You must then set its values, including its location in the drawing and its text content.


IEntities::AddPoint()
IEntities::AddPoint

 IEntities Class Overview

IPoint AddPoint()

Creates a new point entity in the drawing.  You must then set its Where parameter.


IEntities::AddPolyface()
IEntities::AddPolyface

 IEntities Class Overview

IPolyface AddPolyface(short numvertices, short numfaces)

Creates a new polyface object of the given number of vertices.  The number of vertices and faces in a polyface object can not be changed once it is set.  So to add more nodes to an existing polyline, you would need to create a new polyface object of the desired size and then copy the nodes from the existing polyface into it.


IEntities::AddPolymesh()
IEntities::AddPolymesh

 IEntities Class Overview

IPolymesh AddPolymesh(short numrows,short numcolumns)

Creates a new polymesh object in the drawing.  You set the number of rows and columns in this polymesh when you create it.  You can not alter these values once they are set.  The only way to enlarge a polymesh object is to create a new one of the desired larger size and then copy the existing nodes into the new structure as desired.


IEntities::AddShape()
IEntities::AddShape

 IEntities Class Overview

IShape AddShape()

Creates a new shape object for the current drawing.  You must then set its values.


IEntities::AddSolid()
IEntities::AddSolid

 IEntities Class Overview

ISolid AddSolid()

Creates a new solid (a filled 2D region) in the given drawing.


IEntities::AddTrace()
IEntities::AddTrace

 IEntities Class Overview

ITrace AddTrace()

Creates a new trace (wide, filled polyline sort-of-thing) to the given drawing.  You must then specify its parameters separately.


IEntities::AddViewport()
IEntities::AddViewport

 IEntities Class Overview

IViewport AddViewport()

Don’t use this.  Use IViews::Add


IEntities::Draw2DCubicSpline()
IEntities::Draw2DCubicSpline

 IEntities Class Overview

void Draw2DCubicSpline()

Initiates a 2D Cubic Spline creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.


IEntities::Draw2DPolyline()
IEntities::Draw2DPolyline

 IEntities Class Overview

void Draw2DPolyline()

Initiates a 2D Polyline creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.


IEntities::Draw2DQuadracticSpline()
IEntities::Draw2DQuadraticSpline

 IEntities Class Overview

void Draw2DQuadraticSpline()

Initiates a 2D Quadratic Spline creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.


IEntities::Draw2DSpline

 IEntities Class Overview

void Draw2DSpline()

Initiates a 2D Spline creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.


IEntities::Draw2PointCircle()
IEntities::Draw2PointCircle

 IEntities Class Overview

void Draw2PointCircle()

Initiates a 2 Point Circle creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.


IEntities::Draw2PointRectangle()
IEntities::Draw2PointRectangle

 IEntities Class Overview

void Draw2PointRectangle()

Initiates a 2 Point Rectangle creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.


IEntities::Draw3DCubicSpline()
IEntities::Draw3DCubicSpline

 IEntities Class Overview

void Draw3DCubicSpline()

Initiates a 3D Cubic Spline creation process for the user to participate in.    Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.


IEntities::Draw3DPolyline()
IEntities::Draw3DPolyline

 IEntities Class Overview

void Draw3DPolyline()

Initiates a 3D polyline creation process for the user to participate in.    Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.


IEntities::Draw3DQuadraticSpline()
IEntities::Draw3DQuadraticSpline

 IEntities Class Overview

void Draw3DQuadraticSpline()

Initiates a 3D Quadratic Spline creation process for the user to participate in.    Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.


IEntities::Draw3DSpline()
IEntities::Draw3DSpline

 IEntities Class Overview

void Draw3DSpline()

Initiates a 3D Spline creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.


IEntities::Draw3PointArc()
IEntities::Draw3PointArc

 IEntities Class Overview

void Draw3PointArc()

Initiates a 3 Point Arc creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.


IEntities::Draw3PointArcs()
IEntities::Draw3PointArcs

 IEntities Class Overview

void Draw3PointArcs()

Initiates a 3 Point Arcs creation process for the user to participate in.    Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.


IEntities::Draw3PointCircle()
IEntities::Draw3PointCircle

 IEntities Class Overview

void Draw3PointCircle()

Initiates a 3 Point Circle creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.


IEntities::Draw3PointRectangle()
IEntities::Draw3PointRectangle

 IEntities Class Overview

void Draw3PointRectangle()

Initiates a 3 Point Rectangle creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.


IEntities::DrawAlignedDim()
IEntities::DrawAlignedDim

 IEntities Class Overview

void DrawAlignedDim(const VARIANT& what);

Initiates a Aligned Dimension creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.

The optional parameter goes like this:

No Parameter	same as menu pick - if an entity is selected, 	same as passing the entity otherwise same as passing FALSE

FALSE	prompts for 1st point of dimension

IEntity (or other entity object)	dimensions entity - prompts for final pick


IEntities::DrawAngularDim()
IEntities::DrawAngularDim

 IEntities Class Overview

void DrawAngularDim(const VARIANT& what);

Initiates a Angular Dimension creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.

The optional parameter goes like this:

No Parameter	same as menu pick - if an entity is selected, 	same as passing the entity otherwise same as passing FALSE

FALSE	prompts for 1st point of dimension

IEntity (or other entity object)	dimensions entity - prompts for final pick


IEntities::DrawAttdef()
IEntities::DrawAttdef

 IEntities Class Overview

void DrawAttdef()

Initiates a Attribute Definition creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.


IEntities::DrawBaselineDim()
IEntities::DrawBaselineDim

 IEntities Class Overview

void DrawBaselineDim(const VARIANT& what);

Initiates a Baseline Dimension creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.

The optional parameter goes like this:

No Parameter	same as menu pick - if an entity is selected, 	same as passing the entity otherwise same as passing FALSE

FALSE	prompts for 1st point of dimension

IEntity (or other entity object)	dimensions entity - prompts for final pick


IEntities::DrawCenterMidpointPolygon()
IEntities::DrawCenterMidpointPolygon

 IEntities Class Overview

void DrawCenterMidpointPolygon()

Initiates a Center Midpoint Polygon creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.


IEntities::DrawCenterStartEndArc()
IEntities::DrawCenterStartEndArc

 IEntities Class Overview

void DrawCenterStartEndArc()

Initiates a Center-Start-End Arc creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.

NOTE: From C++, is possible to use this function in such a way as to specify a start point, center point and ending angle, rather than an ending point.  By using the Trigger functions, TriggerAngle, TriggerPick.


IEntities::DrawCenterVertexPolygon()
IEntities::DrawCenterVertexPolygon

 IEntities Class Overview

void DrawCenterVertexPolygon()

Initiates a Center Vertex polygon creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.


IEntities::DrawCircle()
IEntities::DrawCircle

 IEntities Class Overview

void DrawCircle()

Initiates a Circle creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.


IEntities::DrawContinuousDim()
IEntities::DrawContinuousDim

 IEntities Class Overview

void DrawContinuousDim(const VARIANT& what);

Initiates a Continuous dimension creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.

The optional parameter goes like this:

No Parameter	same as menu pick - if an entity is selected, 	same as passing the entity otherwise same as passing FALSE

FALSE	prompts for 1st point of dimension

IEntity (or other entity object)	dimensions entity - prompts for final pick


IEntities::DrawDiameterDim()
IEntities::DrawDiameterDim

 IEntities Class Overview

void DrawDiameterDim(const VARIANT& what);

Initiates a Diameter dimension creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.

The optional parameter goes like this:

No Parameter	same as menu pick - if an entity is selected, 	same as passing the entity otherwise same as passing FALSE

FALSE	prompts for 1st point of dimension

IEntity (or other entity object)	dimensions entity - prompts for final pick


IEntities::DrawDonut()
IEntities::DrawDonut

 IEntities Class Overview

void DrawDonut()

Initiates a donut creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.


IEntities::DrawDoubleLine()
IEntities::DrawDoubleLine

 IEntities Class Overview

void DrawDoubleLine()

Initiates a single double line creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.


IEntities:: DrawDoubleLines()
IEntities::DrawDoubleLines

 IEntities Class Overview

void DrawDoubleLines()

Initiates a multiple double line creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.


IEntities:: DrawEdgePolygon()
IEntities::DrawEdgePolygon

 IEntities Class Overview

void DrawEdgePolygon()

Initiates a edge polygon creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.


IEntities::DrawFace()
IEntities::DrawFace

 IEntities Class Overview

void DrawFace()

Initiates a face creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.


IEntities:: DrawHorizontalDim()
IEntities::DrawHorizontalDim

 IEntities Class Overview

void DrawHorizontalDim(const VARIANT& what);

Initiates a horizontal dimension creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.

The optional parameter goes like this:

No Parameter	same as menu pick - if an entity is selected, 	same as passing the entity otherwise same as passing FALSE

FALSE	prompts for 1st point of dimension

IEntity (or other entity object)	dimensions entity - prompts for final pick


IEntities::DrawInsert()
IEntities::DrawInsert

 IEntities Class Overview

void DrawInsert(BSTR which)

void DrawInsert(long which)

Initiates a block insertion creation process for the user to participate in.  The only parameter it takes is the name or the blocks table index of the block being inserted.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.


IEntities:: DrawLeader()
IEntities::DrawLeader

 IEntities Class Overview

void DrawLeader()

Initiates a leader creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.


IEntities::DrawLine()
IEntities::DrawLine

 IEntities Class Overview

void DrawLine()

Initiates a single line creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.


IEntities::DrawLines()
IEntities::DrawLines

 IEntities Class Overview

void DrawLines()

Initiates a multiple line creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.


IEntities::DrawOrdinateXDim()
IEntities::DrawOrdinateXDim

 IEntities Class Overview

void DrawOrdinateXDim(const VARIANT& what);

Initiates a ordinate X dimension creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.

The optional parameter goes like this:

No Parameter	same as menu pick - if an entity is selected, 	same as passing the entity otherwise same as passing FALSE

FALSE	prompts for 1st point of dimension

IEntity (or other entity object)	dimensions entity - prompts for final pick


IEntities::DrawOrdinateYDim()
IEntities::DrawOrdinateYDim

 IEntities Class Overview

void DrawOrdinateYDim(const VARIANT& what);

Initiates a ordinate Y dimension creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.

The optional parameter goes like this:

No Parameter	same as menu pick - if an entity is selected, 	same as passing the entity otherwise same as passing FALSE

FALSE	prompts for 1st point of dimension

IEntity (or other entity object)	dimensions entity - prompts for final pick


IEntities::DrawPoint()
IEntities::DrawPoint

 IEntities Class Overview

void DrawPoint()

Initiates a point creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.


IEntities::DrawRadiusDim()
IEntities::DrawRadiusDim

 IEntities Class Overview

void DrawRadiusDim(const VARIANT& what);

Initiates a radius dimension creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.

The optional parameter goes like this:

No Parameter	same as menu pick - if an entity is selected, 	same as passing the entity otherwise same as passing FALSE

FALSE	prompts for 1st point of dimension

IEntity (or other entity object)	dimensions entity - prompts for final pick


IEntities::DrawRotatedDim()
IEntities::DrawRotateDim

 IEntities Class Overview

void DrawRotatedDim(const VARIANT& what);

Initiates a rotated dimension creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you

are looking at setting up draw event notifications.  See IPickEvents for more information.

The optional parameter goes like this:

No Parameter	same as menu pick - if an entity is selected, 	same as passing the entity otherwise same as passing FALSE

FALSE	prompts for 1st point of dimension

IEntity (or other entity object)	dimensions entity - prompts for final pick


IEntities::DrawSolid()
IEntities::DrawSolid

 IEntities Class Overview

void DrawSolid()

Initiates a sold (2D filled region) creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.


IEntities::DrawStartCenterEndArc()
IEntities::DrawStartCenterEndArc

 IEntities Class Overview

void DrawStartCenterEndArc()

Initiates a start-center-end arc creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.


IEntities::DrawStartDirectionEndArc()
IEntities::DrawStartDirectionEndArc

 IEntities Class Overview

void DrawStartDirectionEndArc()

Initiates a start-direction-end arc creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.


IEntities::DrawStartEndCenterArc()
IEntities::DrawStartEndCenterArc

 IEntities Class Overview

void DrawStartEndCenterArc()

Initiates a start-end-center arc creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.


IEntities:: DrawText()
IEntities::DrawText

 IEntities Class Overview

void DrawText()

Initiates a text creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.


IEntities::DrawTrace()
IEntities::DrawTrace

 IEntities Class Overview

void DrawTrace()

Initiates a trace (filled or wide polyline-like thing) creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.


IEntities:: DrawVerticalDim()
IEntities::DrawVerticalDim

 IEntities Class Overview

void DrawVerticalDim(const VARIANT& what);

Initiates a vertical dimension creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.

The optional parameter goes like this:

No Parameter	same as menu pick - if an entity is selected, 	same as passing the entity otherwise same as passing FALSE

FALSE	prompts for 1st point of dimension

IEntity (or other entity object)	dimensions entity - prompts for final pick


IEntities:: DrawViewport()
IEntities::DrawViewport

 IEntities Class Overview

void DrawViewport()

Initiates a trace (filled or wide polyline-like thing) creation process for the user to participate in.  Returns immediately, does not wait for the entity to be created.  If you need to know that the entity is finished, or need other feedback during its creation, or wish to control some of the creation of it but let the user do some of it also, then you are looking at setting up draw event notifications.  See IPickEvents for more information.


IEntitySnap

(Interface Overview)

C++ Class Constructors:

IEntitySnap()

IEntitySnap(LPDISPATCH pDispatch)

IEntitySnap(const IEntitySnap& dispatchSrc)

This is the collection of entity snap settings.  Is EndPoint snap on?  Is Intersection snap on?  Or should they be on?  Or Off?  This is your collection for that stuff.

Properties: Application (read-only) Center Endpoint Insertion Intersection Midpoint Nearest Parent (read-only) Perpendicular PointSnap Quadrant Snap SnapToSelection Tangent Properties: Dialog


IEntitySnap::Snap()
IEntitySnap::Snap

 IEntitySnap Class Overview

BOOL GetSnap()	(for C/C++ only)

void SetSnap(BOOL)	(for C/C++ only)

BOOL Snap	(for VB only)

Turns Snap on or off


IEntitySnap::SnapToSelection()
IEntitySnap::SnapToSelection

 IEntitySnap Class Overview

BOOL GetSnapToSelection()	(for C/C++ only)

void SetSnapToSelection(BOOL)	(for C/C++ only)

BOOL SnapToSelection	(for VB only)

Snaps to the selection set only.


IEntitySnap::Endpoint()
IEntitySnap::Endpoint

 IEntitySnap Class Overview

BOOL GetEndpoint()	(for C/C++ only)

void SetEndpoint(BOOL)	(for C/C++ only)

BOOL Endpoint	(for VB only)

This is the Snap to Endpoint setting.  Read it, or set it as you wish.


IEntitySnap::Midpoint()
IEntitySnap::Midpoint

 IEntitySnap Class Overview

BOOL GetMidpoint()	(for C/C++ only)

void SetMidpoint(BOOL)	(for C/C++ only)

BOOL Midpoint	(for VB only)

This is the Midpoint Snap setting.  Will the cursor snap to the midpoint of whatever entity?


IEntitySnap::Center()
IEntitySnap::Center

 IEntitySnap Class Overview

BOOL GetCenter()	(for C/C++ only)

void SetCenter(BOOL)	(for C/C++ only)

BOOL Center	(for VB only)

This is Center Snap setting.  Snap to the center of a circle.


IEntitySnap::Nearest

 IEntitySnap Class Overview

BOOL GetNearest()	(for C/C++ only)

void SetNearest(BOOL)	(for C/C++ only)

BOOL Nearest	(for VB only)

This is the Snap to Nearest Point snap setting.  It causeth the cursor to find the very nearest point on any entity.


IEntitySnap::PointSnap()
IEntitySnap::PointSnap

 IEntitySnap Class Overview

BOOL GetPointSnap()	(for C/C++ only)

void SetPointSnap(BOOL)	(for C/C++ only)

BOOL PointSnap	(for VB only)

This is the Snap to Point setting.  Makes the cursor think Points are good and likely things.


IEntitySnap::Quadrant()
IEntitySnap::Quadrant

 IEntitySnap Class Overview

BOOL GetQuadrant()	(for C/C++ only)

void SetQuadrant(BOOL)	(for C/C++ only)

BOOL Quadrant	(for VB only)

This is the Snap to Quadrant setting, useful for hunting out the quadrant points on a circle and “snapping” right to them.


IEntitySnap::Insertion()
IEntitySnap::Insertion

 IEntitySnap Class Overview

BOOL GetInsertion()	(for C/C++ only)

void SetInsertion(BOOL)	(for C/C++ only)

BOOL Insertion	(for VB only)

This is the Snap to Insertion setting.  It refers to the insertion point of blocks.


IEntitySnap::Perpendicular()
IEntitySnap::Perpendicular

 IEntitySnap Class Overview

BOOL GetPerpendicular()	(for C/C++ only)

void SetPerpendicular(BOOL)	(for C/C++ only)

BOOL Perpendicular	(for VB only)

This is the Snap to Perpendicular setting.  Set it On or Off as you wish.


IEntitySnap::Tangent()
IEntitySnap::Tangent

 IEntitySnap Class Overview

BOOL GetTangent()	(for C/C++ only)

void SetTangent(BOOL)	(for C/C++ only)

BOOL Tangent	(for VB only)

This is the Snap to Tangent setting.  Snap tangent to a circle or arc.


IEntitySnap::Intersection()
IEntitySnap::Intersection

 IEntitySnap Class Overview

BOOL GetIntersection()	(for C/C++ only)

void SetIntersection(BOOL)	(for C/C++ only)

BOOL Intersection	(for VB only)

This is the Snap to Intersection of two or more entities.


IEntitySnap::Dialog

 IEntitySnap Class Overview

void Dialog()	(for C/C++ only)

void Dialog	(for VB only)

This method activates the entity snap dialog box.


IEntitySet

(Interface Overview)

API Overview

 See Also

C++ Class Constructors:

IEntitySet()

IEntitySet(LPDISPATCH pDispatch)

IEntitySet(const IEntitySet& dispatchSrc)

This is a collection of entities.

Available Interfaces:

Application	(read-only)

Parent	(read-only)

Count	(read-only)

Item	(read-only)

Add

Remove

RemoveAll


IEntitySet::Count()
IEntitySet::Count

 IEntitySet Class Overview

long Count()

The number of entities that are in the collection.


IEntitySet::Item()
IEntitySet::Item

 IEntitySet Class Overview

IEntity GetItem(BSTR handle)	(for C/C++ only)

IEntity GetItem(long index)

IEntity Item(BSTR handle)	(for VB only)

IEntity Item(long index)

Get an entity from the collection.  The parameter can either be an index (long) or an entity handle (BSTR).


IEntitySet::Add()
IEntitySet::Add

 IEntitySet Class Overview

void Add(IEntity entity)

Adds the specified entity to the entity set.


IEntitySet::MirrorCopy

 IEntitySet Class Overview

MirrorCopy(IVector pt1, IVector pt2, [bool mirrortext])

Mirror and copy the selection set simultaneously.  The two vectors define the line around which the selected text is to be mirrored.  Text contained in the selection set may optionally be mirrored or not by setting the third parameter – mirror text – accordingly.


IEntitySet::Remove()
IEntitySet::Remove

 IEntitySet Class Overview

void Remove(LPDISPATCH entity)

Removes the specified entity from the selection set.


IEntitySet::RemoveAll()
IEntitySet::RemoveAll

 IEntitySet Class Overview

void RemoveAll()

Empties the entity set.  Removes all the entities that were members of it.


ISelection

(Interface Overview)

 See Also

C++ Class Constructors:

ISelection()

ISelection(LPDISPATCH pDispatch)

ISelection(const ISelection& dispatchSrc)

Available Interfaces:

Add

Count	(read-only)

Item	(read-only)

Remove

RemoveAll

An ISelection is the current selection set in the drawing.  There is only one of these objects in any given drawing.  It can be any grouping of entities within the drawing.  Similar to IEntitySet except this ISelection also highlights and de-highlights the selected entities.


ISelection::Add

 ISelection Class Overview

void Add(IEntity entity)

Add the given entity to the given selection set.


ISelection::Count

 ISelection Class Overview

long Count	(read-only)

Get the number of entities in the selection set.


ISelection::Item

 ISelection Class Overview

IEntity GetItem(BSTR handle)	(for C/C++ only)

IEntity GetItem(long index)

IEntity Item(BSTR handle)	(for VB only)

IEntity Item(long index)

Retrieve an individual entity from the selection set, either by its index in the list or by its entity handle.


ISelection::Remove

 ISelection Class Overview

void Remove(IEntity entity)

Remove an entity from the list.  You must pass in the object itself, rather than an index or handle.


ISelection::RemoveAll

 ISelection Class Overview

void RemoveAll()

Clear all entries from the selection


Contents
       Vdraft Customization Guide

Virtual Drafter (Vdraft) is a CAD editor which works directly with AutoCAD drawing (i.e., DWG and DXF) files.  It can be programmed from Visual Basic, C/C++, Excel or any other programming system that supports ActiveX Automation.  You can customize keyboard shortcuts, menus or automate processes through the simple built-in script language.  Vdraft also includes powerful Internet tools, thereby providing powerful capabilities for distributing your drawings to however large an audience you wish, be that only other people at your company or everyone on the planet.

Programming for Vdraft is Easy

This help file is primarily concerned with Vdraft’s interfaces and how to make Vdraft what you want it to do.  Application developers will find here the information they need to have to create their unique solutions.  This help file also discusses creating custom drawing templates and custom popup mouse menus.

NOTE: All the code examples in this document are based around Microsoft C/C++ and Microsoft Visual Basic.  Additionally, on the Vdraft discs ships a programming example that uses Microsoft Excel.  Other programming environments that support ActiveX Automation under Windows should work as well, but have not been tested.

The Vdraft Web Site Custom Scripts and Drawing Templates Custom Popup (mouse) Menus Add-Ons Customizing Vdraft through ActiveX Automation Vdraft PlugIns The Vdraft OCX Development Tools AutoCAD Compatibility AutoLisp and ADS versus VB and C/C++ with Vdraft C/C++ vs. Visual Basic Using ActiveX Automation in C/C++ Using ActiveX Automation in Visual Basic DXF Code Reference Code Samples Visual Basic Code Samples C/C++ Code Samples


The Vdraft Web Site

Vdraft has a web site at www.vdraft.com.  In this web site you will find many useful items, such as a frequently asked questions document, a developers-only area and so.  You will also find the lastest version of this help file.

www.vdraft.com
The latest version of this help file is available on the Vdraft Web Site.  Be sure that you obtain the latest edition, as this help file is constantly being worked on and improved with more information, more code samples, etc.


Drawings Templates and Scripts
Drawing Templates and Scripts

When you being a new drawing in Vdraft, you can select from either templates or prototype files.  A template is a special file that gives Vdraft any number of instructions about a variety of things.  It may set up special command sequences or activate a special application – such as the drawing wizard as shown in the sample script below.

Wizard.vs: starts a new drawing and activates the Drawing Wizard. # Name ~Wizard # Description New Drawing Wizard # prototype drawing vdraft.dwg run.exe NewDwg You will notice several parts to this script, simple though it is.  The #Name field is the name of the script file.  This is the name that will appear in the New Drawing dialog box, under Templates.  The #Description entry is what will show up in the Description box of the New Drawing dialog box when templates are selected.  The #prototype drawing entry is the name of the prototype drawing that the new drawing is to be created from.  These are the DWG files that are in the \Vdraft\Template. When this script is activated (by the user’s selecting it from the Templates listing in the new drawing dialog box) two things happen: a copy of the
vdraft.dwg drawing is made and loaded up as the new drawing, then the external application NewDwg.Exe is executed and control is transferred to that application.

There are other things that might be included in a script, should one desire.  Keyboard command definitions are a very powerful option.

Example one:

set.keys normal

set.keys "fn"	document.new

set.keys "fo"	document.open

set.keys "fc"	document.close

set.keys "eu"	undo

set.keys "er"	redo

set.keys "et"	cut

Example two:

set.keys acad

set.keys "new"	document.new

set.keys "open"	document.open

set.keys "fileopen"	document.open

set.keys "u"	undo

set.keys "undo"	undo

set.keys "redo"	redo

set.keys "cutclip"	cut

The first example sets up a few two-key command shortcuts.  That is, once this script has been loaded, to start a new document one needs merely type “F” and then “N”.  To delete (cut) a given entity, one would type “E” and then “T” again.

In the second example some keyboards are being setup to simulate to command set that AutoCAD uses.  To start a new drawing, you would type in the full word “NEW” and then press either enter or space bar, as with AutoCAD.  That is the “set.keys acad” command at the start of the example is telling Vdraft: to require a space bar or enter key before proceeding with the given command.  In the first example, because “set.keys normal” has been used, the command will be executed immediately upon striking the second key.

Vdraft comes with a number of .VS files.  Most of these are

Special VS files:

VDRAFT.VS – for Vdraft’s use only.

APPS.VS – for use by 3rd party software developers only

USER.VS – for use by the user, to add new macros, keys, etc.

Vdraft.Vs is maintained by Vdraft and should never be edited by the user or by any add-on applications for Vdraft.  Add-ons can place any startup commands they may require in the APPS.VS file, where special keystrokes can be specified, files loaded up, drawings opened or whatever is appropriate for that application.  Developers should keep in mind that this file may be used by other add-on packages at the same time, therefore precautions should be taken to ensure that any add-ons you produce remain “friendly” to other add-ons.

USER.VS is reserved for the user’s own needs.  Here you can create your own keyboard shortcut commands, load up any drawings or  templates you want to always have loaded, etc..

Other predefined VS files:

AacdKeys.vs – allows the AutoCAD command set to be used in Vdraft

QuickKeys.vs – a set of 2-key shortcut commands.


Custom Popup Menus
Custom Popup (Mouse) Menus

At any time that you are working in Vdraft, you can use the right mouse button to bring up various menus.  The right mouse button by itself will bring up menus related to the currently selected object(s), if any.

Holding the CTRL key while clicking the right mouse button will bring up a menu of options related to the view, such as Zoom In, Zoom Out, Pan, Redraw, etc.

The SHIFT key used in concert with the right mouse button is reserved for a user-defined custom popup menu.

Shown here is the script file that produced the above custom popup menu.  This simple example sets up a popup menu that can be accessed by holding the SHIFT key while clicking the right mouse button.  The nine statements beginning with “set.popup” each create a tile on that popup menu.

set.popup "New" document.new

set.popup "Close" document.close

set.popup "Open" document.open

set.popup "Zoomer "run.exe Zoom

set.popup "NotePad" run.exe notepad

set.popup "Doom" run.exe doom

set.popup "Hexen" run.exe hexen

set.popup "BossKey" run.exe bosskey

set.popup "WebSurf" run.exe websurf

The last two lines of the script file will actually run external applications (in this case, a sample application that ships with Vdraft – Zoomer – and the NotePad application from Microsoft Window).  This illustrates how you can combine Vdraft commands along with external commands on one popup menu.

A script like this can be used by placing it in the templates subdirectory under Vdraft and then creating a new drawing from it, or by placing the “set.popup” lines in the User.Vs file.


Add-Ons Under Vdraft

 See Also

Vdraft allows for the creation of custom add-ons.  That is, programs that can work in concert with Vdraft to accomplish some task, simple or complex, that Vdraft might not already do.  Such add-ons, or extensions to Vdraft, can be constructed in several fashions (see Development Tools for more information on that).

Once an add-on has been created, how is it activated?  That depends on the nature of the add-on.  If it has been created as an executible file (that is, an .EXE) then it may be started as any other application is started. Or, it can be started via the Applications dialog box (under the Extensions menu in Vdraft), as shown here:

	This dialog box’s appearance will vary depending on what executable add-ons Vdraft finds the Vdraft\Programs subdirectory.

Each of the icons this dialog box displays represents one application that Vdraft found in the Vdraft\Programs subdirectory.  The dialog box automatically pulls an icon from each application and displays it for the user along with the application’s name.

So, one easy way to allow the user to activate an add-on is to create it as an EXE (under MSVC or VB, for example) and then to place that executible file in the Vdraft\Programs subdirectory.

If the add-on was created as a DLL or a VB OCX (using the “Make OLE DLL” option under the File Menu in VB), then you will also want place it in the Vdraft\Programs subdirectory, where Vdraft will load this file automatically when Vdraft starts up.  What happens from that point is up the add-on.  Usually the add-on will create a menu entry for itself under the Extensions menu in Vdraft, enabling the user to select this entry and thusly activate the add-on’s function(s).  See Vdraft PlugIns for more information.


OLE Automation Reference
ActiveX Automation Reference

  Further Reading

ActiveX Automation (a.k.a., OLE Automation) is a well defined method that allows one application to send requests, commands or data to another application, while knowing very little about that application.  An application that supports ActiveX Automation publishes a set of Automation Interfaces that give outside applications access to its capabilities.  There are many advantages to ActiveX Automation, ease of programming (for the add-on solution developer) being the primary one.  See Vdraft PlugIns for information about performance issues under ActiveX.

You can take advantage of ActiveX Automation from a variety of programming languages, such as Visual Basic, C/C++, Excel or any other Windows-based programming tool that supports Automation.  Even Microsoft Excel or Word offer this capability.  That means that if you are already familiar with a Windows programming tool, you can probably use it to create your own custom add-ons for Virtual Drafter.

For example, the New Drawing Wizard that ships with Vdraft is an external application that was created using Visual Basic  (the source code for the Wizard is included with Vdraft as sample code).  Vdraft starts up this application when you select to start a new drawing from the “~Wizard” template.  After making your selections and then pressing the “Apply” button, the wizard will place all those settings into your new drawing by passing various commands to Vdraft via ActiveX Automation calls.

Using Automation with Vdraft you can:

 Read and write all information in DWG or DXF files, including block attributes, layers, dimensions, object properties and extended entity data.

 Drive any command available through Vdraft’s user interface.

 Use Vdraft’s tools for geometry calculations such as transformations, object snaps, intersections, trim and extend.

 Work with multiple drawings simultaneously.

 Do your processing in the background while the user works in the foreground.

 You can even load and process drawings without displaying them.

 Bundle entire batches of Vdraft commands together under one name and description in the undo list, making the undo list much more meaningful to the user.  This is especially important when your application may be sending hundreds of separate Vdraft commands for what the user might regard as a single step.

A VERY USEFUL TIP:

From Visual Basic, after starting your application, you can use the pause button to gain an interactive access to Vdraft’s ActiveX Automation.  That is, in the VB debug window, automation commands can be typed in directly and their effects (or lack of) can be observed at once.  This is an excellent way of testing something out before committing it to code.  [See Also]

Using ActiveX Automation, programming for Vdraft is simple.  In Visual Basic, to being a session with Vdraft, the following code is all that is necessary:

Dim Vdraft as Object

Set Vdraft = CreateObject(“Vdraft.Application”)

Of course, for any real application that you would be creating, you would include error trapping and recovery code, which will not be shown in these examples.

Once the Vdraft object has been created, the whole of Vdraft is available to your application.  For example, to get the name of the currently active document in Vdraft (assuming that “Vdraft” is already set to the Vdraft Application):

str$ = Vdraft.ActiveDocument.Name  ‘ get the document’s name

Further Reading:

It is not necessary to know much about the internal workings of ActiveX Automation in order to make maximum use of the Vdraft Interfaces.  However, if you are interested in further information about this topic there are several good sources for details about it.  These include, but are not limited to:

Windows SDK documentation (from Microsoft), including Books Online,

The Microsoft Developer’s Network (MSDN),

Inside OLE, second edition, by Kraig Brockschmidt, from Microsoft Press,

Building OCXs, by Toohey and Toupin, QUE.

The Revolutionary Guide to MFC 4 Programming with Visual C++, 2nd Edition, by Mike Blaszczak, Microsoft Press,

Back issues of Microsoft Systems Journal, and Windows Developer’s Journal,

Experience and experimenting,

Other people’s code,

and so on…


Vdraft PlugIns

 See Also

  Performance with ActiveX

  Loading a PlugIn

  Shutting Down a PlugIn

  Debugging a PlugIn

Vdraft PlugIns are special C/C++ DLL’s that are loaded up automatically by Vdraft at startup time.  PlugIn’s have some advantages over other forms of Vdraft add-ons, such as performance, notifications and additional user interface capabilities.

Peroformance with ActiveX Automation

Although ActiveX Automation offers many advantages, there are some disadvantages.  The main disadvantage is performance.  ActiveX Automation can be very slow compared to other, more direct, programming solutions.  This is because of the many layers of code that automation calls have to go through to “get from here to there.”

Worse than that, the easier methods of implementing ActiveX Automation are also the slower ones.  Between VB and C/C++ the slowest to the fastest implementations rank this way:

Visual Basic EXE’s	<  Slowest

Visual C/C++ EXE’s

Visual Basic OLE DLL’s

Visual C/C++ DLL’s	<  Fastest

A PlugIn is a DLL which can be created with a language which can export functions, such as C++.  When the DLL is placed in /Vdraft/Programs and exports a function called vfLoad, Vdraft will automatically load it when starting.  vfLoad will be called when Vdraft loads the DLL, so this is a good place to perform initializations such as adding items to Vdraft's pull down menu.

To make a PlugIn, first create a new DLL.  With a compiler such as Microsoft Visual C/C++, there is a wizard to walk you through the process of creating a new DLL.  To call Vdraft's Automation functions, many programming environments offer a way to use a 'type library'.  Vdraft's type library, Vdraft.tlb, is found in the Vdraft directory.  It describes the functionality you can use to customize Vdraft.  Provided with Vdraft are the files vdraft.cpp and vdraft.h which are a set of MFC (Microsoft Foundation Classes) based classes which simplify calling Vdraft.  Add vdraft.cpp to your project.  For more information on DLLs and using type libraries, see your compiler's documentation.

Code Samples

The following code adds a menu item when the DLL is first loaded.  "My Menu Item" will appear on the menu.  When the user highlights it, "A simple Vdraft add-on" will appear on the status bar.

#include "vdraft.h"

static IVdraft vdraft;

#define MYMENUITEM	1

veReturn vfLoad(vtAddOnID id)

{

    if (!vdraft.CreateDispatch("Vdraft.Application", NULL))

    {

        return veR_Unload;

    }

    CString item("My Menu Item"), status("A simple Vdraft add-on");

    IApplicationEvents events(vdraft.GetEvents());

    events.AddToolsCommand(id,MYMENUITEM,item,status);

    return veR_OK;

}

Remember to export vfLoad by listing it in the appropriate .def file.  The file vplugin.h contains prototypes for the functions Vdraft calls to notify the PlugIn of events.  Events are requested through the IApplicationEvents, IPickEvents, and ISelectionEvents interfaces.  Vdraft passes an id to the PlugIn in all its event functions.  The PlugIn should pass this id to Vdraft whenever it requests events so Vdraft knows who to respond to.

To perform an action when the user picks your menu item, define and export vfCommand.  The following function responds to the item we added in vfLoad by prompting the user to draw a line.  It then requests that Vdraft notify it when the user is done.  The eventid parameter is the same value we passed to AddToolsCommand.

#include "vdraft.h"

veReturn vfCommand(vtAddOnID id, long eventid)

{

   if (eventid != MYMENUITEM)

   {

       return veR_OK;

    }

    IDocument doc(vdraft.GetActiveDocument());

    // have them draw a line

    IEntities entities(doc.GetEntities());

    entities.DrawLine();

    // ask to be notified when they're done

    IPickEvents pick(doc.GetPickEvents());

    pick.RequestDraw(id,cVariant());

    return veR_OK;

}

The cVariant class is defined in vutil.h.  It provides a convenient way to pass values when a function expects a VARIANT (which simply means the parameter can take on different values).  To pass 3 to RequestDraw, use pick.RequestDraw(id,cVariant(3)).  As in the example discussing the VdraftEvents control, this value is passed back from Vdraft if extra information is needed to identify the specific drawing instance.

When the user finishes drawing the line, we will respond by drawing another line over it to make an X.  vfDrawEvent is called when the user finishes, cancels, or picks a point.  We will create the new line only if the user finishes drawing the first line.

veReturn vfDrawEvent(vtAddOnID id, veDrawEvent event, double* point, short picknumber, long info)

{

    if (event != veDE_Done)

    {

        return veR_OK;

    }

    IDocument doc(vdraft.GetActiveDocument());

    IEntities entities(doc.GetEntities());

    // get the line they just drew - it will be the last entity

    ILine line(entities.GetLast());

    // get the endpoints of the line

    IVector end1(line.GetWhere1()), end2(line.GetWhere2());

    // create a new line

    ILine newline(entities.AddLine());

    // get the endpoints of the new line

    IVector newend1(newline.GetWhere1()), newend2(newline.GetWhere2());

    // use the 1st line to position the 2nd line so we form an X

    newend1.Set2D(end1.GetX(), end2.GetY());

    newend2.Set2D(end2.GetX(), end1.GetY());

    return veR_OK;

}

Additional code samples, including complete working examples, can be found on the Vdraft distribution disks and are installed under \Vdraft\Programs\Cpp.

Loading a PlugIn

To load the dll, execute the script command plugin.load <dll name>.  Or, simply place the Dll in Vdraft\Programs subdirectory, which will cause the dll to be loaded automatically when Vdraft starts.

NOTE: Once Vdraft has been started up, new DLL’s placed in Vdraft\Programs won’t be loaded until the next time Vdraft starts.

Shutting Down a PlugIn

When Vdraft quits, all plugins are automatically unloaded.  If you wish to explicitly unload it, you can either use the command plugin.unload <dll name> or return veR_Unload from any of the exported functions (vfLoad, vfCommand, etc.).  Otherwise return veR_OK.

If you wish to respond to shut down queries and notifications, then you will need to implement vfQueryUnload() or vfUnload() or both.  These are optional, however and only need to be implemented if you wish to utilize them. vfQueryUnload() is called by Vdraft when Vdraft is considering shutting down; this gives you a chance to vote on the matter.  This doesn’t mean that Vdraft will necessarily listen to your vote, however; it depends on why Vdraft is shutting down.  When Vdraft is really shutting down, vfUnload() is called; this allows you to do your clean up and shutdown work.

Debugging a PlugIn

By default, Vdraft traps all unhandled exceptions that may occur in the plugin.  The user is told which plugin had the problem, but the plugin still sticks around.  So that the developer can have the debugger catch the errors & show them where the problem is, Vdraft's exception handling can be turned off by passing -debug on the command line.


PlugIn Exported Functions

 See Also

There are several functions that a PlugIn might need to export in order to make use of the various notification events.  All except the vfLoad() function are optional.  The last five of them are only called by Vdraft in response to event notifications that your request of it.  Therefore, if you wish a particular type of notification, then you must include the appropriate exported function in your PlugIn.  These functions are outlined here.  The various C++ code samples contain examples of how to use these functions.

veReturn vfLoad(vtAddOnID id)	<  REQUIRED

vfLoad is the only function that is required to exist for the plugin to be loaded.  It is called when the plugin is first loaded by Vdraft.  This is a good time to add commands to Vdraft’s menu and/or keyboard (see AddKeyboardCommand())

veReturn vfQueryUnload(vtAddOnID id)

Vdraft is thinking about quitting.  This is a query to all PlugIns, effectively asking whether it is OKay or not to shutdown.  If the PlugIn has no objections, it should return veR_Unload if it isn't busy.  This is only a request or query for shutdown; the PlugIn should not at this point do any closing down or cleanup.  See vfUnload() for that.

veReturn vfUnload(vtAddOnID id)

Vdraft is actually quitting.  This is where the PlugIn should do final cleanup.

veReturn vfCommand(vtAddOnID id, long eventid)

This function will be called by Vdraft in response to IApplicationEvents.  The user has selected a plugin-defined command, such as from the Extensions menu or a keyboard command that was earlier defined by the PlugIn.  The eventid will identify the command that was issued by the user; it’ll be the same id or long value you gave to Vdraft when the command was created.

veReturn vfPickEvent(vtAddOnID id, vePickEvent event, double* point, long info)

Called by Vdraft in response to IPickEvents::RequestPick.  This is asking for the user to pick something and means that the user has picked a point or done something related to picking a point

veReturn vfDrawEvent(vtAddOnID id, veDrawEvent event, double* point, short picknumber, long info)

Called by Vdraft in response to IPickEvents::RequestDraw.  This comes from a request for notification about great moments in the user’s drawing a particular entity and means that the user has generated an event related to drawing an object   This might relate to the issuing of a Draw3PointArc() method, for example, when you are wanting to know when various points have been picked and to get data about those picks, etc.

veReturn vfSelectEvent(vtAddOnID id, veSelectEvent event, long info)

Called by Vdraft in response to ISelectionEvents::RequestSelect or ISelectionEvents::RequestSingleSelect.  This has to do with asking the user to pick one or several entities in the drawing and means that  the user has finished selecting objects.

veReturn vfHelpEvent(vtAddOnID id, long helptoken)

Called by Vdraft in response to a help request by the user.  It means that the user has asked for help on something provided by the plugin.  The help token is defined by the PlugIn.


The Vdraft OCX for VB
The Vdraft OCX

Vdraft\VEvents.OCX

Often a program needs to prompt the user for points to pick or entities to select.  Or you may wish to add a command to Vdraft.  To respond to actions performed in Vdraft, you can either use the VdraftEvents ActiveX Control (also known as an OLE Control or OCX) or build a PlugIn.  The OCX is simple to use from a programming environment such as Visual Basic.  It provides a set of functions you can call and events you can respond to.  Alternately, a PlugIn can be created from a language such as C++ and provides similar functionality.  Additionally, a PlugIn provides faster execution, is automatically loaded when Vdraft starts, and can add items to Vdraft's pull down menu.

To use the OCX from Visual Basic 4.0, choose the Tools / Custom Controls menu.  Make sure Controls is checked on the dialog box, then select Vdraft Events Control.  After you pick OK, the VdraftEvents icon should appear along with the other standard tools (buttons, radio buttons, etc.).  Pick the icon, and drag out an area on your form just as you would a button.

Note that this control will not appear when you run your program.  By default, Visual Basic will name this object VdraftEvents1.

Double click on the new Vdraft Events Control to display the code window.  The “Proc” list will list the Vdraft events your program can respond to.  You will usually first request events from the control, then respond to the events in these functions

From Microsoft Visual C++ it can be used via the component gallery.  (The OCX is installed into the component gallery during installation.)  The AppWizard will then generate a wrapper class (complete with CPP and H files) for you automatically.

A Visual Basic Example

As a simple VB example, we will create a program which prompts the user to draw a line.  Our program will respond by turning the line into an X by adding another line.  Add a button to the form with VdraftEvents1 and change the caption to 'Draw X'.  Double click on the button to display the code attached to the button.  Add the following code.

Private Sub Command1_Click()

    Dim doc As Object

    If VdraftEvents1.Connect = False Then

        MsgBox "Could not Connect with Vdraft"

        Exit Sub

    End If

    Set doc = VdraftEvents1.Vdraft.ActiveDocument

    ' have the user draw a line

    doc.Entities.DrawLine

    ' we want to know when the user finishes

    VdraftEvents1.RequestDraw doc.PickEvents, 0

End Sub

VdraftEvents1.Connect establishes communications with Vdraft.  If successful, Vdraft will respond by calling Load in VdraftEvents1 and then Connect will return True.  If communications have already been started, Load will not be called, but Connect will still return True.  This way, this same function can be called multiple times.  Note that you should use the Vdraft application object from the VdraftEvents object instead of using CreateObject("Vdraft.Application").  You can use either VdraftEvents.Vdraft or the Vdraft object pased back to you for further calls into Vdraft.

Next we put Vdraft in line drawing mode and request to be notified when the user draws a line.  Notice that we ask the VdraftEvents control to send us events, not Vdraft.

Double click on the VdraftEvents object on the form to bring up the associated code.  Choose DrawDone from the Proc list.  Here we will get the line the user drew and create another line based on it.

Private Sub VdraftEvents1_DrawDone(ByVal info As Long)

    Dim Entities, line1, line2 As Object

    Set Entities = VdraftEvents1.Vdraft.ActiveDocument.Entities

    ' get the line the user just drew

    Set line1 = Entities.Last

    ' create a new line

    Set line2 = Entities.AddLine

    ' set its endpoints so the lines form an X

    line2.Where1.Set line1.Where1.X, line1.Where2.Y

    line2.Where2.Set line1.Where2.X, line1.Where1.Y

End Sub

The last number we passed to RequestDraw is the number passed to DrawDone.  This is useful if you need more information on the pick event you received.  Sometimes this is necessary if you wish to have your program be able to work in multiple documents at the same time.

If you put your executable in \Vdraft\Programs, it will be listed in Vdraft's Applications dialog box (extensions/applications menu selection). See the sample code in \Vdraft\Programs for further examples.


Vdraft OCX Methods and Properties
Vdraft OCX Events

 See Also

The purpose of the OCX is to provide a handy access to Vdraft generated events, such as mouse picks, menu picks and entity selections, among others.  From C++ it’s use is optional as Vdraft events can be handled directly using C++ code.  From Visual Basic, the OCX is essential if you wish to respond to events

properties:

long InstanceID	readonly

IVdraft Vdraft	readonly

methods:

boolean AddKeyboardCommand(long event, BSTR keystrokes)

boolean RequestPick(IPickEvents pickevents, [long info])

boolean RequestDraw(IPickEvents pickevents, [long info])

boolean RequestSelect(ISelectionEvents selectevent, [long info])

boolean RequestSingleSelect(ISelectionEvents selectevent, [long info])

boolean Connect()

void Disconnect()

void AboutBox()

events:

void Unload()

void Command(long event)

void PickPoint(IVector point, long info)

void PickCancel(long info)

void PickDone(long info)

void PickProperties(long info)

void PickUndo(long info)

void DrawDone(long info)

void DrawCancel(long info)

void DrawPick(IVector point, short picknumber, long info)

void SelectDone(long info)

void SelectCancel(long info)

void Load(IVdraft vdraft)

void Help(long helptoken)

From Visual Basic, when the OCX is loaded up in Visual Basic (and dragged onto a form, etc), from the “PROC” pull-down list, you will see the follow events for which you can write code.

Command	< user has issued an add-on-defined command

DrawCancel	< user has cancelled a draw event

DrawDone	< user has completed a draw event

DrawPick	< user has made a pick as part of a draw event

Help	< user has requested help on an add-on object

Load	< happens once only, when app is being init’d

PickCancel	< user has cancelled a pick event

PickDone	< user has finished a pick event

PickPoint	< user has picked during a pick event

PickProperties	< user has picked “Properties” on the mouse menu.

PickUndo	< user has undone a pick point

SelectCancel	< user has cancelled a select event

SelectDone	< user has finished a select event

Unload	< add-on is being unloaded

These events happen only when they are requested to happen by the add-on application.  For example, for a Command event to be generated, a command has to be setup, say a keyboard command using AddKeyboardCommand().

From MSVC, if you select the Vdraft OCX from the Component Gallery, a CPP and H file will be added to your project giving you the following API’s:

// Attributes

public:

long GetInstanceID();

void SetInstanceID(long);

LPDISPATCH GetVdraft();

void SetVdraft(LPDISPATCH);

// Operations

public:

BOOL AddKeyboardCommand(long event, LPCTSTR keystrokes);

BOOL RequestPick(LPDISPATCH pickevents, const VARIANT& info);

BOOL RequestDraw(LPDISPATCH pickevents, const VARIANT& info);

BOOL RequestSelect(LPDISPATCH selectevent, const VARIANT& info);

BOOL RequestSingleSelect(LPDISPATCH selectevent, const VARIANT& info);

BOOL Connect();

void Disconnect();

void AboutBox();


Development Tools

What do you need in order to develop add-ons for Virtual Drafter?

NOTE: All the code examples in this document are based around Microsoft C/C++ and Microsoft Visual Basic.  Additionally, on the Vdraft discs ships a programming example that uses Microsoft Excel.  Other programming environments that properly supports ActiveX Automation under Windows should work as well, but have not been tested.

There are two main things you need: a programming environment and the know-how to use it (or the gumption to dig in and learn while you go).  Among available programming environments are several popular ones to choose from: things like Visual Basic and Microsoft Visual C/C++.  Any programming environment that supports ActiveX Automation under Windows 95, NT 3.51 or NT 4.00 should do just fine.

If you are working in Visual Basic: the code sample we have provided assumes version 4.0 or later of Microsoft Visual Basic.  Earlier versions of Visual Basic have never been tested, therefore, if you feel so inclined as to try version 3.0 or even earlier, we can’t guarantee results.  Version 4.0 is much more automation aware than was 3.0; this is probably significant.

Visual Basic is largely a complete programming environment in itself.  Add-ons and tools tend to be packages of pre-existing code, bundled up as OCX’s and what-not.  Some of these add-ons might be useful to you in developing your Virtual Drafter applications.

If you are working in C/C++: there a wide variety of C/C++ compilers and environments available on the market, such as those from Microsoft, Borland and Watcom.   Each of them come with their own flock of attendant accessories, tools, documentation and code samples.  Vdraft and all of the C/C++ add-on samples have been created using Microsoft C/C++ with MFC.  The provided Vdraft.Cpp and Vdraft.h files require MFC in order to function correctly.  Since many current C++ compilers for Windows now ship with MFC, it is probable that these examples will work as shown with other compilers than MSVC, but this has not been tested.

Another tool that the C/C++ programmer will find extremely useful is Visual Basic.  This is in part because of VB’s debug window, where in, when the VB app you are running is paused, you may type in Vdraft commands directly and have them executed immediately.  This gives you an interactive, real-time window into Vdraft.  It can really help you BUNCHES in figuring out how something works with Vdraft.  For example, the following commands might be typed in directly:

When working in C/C++ there are other tools that you may want to consider, things that can speed up your productivity and reduce your coding errors.  These include, among other things:

A good lint tool, e.g., PC-Lint0, by Gimpel Software

A memory leak detector (e.g., Bounds Checker)

Sophisticated Luck enhancers: (e.g., A dead chicken, an old Shaman)


PlugIn Wizard for MSVC

The PlugIn Wizard is an MSVC Application Wizard that helps you to start a Vdraft PlugIn project.  It operates just like any other application wizard in MSVC.

This is not yet available.


Compatibility with AutoCAD

Virtual Drafter was designed to work directly with AutoCAD drawing files without translation.  The following chart illustrates what this means in terms of the information stored in your drawings.

AutoCAD R12	Vdraft v1.0	AutoCAD Drawing Info (Read, Write, Edit, Create and Display the following:)
		line, arc, circle
		point display modes
		solid
	1	trace
		3d face
		plines
		plines w/ varying widths
		plines w/ arcs
		spline (quadratic and cubic)
	1	polymesh
	1	polyface
		donut, polygon
		text (rotate, xscale, oblique, justify, upsidedown, backwards)
		test style (+ AutoCAD SHX fonts)
	1	shape
		entity handles
		extended entity data (including changing the data when the entity changes)
		thickness
		all entities in 3d
		linear dimensions (horizontal, vertical, aligned, rotated)
		angular dimensions (3 point, 4 point)
		radius, diameter dimensions
		baseline, continuous dimensions
		ordinate dimensions
		leader
		named dimension styles
		blocks, inserts
		minserts
		block attributes (attribute definitions)
	2	hatching
		xrefs
		bylaryer, byblock, layer 0 (rules for determining color and linetype)
		named layers (and associated color, linetype)
		linetypes
	3	UCS
		named views
	4	tiled viewports
		paperspace
		paperspace viewports

NOTES:

1: Creation only available through programming interface.

2: Hatching creation available as a third-party application.

3: Limited support.

4: Support for existing tiled viewports.


C/C++ vs. Visual Basic
AutoLisp/ADS vs.

VB and C/C++ in Vdraft

Vdraft is built on the newest technology, incorporating true object-oriented design from its core on out.  This gives the add-on developer many advantages, the chief of which is relatively simple code that is easy to understand – almost self-documenting.

The following code fragments show how you would take the last drawing entity created and change the layer it is on.  A simple enough and routine enough chore.  The first two examples show doing this in AutoCAD, first in AutoLisp then in ADS; the next two examples show this same process in Vdraft, first in Visual Basic then in C/C++.

AutoLisp for AutoCAD

(setq entity (entget (entlast)))

(setq entity (subst (cons 8 “LAYER”) (assoc 8 entity) entity))

(entmod entity)

ADS for AutoCAD

struct resbuf *ent, *ptr;

ads_name last;

ads_entlast(last);	// name of last object

ent = ads_entget(last);	// get last object

ptr = ent;	// working pointer

while (ptr != NULL)

{

    if (ptr->restype == 8)	// found the layer

    {

    //  assumes the string buffer is long enough

        strcpy(ptr->resval.rstring, “LAYER”);

        break;

    }

    ptr = ptr->next;	// go to next resbuf

}

ads_entmod(ent);

Visual Basic for Vdraft

Drawing.Entities.Last.Layer = Drawing.Layers(“LAYER”)

C/C++ for Vdraft

//   Doc already points to the document we are working with

IEntities Entities(Doc.GetEntities());

IEntity LastEnt (Entities.GetLast());

ILayers Layers (Doc.GetLayers());

ILayer Layer(Layers.GetItem(cVariant(“LAYER”)));

LastEnt.SetLayer(Layer);


C/C++ vs. Visual Basic

Creating ActiveX Automation applications in Visual Basic is well documented and very easy, and should become even easier as Visual Basic continues to evolve.  Under Visual C/C++, the process is almost as easy, but is rather badly documented for the most part.  Once you understand what you have to do, then it becomes quite straight forward.

We have provided, for your programming pleasure, certain files that you will want to include in your C/C++ project: Vdraft.H and Vdraft.Cpp.  The header file contains all the definitions, symbols, enums and so on that you will need as well as the outlines of the classes, their methods and properties.  Vdraft.Cpp contains the implementation of the ActiveX Automation wrapper classes for accessing Vdraft.  (These “wrapper” classes are what is actually documented in this help file.)

The following is a comparative sample showing C/C++ versus Visual Basic.  As you can see, the two code samples are nearly identical.

Comparative code sample: starting a session with Vdraft.

Visual Basic Code Sample:

Dim Vdraft as Object

Set Vdraft = CreateObject(“Vdraft.Application”)

C/C++ Code Sample:

#include Vdraft.h

IVdraft Vdraft;

Vdraft.CreateDispatch ("Vdraft.Application", NULL);


Using Automation in C/C++
Using Automation in C++

 See Also

The following is a code sample that illustrates a very basic procedure that simply gets a channel in to Vdraft, grabs interfaces to a few of the tables and then draws a couple lines.  Nothing exciting, but this isn’t meant to be a practical example so much as an illustration of how to do some basic stuff.

void CNewAppDlg::OnGetVdraft()

{

IVdraft Vdraft;	// grab vdraft.

BOOL bSuccess = Vdraft.CreateDispatch("Vdraft.Application", NULL);

CString AppName = Vdraft.GetName();	// should you want the app's name.

IDocuments Dox(Vdraft.GetDocuments());	// the documents collection

if (Dox.Count() == 0)	// is there an active document?

{	// no:

Dox->Add(cVariant());	// add one

}

IDocument Doc(Vdraft.GetActiveDocument());	// for currently active doc

CString DocName = Doc.GetFullName();	// name of the currently active doc

ILayers LyrTbl(Doc.GetLayers());	// pointer to layers table

IEntities Ents(Doc.GetEntities());	// the drawing entities

ILine NewLine(Ents.AddLine());	// create a new line

IVector startpt(NewLine.StartPoint());	// start point of line

startpt.Set2D(10, 10);	// set it

IVector endpt(NewLine.EndPoint());	// end point of line

endpt.Set2D(1, 1);	// set it

}

As soon as NewLine goes out of scope the object it is attached to, which is to say, the new line that was created, will update and display itself.  Alternatively, you could have explicitly updated it by calling its Update() method.


Using Automation in Visual Basic

 See Also

Using ActiveX Automation from Visual Basic is quite simple.  This discussion and the samples shown here will clearly demonstrate this.  Since all roads begin with the IVdraft class, let’s take a quick look at that first.

The group of functions that fall under IVdraft are as follows:

Visible	is Vdraft visible right now or not?

ActiveDocument	gains you access to the currently active document

Documents	gains you access to the collection of all documents

FullName	returns the full name (including path) of Vdraft

Name	returns “Vdraft”

Minimized	sets or gets the minimized status of Vdraft

Maximized	sets or gets the maximized status of Vdraft

Events	returns the IApplicationEvents interface into Vdraft

void Quit	causes Vdraft to shut down.

IVector NewVector	returns a new IVector object

IMatrix NewMatrix	returns a new IMatrix object

The first items are properties and all return information about some setting in or status of Vdraft.  The last items are methods, which cause Vdraft to perform some action, such as quitting.  These could be used from VB as follows:

Dim Vdraft as Object

Set Vdraft = CreateObject(“Vdraft.Application”)	' open up Vdraft communications

Name$ = Vdraft.Name	' “Vdraft”

FullName$ = Vdraft.FullName	' <path>\Vdraft.Exe

If Vdraft.Visible Then	' if Vdraft is visible to user,

 ' do whatever you need here

End If

NumDocs% = Vdraft.Documents.Count	' get number of docs open in Vdraft

ActDocName$ = Vdraft.ActiveDocument.FullName	' get full name (path) of active document

' continue processing

Vdraft.Quit	' shut Vdraft down

End	' done

The Documents group includes a Count property that returns the number of documents currently open in Vdraft.  The IDocument group includes several properties and methods for handling individual documents.  One of these properties is the document’s full name, including its path.

Visual Basic gives you some handy short cut techniques, such as illustrated in the following code:

Vdraft = CreateObject(“Vdraft.Application”)

NumOfEntities = Vdraft.ActiveDocument.Entities.Count

This allows you to avoid having to create a slew of intermediate objects, assigning each one specifically to a VB object variable.

The final source code example here starts by creating a new drawing document in Vdraft, then creating a circle and one line.

Dim Vdraft, Entities As Object

Set Vdraft = CreateObject(“Vdraft.Application”)

Set Entities = Vdraft.Documents.ActiveDoc.Entities

'  draw a new circle in the document

Dim MyCircle As Object

Set MyCircle = Entities.AddCircle	' create a new circle

MyCircle.Where.Set 14#, 21#

MyCircle.Radius = 10#

'  draw a new line

Dim MyLine As Object	' line and its points

Set MyLine = Entities.AddLine	' add the new line

MyLine.Where1.Set 0#, 0#	' start point of line

MyLine.Where2.Set 10#, 10#	' end point of line

In the code above, the Circle and Line will update on the document’s display as soon as the objects “MyCircle” and “MyLine” go out of scope or get set to “Nothing.”


Using Excel with Vdraft

Since Microsoft Excel works with ActiveX Automation, it also can be used to give instructions to or get information back from Vdraft.  The techniques to use with Excel are quite similar to those for working with Visual Basic.

This also means that Microsoft Word, Access and other systems that support VBA (Visual Basic for Applicaions) should work similarly with Vdraft.

Included with the Vdraft package are some sample Excel applications, in \Vdraft\Programs\Excel.  For example,  you will find Excel\Attribs\ATTEXT.XLS.  This sample will read the currently active drawing and list all the blocks containing attributes in that drawing.


Enumerated Types

 See Also

These symbols are defined for use with Vdraft, in the file VENUMS.H for C/C++ and VUTIL.BAS for VB..  Another way to say it is that some of the Vdraft functions return or take “magic” values; this is the listing of those values and what they really mean.

NOTE: This help page is available at any time from within the help file by clicking on the “Symbols” button at the top of the help window.
veAngularUnits	veBlockDefinitionMethod
veCommonArrowsType	veCursorTipInfo
veDimStyleAlignment	veDimStyleHorizontal
veDimStyleTolerance	veDimStyleVertical
veDrawEvent	veEntityType
veJustifyHorizontal	veJustifyVertical
veLinearUnits	vePickEvent
vePickPopup	vePolylineCurve
veReturn	veSelectEvent
veSeparateArrowsType	veXDataType
vtAddOnID

/* IUnits::Linear */

enum veLinearUnits

{

veLU_Scientific=1,

veLU_Decimal,

veLU_Engineering,

veLU_Architectural,

veLU_Fractional

};

/* IUnits::Angular */

enum veAngularUnits

{

veAU_DecimalDegrees,

veAU_DegMinSec,

veAU_Grads,

veAU_Radians,

veAU_Surveyor

};

/* IDimStyle::Alignment */

enum veDimStyleAlignment

{

veDSA_Horizontal,

veDSA_DimLine,

veDSA_Inside,

veDSA_Outside

};

/* IDimStyle::Vertical */

enum veDimStyleVertical

{

veDSV_Centered,

veDSV_Above,

veDSV_Relative

};

/* IDimStyle::Horizontal */

enum veDimStyleHorizontal

{

veDSH_Default,

veDSH_TextIn,

veDSH_TextArrowsIn

};

/* IDimStyle::Tolerance */

enum veDimStyleTolerance

{

veDST_None,

veDST_Variance,

veDST_Limits

};

/* IDimStyle::ArrowsType */

enum veCommonArrowsType

{

veCAT_Block,

veCAT_Default,

veCAT_Dot,

veCAT_Tick

};

/* IDimStyle::Arrow1Type */

/* IDimStyle::Arrow2Type */

enum veSeparateArrowsType

{

veSAT_Block,

veSAT_Default,

veSAT_Dot

};

/* IEntity::Type */

enum veEntityType

{

veET_Line,

veET_Point,

veET_Circle,

veET_Shape,

veET_Text,

veET_Arc,

veET_Trace,

veET_Solid,

veET_Insert,

veET_Attdef,

veET_Attrib,

veET_2DPolyline,

veET_3DPolyline,

veET_Polymesh,

veET_Polyface,

veET_2DVertex,

veET_Vertex,

veET_FaceVertex,

veET_3DFace,

veET_HorizontalDim,

veET_VerticalDim,

veET_RotatedDim,

veET_AlignedDim,

veET_Ang4PtDim,

veET_DiameterDim,

veET_RadiusDim,

veET_Ang3PtDim,

veET_OrdinateXDim,

veET_OrdinateYDim,

veET_Viewport

};

/* IXData::Type */

enum veXDataType

{

veXDT_Invalid,

veXDT_String,

veXDT_Control,

veXDT_Layer,

veXDT_RawData,

veXDT_Handle,

veXDT_Vector,

veXDT_Double,

veXDT_Short,

veXDT_Long

};

/* IPolyline::Curve */

/* IPolyline::ColumnCurve */

/* IPolyline::RowCurve */

enum vePolylineCurve

{

vePC_NoCurve,

vePC_Curved,

vePC_Cubic,

vePC_Quadratic

};

/* IText::Horizontal */

/* IAttdef::Horizontal */

/* IAttribute::Horizontal */

enum veJustifyHorizontal

{

veJH_Left,

veJH_Center,

veJH_Right,

veJH_Align,

veJH_Middle,

veJH_Fit

};

/* IText::Vertical */

/* IAttdef::Vertical */

/* IAttribute::Vertical */

enum veJustifyVertical

{

veJV_Baseline,

veJV_Bottom,

veJV_Middle,

veJV_Top

};

/* IBlocks::Add */

enum veBlockDefinitionMethod

{

veBDM_EntitiesRemoved,

veBDM_ReplacedByInsert,

veBDM_EntitiesLeft

};

/* IMousePick::SetCursorTipInfo */

enum veCursorTipInfo

{

veCTI_None,

veCTI_Offset,

veCTI_Scale,

veCTI_Angle,

veCTI_LengthAngle,

veCTI_Height,

veCTI_Width,

veCTI_Radius,

veCTI_Length,

veCTI_Diameter

};

/* IMousePick::TriggerPopup */

enum vePickPopup

{

vePP_Done,

vePP_Cancel,

vePP_Properties,

vePP_Undo,

vePP_Help,

vePP_TypeCoordinates

};

/* IPickEvents */

enum vePickEvent

{

vePE_Point,	/* a point has been picked */

vePE_Cancel,	/* pick was aborted */

vePE_Done,	/* Done chosen from popup */

vePE_Properties,	/* Properties chosen from popup */

vePE_Undo,	/* Undo chosen from popup */

};

/* IPickEvents */

enum veDrawEvent

{

veDE_Done,	/* drawing is completely done */

veDE_Cancel,	/* drawing has been aborted */

veDE_Pick	/* a point has been picked */

};

/* ISelectionEvents */

enum veSelectEvent

{

veSE_Done,	/* the user is done selecting objects */

veSE_Cancel	/* the user aborted the selection process */

};

the add-on id is a unique identifier created at run-time it should be passed to Vdraft when requesting events it is passed back to the plugin

typedef long vtAddOnID;

/* Return values for plugin functions */

enum veReturn

{

veR_OK,	/* return to continue – “all Okay here” */

veR_Unload,	/* return if the plugin should be unloaded immediately */

veR_DontUnload = veR_OK

};


Enumerated Types
VUtil.Bas – Defined Symbols for VB

 See Also

This shows the contents of the VUTIL.BAS file.  You should include this file in your VB applications when working with Vdraft.

Attribute VB_Name = "Vutil"

' (C) Copyright 1997 by SoftSource.  All rights reserved.

' Useful constants for use with Vdraft

' IUnits::Linear - veLinearUnits

Public Const veLU_Scientific = 1

Public Const veLU_Decimal = 2

Public Const veLU_Engineering = 3

Public Const veLU_Architectural = 4

Public Const veLU_Fractional = 5

' IUnits::Angular - veAngularUnits

Public Const veAU_DecimalDegrees = 0

Public Const veAU_DegMinSec = 1

Public Const veAU_Grads = 2

Public Const veAU_Radians = 3

Public Const veAU_Surveyor = 4

' IDimStyle::Alignment - veDimStyleAlignment

Public Const veDSA_Horizontal = 0

Public Const veDSA_DimLine = 1

Public Const veDSA_Inside = 2

Public Const veDSA_Outside = 3

' IDimStyle::Vertical - veDimStyleVertical

Public Const veDSV_Centered = 0

Public Const veDSV_Above = 1

Public Const veDSV_Relative = 2

' IDimStyle::Horizontal - veDimStyleHorizontal

Public Const veDSH_Default = 0

Public Const veDSH_TextIn = 1

Public Const veDSH_TextArrowsIn = 2

' IDimStyle::Tolerance - veDimStyleTolerance

Public Const veDST_None = 0

Public Const veDST_Variance = 1

Public Const veDST_Limits = 2

' IDimStyle::ArrowsType - veCommonArrowsType

Public Const veCAT_Block = 0

Public Const veCAT_Default = 1

Public Const veCAT_Dot = 2

Public Const veCAT_Tick = 3

' IDimStyle::Arrow1Type

' IDimStyle::Arrow2Type - veSeparateArrowsType

Public Const veSAT_Block = 0

Public Const veSAT_Default = 1

Public Const veSAT_Dot = 2

' IEntity::Type - veEntityType

Public Const veET_Line = 0

Public Const veET_Point = 1

Public Const veET_Circle = 2

Public Const veET_Shape = 3

Public Const veET_Text = 4

Public Const veET_Arc = 5

Public Const veET_Trace = 6

Public Const veET_Solid = 7

Public Const veET_Insert = 8

Public Const veET_Attdef = 9

Public Const veET_Attrib = 10

Public Const veET_2DPolyline = 11

Public Const veET_3DPolyline = 12

Public Const veET_Polymesh = 13

Public Const veET_Polyface = 14

Public Const veET_2DVertex = 15

Public Const veET_Vertex = 16

Public Const veET_FaceVertex = 17

Public Const veET_3DFace = 18

Public Const veET_HorizontalDim = 19

Public Const veET_VerticalDim = 20

Public Const veET_RotatedDim = 21

Public Const veET_AlignedDim = 22

Public Const veET_Angular4PointDim = 23

Public Const veET_DiameterDim = 24

Public Const veET_RadiusDim = 25

Public Const veET_Angular3PointDim = 26

Public Const veET_OrdinateXDim = 27

Public Const veET_OrdinateYDim = 28

Public Const veET_Viewport = 29

' IXData::Type - veXDataType

Public Const veXDT_Invalid = 0

Public Const veXDT_String = 1

Public Const veXDT_Control = 2

Public Const veXDT_Layer = 3

Public Const veXDT_RawData = 4

Public Const veXDT_Handle = 5

Public Const veXDT_Vector = 6

Public Const veXDT_Double = 7

Public Const veXDT_Short = 8

Public Const veXDT_Long = 9

' IXData::Control - veXDataControl

Public Const veXDC_Start = 0    ' starting brace '{'

Public Const veXDC_End = 1  ' ending brace '}'

' IPolyline::Curve

' IPolyline::ColumnCurve

' IPolyline::RowCurve - vePolylineCurve

Public Const vePC_NoCurve = 0

Public Const vePC_Curved = 1

Public Const vePC_Cubic = 2

Public Const vePC_Quadratic = 3

' IText::Horizontal

' IAttdef::Horizontal

' IAttribute::Horizontal - veJustifyHorizontal

Public Const veJH_Left = 0

Public Const veJH_Center = 1

Public Const veJH_Right = 2

Public Const veJH_Align = 3

Public Const veJH_Middle = 4

Public Const veJH_Fit = 5

' IText::Vertical

' IAttdef::Vertical

' IAttribute::Vertical - veJustifyVertical

Public Const veJV_Baseline = 0

Public Const veJV_Bottom = 1

Public Const veJV_Middle = 2

Public Const veJV_Top = 3

' IBlocks::Add - veBlockDefinitionMethod

Public Const veBDM_EntitiesRemoved = 0

Public Const veBDM_ReplacedByInsert = 1

Public Const veBDM_EntitiesLeft = 2

' IMousePick::SetCursorTipInfo - veCursorTipInfo

Public Const veCTI_None = 0

Public Const veCTI_Offset = 1

Public Const veCTI_Scale = 2

Public Const veCTI_Angle = 3

Public Const veCTI_LengthAngle = 4

Public Const veCTI_Height = 5

Public Const veCTI_Width = 6

Public Const veCTI_Radius = 7

Public Const veCTI_Length = 8

Public Const veCTI_Diameter = 9

' IMousePick::TriggerPopup - vePickPopup

Public Const vePP_Done = 0

Public Const vePP_Cancel = 1

Public Const vePP_Properties = 2

Public Const vePP_Undo = 3

Public Const vePP_Help = 4

Public Const vePP_TypeCoordinates = 5

' handy function for setting a VB window to "always on top"

Declare Sub SetWindowPos Lib "User32" (ByVal hWnd&, ByVal hWndAfter&, ByVal x&, ByVal y&, ByVal cx&, ByVal cy&, ByVal flag&)

Public Sub WindowOnTop(ByVal hWnd&)

    SetWindowPos hWnd, -1, 0, 0, 0, 0, &HB

End Sub


Class Hierarchy Chart
Object Hierarchy Chart

NOTE: This help page is available at any time from within the help file by clicking on the “Objects” button at the top of the help window.

IVdraft

IApplicationEvents

IDocuments

IDocument

IApplicationIDs	IApplicationID

IBlocks	IBlock	IEntitySet

IColors	IColor

IDimStyles	IDimStyle

IEntities	IEntity	IXData

IEntitySet	IEntity

IEntitySnap

IHeader

ILayers	ILayer

ILineTypes	ILineType

INamedViews	INamedView

IPickEvents

ISelectionEvent

ITextStyles	ITextStyle

IUcses	IUcs

IUnits

IViews	IView	IAngleSnap

IGridSnap

IEntity

IArc

IAttdef

IBlock

ICircle

IDimension

IFace

IInsert	IAttributes	IAttribute

ILine

IPoint

I2DPolyline	I2DVertices	I2DVertex

I3DPolyline	IVertices	IVertex

IPolymesh	IVertices	IVertex

IPolyface	IVertices	IVertex

IFaceVertices	IFaceVertex

IShape

ISolid

IText

ITrace

IViewport

IMatrix IVector IVectors cVariant
cVdraftEvent

cDrawEvent

cPickEvent

cSelectionEvent


ActiveX Interface Overview
The Virtual Drafter Interfaces

Listed here are all the interfaces for Virtual Drafter.  Each class represents all the methods and properties related to a specific aspect of a drawing or the Vdraft application.  For example, the IBlocks class holds all the methods and property access functions related to the Blocks table with in a given drawing.

NOTE: This help page is available at any time from within the help file by clicking on the “API” button at the top of the help window.

IVdraft	The Virtual Drafter application.

IApplicationEvents	Event notification.

IDocuments	All current documents in Vdraft.

IDocument	Functions for a specific drawing document.

IAngleSnap	The angle snap object within the current drawing.

IApplicationIDs	For registering the name of your application for XData.

IApplicationID	A registered name within the drawing document.

IBlock	A specific block within the blocks table.

IBlocks	The blocks table with in the current drawing.

IColor	A specific color entry with in the color table.

IColors	The colors table for the current drawing.

ICommands	Commands interface into the document.

IDimStyle	A specific dimension style in the current drawing.

IDimStyles	The dimension styles table in the current drawing.

IEntities	The collection of all entities in the current drawing.

IEntity	A generic class for all drawing entities.

I2DPolyline	A 2D polyline

I2DVertices	A collection of 2D vertex points,

I2DVertex	A 2D vertex point, for 2D polylines,

I3DPolyline	A 3D polyline

IArc	An arc object.

IAttdef	An attribute definition object.

IAttribute	An attribute object.

ICircle	A circle object.

IDimension 	A dimension object.

IFace	A 3D face object.

IFaceVertex 	A face in a polyface object.

IInsert	A block insertion object.

ILine	A line object.

IPoint	A point object.

IPolyface	A polyface object.

IPolymesh	A polymesh object.

IShape	A shape object.

ISolid	A solid object (a solid-filled area).

IText	A text object.

ITrace	A trace object (similar to a solid).

IVertex	A vertex object.

IVertices	A collection of vertex objects belonging to a polyline.

IViewport 	A viewport object.

IXData	Extended entity data attached to a particular entity.

IEntitySet	The set of entities in the drawing.

IEntitySnap	Snap settings in the given drawing.

IGridSnap	The grid snap object within the current drawing.

IHeader	Functions for accessing the drawing's settings.

ILayer	A specific layer within the layers table.

ILayers	The layers table within the drawing.

ILineType	A specific line type within the line types table.

ILineTypes	The line types table within the drawing.

INamedView	A specific named view in the current drawing.

INamedViews	The named views table in the current drawing.

IPickEvents	For mouse pick event notifications.

ISelectionEvents	For entity selection event notifications.

ISelection	The current selection set in the drawing.

ITextStyle	A specific text style in the current drawing.

ITextStyles	The text styles table in the current drawing.

IUcs	A specific UCS in the current drawing.

IUcses	The UCSes table in the current drawing.

IUnits	Units settings for this drawing.

IVectors	A collection of IVector objects

IView	A specific view or window in your drawing.

IViews	The views or windows for your drawing.

IMatrix	for manipulating matrices

IVector	a vector, used for vector and for point information

cVariant	for easily dealing with VARIANT data type parameters


cVariant

(Interface Overview)

C++ Class Constructors:

cVariant()

cVariant(BOOL val)

cVariant(short val)

cVariant(long val)

cVariant(double val)

cVariant(BSTR val)

cVariant(CString& val)

cVariant(LPDISPATCH val)

cVariant(cVdraftEvent* ptr)

The cVariant object is a small class that has been created for the benefit of C++ programmers to make for simpler code where parameters must be passed in as VARIANTS, particularly optional parameters, which for C/C++ can not be optional under ActiveX Automation.  Automation does not support default parameters.

This is only useful with C++; Visual Basic does not need and can not use this object.  (Under Visual Basic, the VARIANT parameter needed by some function calls are equivalent to the VB Variant data type.)

The class has essentially only one member function, an inline reference operator.  The inner VooDoo of C++ combined with this one operator allows you to send VARIANT parameters in an easy fashion.

inline operator VARIANT&()

C/C++ Code Samples:

This code fragment retrieves the layer called “MyLAYER”:

//   pDoc already points to the document we are working with

IEntities EntTable(pDoc.GetEntities());

IEntity LastEnt (EntTable.GetLast());

ILayers LyrTable (pDoc.GetLayers());

LastEnt.SetLayer(LyrTable.GetItem(cVariant(“MyLAYER”)));

This code fragment adds a new document if there are no active documents present.  The Add() method off of the Documents interface adds a new drawing only if there is no parameter passed in.

IDocuments Dox(Vdraft.GetDocuments());	// the documents collection

if (Dox.Count() == 0)	// is there an active document?

{

pDox->Add(cVariant());	// add one

}

This last code fragment uses the cVariant to pass in the third parameter for initializing a Vector object.

Vec2.Set(3.5, 5.0, cVariant());

There are many other examples of the use of cVariant’s scattered all through out this help file.  (Click on the “cVariant Examples” button above to see a listing of some of them).


DXF Code Reference

The following is a brief reference guide to the DXF codes found in Vdraft drawings.  They are identical to AutoCAD DXF codes.  You may even find some AutoCAD-related documentation that will give more details about these codes and exactly how they are used for each entity type.  The descriptions here are very generic and the exact usage of a given DXF code can be vary quite a lot depending on the actual entity involved.

This is according to the AutoCAD Release 12 DXF Spec; therefore, you will find an abundance of additional reference materials on DXF in the world, both AutoCAD’s own references as well as the dozens (hundreds?) of books that have been written for R12 and earlier.

0	Identifies the start of an entity, table entry, or file separator.  The value following shows which.
1	The primary text value for an entity
2	A name; attribute tag, block name, etc.
3-4	Other textual or name values
5	Entity handle expressed as hex number
6	Line type name
7	Text style
8	Layer name
9	Variable name identifier – for header only
10	Primary X Coordinate
11 - 18	Other X Coordinates
20	Primary Y Coordinate
21 - 28	Other Y Coordinates
30	Primary Z Coordinate
31 - 37	Other Z Coordinates
38	Entity’s elevation, if nonzero
39	Entity’s thickness, if nonzero
40 - 48	Floating point values (text height, etc)
49	Repeated value
50 - 58	Angles
62	Color number
66	“Entities Follow” flag
70 - 78	integer values, such as repeat counts, etc
210, 220, 230	X, Y, Z components of extrusion direction
999	Comments
1000	ASCII string up to 255 bytes long

See IXData for more information on the following codes and their use.

1001	Registered Application name (string up to 31 bytes long – see ApplicationIDs)
1002	XData Control String
1003	XData Layer Name
1004	Chunk of bytes (up to 127 bytes long)
1005	XData Database handle
1010, 1020, 1030	XData X, Y, Z coodinates.
1011, 1021, 1031	XData X, Y, Z coordinates in 3D World space placement.
1012, 1022, 1032	XData X, Y, Z components of 3D World space displacement.
1013, 1023, 1033	XData X,Y, Z components of 3D World space direction.
1040	XData floating point value
1041	XData distance value
1042	XData scale factor
1070	XData 16-bit integer
1071	XData 32-bit signed long.


ActiveX

A lot of programmers are intimidated by ActiveX (aka OLE) Automation.  Yes, it is – or can be – a vast subject, full of esoteric knowledge such as only dusty medievel mystics would really care for.  But what’s that got to do with us?  Nothing! Working with Vdraft is easy.  We have hidden most of the complexities and made it as easy as we can.  Think of ActiveX simply as a behind-the-scenes bit of VooDoo that you don’t really need to know much about, and you’ll be fine.   (Truly, it’s a lot easier than trying to decipher ARX !!)


LPDISPATCH

An LPDISPATCH is a special Windows data type relating to ActiveX and ActiveX Automation.  It is defined (in OLEAUTO.H, included with MSVC 4.x) as a pointer to an IDispatch interface object.  What it amounts to is the way that ActiveX Automation connections and linkages are referred to.

Under Visual Basic, for instance, you do not have to deal directly with these data types; VB does all that for you.  Under C++, you will need to deal with them, though it can be made very simple and fool-proof.

In one sense it's an indefinite pointer because in itself it contains no information about what sort of object or interface it is pointing to.  For this reason, it is best to deal only briefly with LPDISPATCH's, passing them off quickly to the appropriate constructors.  For example:

// first get the active document in Vdraft

IDocument Doc(Vdraft.GetActiveDocument());	// for currently active doc

// Each of these deals with – quietly – an LPDISPATCH object.

// It is passed immediately and invisibly to the constructor.

IEntities Ents(Doc.GetEntities());	// the drawing entities

ICircle NewCirc(Ents.AddCircle());	// create a new line


BSTR

A BSTR is a special type of string.  It stands for Basic STRing and came originally from Basic.  It is a string preceded by a value giving the string's length.

Visual C/C++ Books Online defines a BSTR as

A length-prefixed string used by OLE Automation data manipulation functions.

typedef OLECHAR *BSTR;

Under Visual Basic, it is handled for you automatically.  You need only deal with strings as you always do.

Under Visual C/C++, the easiest way to deal with BSTR parameters is to use CString objects and simply use them where ever a BSTR is asked for.  Alternatively, you can use the SysAllocString() function to transform an ordinary string into a BSTR.  (See the topics "Data Manipulation Functions" and "String Manipulation Functions" in Microsoft's Books Online for more information about BSTR's.)


Programming for Vdraft is Easy


Common to All Tables
Properties and Methods Common to All Tables

These properties and methods are found in all Vdraft table objects, such as  Blocks, Colors, Layers, Dimstyles, etc.

Properties:

Active	(read-only)

Count	(read-only)

HasItem	(read-only)

Item	(read-only)

Methods:

Add

Dialog

Update

For all table Entries:

Name	(read-only)


All Tables  Add()
All Tables -- Add

APIs Common to All Tables

LPDISPATCH Add(BSTR Name)

Allows you to add a new entry to the given table.  For example, you would use this method on the Linetypes table to create a new linetype or on the Documents table to create a new document.

The return type, listed here as LPDISPATCH, will actually be whatever object type the table consists of.  For example, if you call this member on the Layers table, the return type will an ILayer object.


All Tables  Count()
All Tables-- Count

APIs Common to All Tables

 See Also

long Count()

Read-only.  This is the number of entries in the table.

For the IViews table, please see IViews::Count – it has some special behavior.

Visual Basic Code Sample:

‘ are there any documents currently loaded?

Dim Vdraft As Object

Set Vdraft = CreateObject(“Vdraft.Application”)

If Vdraft.Documents.Count = 0 Then

‘ a good time to start a new drawing…

End If

C/C++ Code Sample:

IVdraft Vdraft;

BOOL bSuccess = pVdraft.CreateDispatch("Vdraft.Application", NULL);

if (pVdraft.GetCount() == 0)	// the number of active docs in Vdraft

{

//  start up a new drawing

}


All Tables  HasItem
All Tables -- HasItem

APIs Common to All Tables

 See Also

boolean GetHasItem(VARIANT which)	(for C/C++ only)

boolean HasItem(VARIANT which)	(for VB only)

which is either an string or a long value.  If a string, it is the name for the entry; if a long, it is the item’s index in the table

For all the tables except IViews & IColors.  This takes the same options as Item (BSTR or long) and returns True if the table has an item of that name or index.


All Tables  Dialog()
All Tables -- Dialog

APIs Common to All Tables

void Dialog()

Activates the dialog box related to the table.

Does not apply to IApplicationIDs.


All Tables  Active()
All Tables -- Active

APIs Common to All Tables

LPDISPATCH GetActive()	(for C/C++ only)

void SetActive(LPDISPATCH)	(for C/C++ only)

Active(LPDISPATCH)	(for VB only)

These two interfaces retrieve and set the Active property for the given table.  That is, Acitve is the 1-based index in the table of the currently active entry for that table.

The return type, listed here as LPDISPATCH, will actually be whatever object type the table consists of.  For example, if you call this member on the Layers table, the return type will an ILayer object.

Does not apply to IApplicationIDs.

Visual Basic Code Sample:

‘

‘  pLayers is the Layers table object, already properly obtained

Dim Layer As Object

Set Layer = pLayers.Active	‘ get the active layer in document


All Tables  Update()
All Tables -- Update

APIs Common to All Tables

void Update()	(for C/C++ only)

void UpdateNow	(for VB only)

This method causes the table to do a self update, incorporating any changes you may have made since the last update.

It is not always necessary to explicitly call the Update method on a table.  If the table is assigned to a variable, (which it always is if you are working with it, though it’s not always obvious that it is) as soon as that variable goes out of scope the table will automatically update itself.

Does not apply to IApplicationIDs.

Visual Basic Code Sample:

In this sample code we will assume that the object variable Vdraft already is properly initialized, either with a call to CreateObject() or with a call to the Vdraft OCX

Dim ILayers, NewLayer As Object

Set ILayers = Vdraft.ActiveDocument.Layers

Set NewLayer = ILayers.Add (“MyLayer”)

ILayers.Update


All Tables  Item()
All Tables -- Item

APIs Common to All Tables

LPDISPATCH Item(const VARIANT& which)

The default property for any table, it returns a dispatch interface (an IDispatch) to the nth entry in the table.  The parameter can be a BSTR, containing the table entry’s name or, in the case of entities, the entry’s handle.  It can also be a long value representing the entry’s 1-based index in the table.

NOTE: For IVertices, IAttributes and I2DVertices, Item() will only accept an index value, not a handle or name value.

The return type, listed here as LPDISPATCH, will actually be whatever object type the table consists of.  For example, if you call this member on the Layers table, the return type will an ILayer object.

For the IViews table, please see IViews::Item.  It has some special behavior.

Visual Basic Code Sample:

This sample shows retrieving the first entry in the LineTypes table.

Dim Vdraft, Doc, LTs, LineType As Object

Set Vdraft = CreateObject(“Vdraft.Application”)

Set Doc = Vdraft.ActiveDocument

Set LTs = Doc.LineTypes

‘   LTs is now the LineTypes table for the active document

Set LineType = LTs.Item(1)	‘ get the first entry in the linetypes table

You could also grab a table entry by its name.  That is, the final line of the example could also be:

Set LineType = LTs.Item(“CONTINUOUS”)	‘ get the continuous linetype

C/C++ Code Sample:

In this example we will retrieve a particular document from Vdraft and display the number of entities in the drawing.

IVdraft Vdraft;	// grab vdraft.

Vdraft.CreateDispatch("Vdraft.Application", NULL);

IDocuments Dox(Vdraft.GetDocuments());	// for currently active doc

IDocument Dok = Dox.GetItem(cVariant(“MyDoc”));

IEntities Ents = Dok.GetEntities();

long NumEnts = Ents.GetCount();

TCHAR Buff[255];

_sprintf(Buff, “There are %li entities in the drawing”, NumEnts);


All Tables  Name()
All Table Entries -- Name

APIs Common to All Tables

 See Also

BSTR GetName()	(for C/C++ only)

BSTR Name	(for VB only)

This method is common to all table entries, NOT to the tables themselves.  It returns the entry’s name.  For example, a layer table entry’s name will come back as the layer’s name, such as “HIDDEN”, or “CONSTRUCTION”.


IUnits

(Interface Overview)

API Overview

C++ Class Constructors:

IUnits()

IUnits(LPDISPATCH pDispatch)

IUnits(const IUnits& dispatchSrc)

This collection of properties and methods related to the Units Settings in the particular drawing in Vdraft.

Properties: AngleBase Angular AngularDigits Application (read-only) Clockwise Linear LinearDigits Parent (read-only) Methods: AngleToString CoordinateToString PointToString StringToAngle StringToCoordinate StringToPoint


IUnits::Angular()
IUnits::Angular

 IUnits Class Overview

 See Also

veAngularUnits GetAngular()	(for C/C++ only)

void SetAngular(veAngularUnits)	(for C/C++ only)

veAngularUnits Angular	(for VB only)

This is the angular units setting.  See veAngularUnits for the valid choices.


IUnits::AngleBase()
IUnits::AngleBase

 IUnits Class Overview

 See Also

double GetAngleBase()	(for C/C++ only)

void SetAngleBase(double)	(for C/C++ only)

double AngleBase	(for VB only)

Angle base is the “zero point” or reference point for angles.  It defaults to 0 degree/radians, but can be set to anything.  Among other things, this could make it really easy to translate objects without having to recompute angles; simply change the angle base.


IUnits::AngularDigits()
IUnits::AngularDigits

 IUnits Class Overview

short GetAngularDigits()	(for C/C++ only)

void SetAngularDigits(short)	(for C/C++ only)

short AngularDigits	(for VB only)

This specifies the number of digits of precision used in displaying angles.  From 0 to 8 decimal points may be specified.

Visual Basic Code Sample:

Dim Vdraft As Object

Set Vdraft = CreateObject(“Vdraft.Application”)

Print Vdraft.ActiveDocument.Units.AngularDigits	‘   show current precision

‘

Vdraft.ActiveDocument.Units.AngularDigits = 4	‘   set precision to 4 decimal points


IUnits::Clockwise()
IUnits::Clockwise

 IUnits Class Overview

 See Also

BOOL GetClockwise()	(for C/C++ only)

void SetClockwise(BOOL)	(for C/C++ only)

BOOL Clockwise	(for VB only)

Are angles measured in a clockwise or counter-clockwise direction from the angle base point?


IUnits::Linear()
IUnits::Linear

 IUnits Class Overview

 See Also

veLinearUnits GetLinear()	(for C/C++ only)

void SetLinear(veLinearUnits)	(for C/C++ only)

veLinearUnits Linear	(for VB only)

This sets the style of linear measure (as opposed to angular measure).  Choices are:


IUnits::LinearDigits()
IUnits::LinearDigits

 IUnits Class Overview

short GetLinearDigits()	(for C/C++ only)

void SetLinearDigits(short)	(for C/C++ only)

short LinearDigits	(for VB only)

Sets the number of decimal points of precision that are displayed for linear measurements.  Any value from 0 to 8 is acceptable.

Visual Basic Code Sample:

Dim Vdraft As Object

Set Vdraft = CreateObject(“Vdraft.Application”)

Print Vdraft.ActiveDocument.Units.LinearDigits	‘   show current precision

‘

Vdraft.ActiveDocument.Units.LinearDigits = 4	‘   set precision to 4 decimal points


IUnits::CoordinateToString()
IUnits::CoordinateToString

 IUnits Class Overview

 See Also

BSTR CoordinateToString(double value)

This converts a given coordinate value (in drawing units) to a string using the current units settings.  For example, the number 180, when Vdraft is set for Decimal or Scientific Units, will return “180.0000” (assuming that linear digits are set to 4), or “ 15’ ” if Vdraft is set to Architectural Units (treating it as 180 inches).


IUnits::StringToPoint()
IUnits::StringToPoint

 IUnits Class Overview

 See Also

IVector StringToPoint(BSTR string)

This will take a string representation of X, Y, and Z coordinates and will return them as an IVector object.  For example, given the string 5' 2 1/2", 3' 1.2", 2.5 it will return a vector with xyz values of 62.5, 37.2, 2.5.


IUnits::StringToCoordinate()
IUnits::StringToCoordinate

 IUnits Class Overview

 See Also

double StringToCoordinate(BSTR string)

This will take a string representation of a coordinate and convert it to a number using the current linear units settings.


IUnits::StringtoAngle()
IUnits::StringToAngle

 IUnits Class Overview

 See Also

double StringToAngle(BSTR string)

This will take a string describing an angle and return it as a number in radians.  The string can be any of the formats supported by the Vdraft user interface.  The following are samples of the formats supported and the values that would be returned.

30.39	0.530405559681077	Decimal Degrees

58 32’ 17.19”	1.01229096615671	Deg/Min/Sec

67.25g	1.05636052976957	Gradians

3.14r	3.14	Radians

S 53 2’ 5.2” W	3.78736447682769	Surveyor

Visual Basic Code Sample:

?Vdraft.ActiveDocument.Units.StringToAngle ("180")

The above command will return 3.14159265358979 as a double floating point value.


IUnits::PointToString()
IUnits::PointToString

 IUnits Class Overview

 See Also

BSTR PointToString(IVector pt)

Return the given point’s coordinates in a string that uses the current units settings.

Visual Basic Code Sample:

The following code will print out a string such as “10.0000, 15.0000” depending on how the units are currently set in Vdraft.  The settings affecting this are Linear Digits and Linear Units.

Dim Vdraft, Pt As Object

Set Vdraft = CreateObject(“Vdraft.Application”)

Set Pt = Vdraft.ActiveDocument.Entities.AddPoint

Pt.Where.Set 10,15

Print Vdraft.ActiveDocument.Units.PointToString (Pt.Where)


IUnits::AngleToString()
IUnits::AngleToString

 IUnits Class Overview

 See Also

BSTR AngleToString(double angle)

Return the given angle in radians as a string using the current angle units settings.

Visual Basic Code Sample:

The following commands, typed in at VB’s debug window, if Vdraft is loaded and available, and the drawing’s angular units are set for Degrees:

?Vdraft.ActiveDocument.Units.AngleString (3.14159)

returns the string “180”, having converted the angle in radians to the currently specified units for the string.  The settings that affect the final output are Angular Units and Angular Digits.


ICommands

(Interface Overview)

C++ Class Constructors:

ICommands()

ICommands(LPDISPATCH pDispatch)

ICommands(const ICommands& dispatchSrc)

This is the commands interface to the current drawing.  It includes the Undo/Redo lists, the macro interface, etc.

Properties:

Application	(read-only)

Count	(read-only)

Item	(read-only)

Parent	(read-only)

Methods:

Do

EndGroup

Group

Redo

Restart

Undo


ICommands::Count()
ICommands::Count

 ICommands Class Overview

 See Also

long GetCount()	(for C/C++ only)

long Count	(for VB only)

Returns the number of commands currently in the Undo list.  It returns only the top-level entries in the list.  That is, if a group of 100 separate commands have been grouped under one heading, it will count as only one entry.  (See Group/EndGroup for more information on grouping commands.)

NOTE: At this time there is no equivalent for the Redo list.

Visual Basic Code Sample:

Assuming that the object “UndoCount” is a textbox and “UndoList” is a listbox on the form “MainForm” then the following code will fill in that list box with the

Sub UpdateUndoList()

'

'   update the undo list tab page

'

    Dim Vdraft, Commands As Object

    Set Vdraft = CreateObject(“Vdraft.Application”)

    Set Commands = Vdraft.ActiveDocument.Commands

    MainForm.UndoCount = ""

    MainForm.UndoList.Clear

    If (Not Commands Is Nothing) Then

        Dim i, C%, Cmd As Object

        C% = Commands.Count

        MainForm.UndoCount = "There are " & Trim$(Str$(C%)) & " entries in the Undo List"

        For i = 1 To C%

            Set Cmd = Commands.Item(i)

            MainForm.UndoList.AddItem Cmd.Item

            Set Cmd = Nothing

        Next

        MainForm.UndoList.ListIndex = -1	' highlight nothing

    End If

End Sub


ICommands::Do()
ICommands::Do

 ICommands Class Overview

BOOL Do(BSTR command)

Tells Vdraft to execute a command string.

The quickest way to find out exaactly what a particular command string would be is to manually execute the actions you want and then examine the Undo/Redo list.  The syntax shown in that list is the same as for this function.

Visual Basic Code Sample:

Given a listbox called “tstScriptList” on form “MainForm”, and given that this listbox contains a series of Macro commands for Vdraft (that is, commands just as you see them in the Undo/Redo lists), then the following code will have Vdraft execute whatever is in that list.  It’s something like you might find at the core of an add-on macro tool or script recorder for Vdraft.

Dim Vdraft, Commands As Object

Set Vdraft = CreateObject(“Vdraft.Applicatioin”)

Set Commands = Vdraft.ActiveDocument.Commands

Dim Cmd$, i%

For i% = 0 To MainForm.tstScriptList.ListCount - 1

    Cmd$ = MainForm.tstScriptList.List(i%)

    Commands.Do Cmd$

Next


ICommands::Group()
ICommands::Group

ICommands::EndGroup

 ICommands Class Overview

void EndGroup()

void Group(BSTR description)

These two functions allow to group a collection of commands under one, more meaningful entry in the Undo/Redo list.  This allows you to take your, possibly quite complex, action that was activated by the user with perhaps a single button, an action consisting of dozens or hundreds of Vdraft calls, and wrap them all up as a single entry in the Undo/Redo list.

This can be very much easier on the user.

NOTE: It is very important to be sure that the EndGroup() function gets called as soon as is appropriate.  If the action is cancelled out, be sure that the EndGroup() still gets called.  Otherwise, the Undo/Redo list will effectively be disabled until the Group is closed.

Visual Basic Code Sample:

Dim Vdraft, Commands As Object

Vdraft = CreateObject(“Vdraft.Application”)

Set Commands = Vdraft.Commands

Commands.Group “Sample Grouping”

‘ now execute any number of other commands

‘ necessary to complete the desired action

Cancel:	‘ if cancelled, be sure to call EndGroup

Vdraft.Commands.EndGroup()	‘ (not strictly necessary – as soon as Commands object

‘ goes away, the grouping will be closed anyway.)

C/C++ Code Sample:

IVdraft Vdraft ();

Vdraft.CreateDispatch("Vdraft.Application", NULL);

ICommands iCmds(Vdraft.Commands());

iCmds.Group(“Sample Grouping”);

‘ do your VooDoo here….

// you do not have to specifically close the grouping, as shown here.

// the grouping will close automatically when the iCmd object goes

// out of scope.  You can close it anyway, just to be sure.

iCmds.EndGroup();


ICommands::Item()
ICommands::Item

 ICommands Class Overview

BSTR Item(long Idx)

Item(n) the full command description as it appears in the undo/redo list).

For Sample Code, see ICommands::Undo


ICommands::Undo()
ICommands::Undo

ICommands::Redo

 ICommands Class Overview

 See Also

BOOL Redo(const VARIANT& howmany)

BOOL Undo(const VARIANT& howmany)

Executes an Undo or Redo of the indicated number of items in the corresponding commands list.  Commands may be undone or redone only from the top of the list on down, and no entries in the list can be skipped.  That is, you could undo the first 6 entries in the Undo list, but you could not skip the first 2 and then undo some.

Visual Basic Code Sample:

Given a listbox called “UndoList” on form “MainForm” and given that this list box has already been intialized with the available contents of Vdraft’s Undo list, the following code will undo however many commands have been highlighted.  NOTE:  Commands in Vdraft must be redone from most recent back without skipping any; that is, you can not undo entries 1,3 and 5; you must undo 1, 2, 3, 4 and 5.

With MainForm.UndoList

    Dim i%, flag

    flag = 0

    For i% = 0 To .ListCount - 1

        If .Selected(i%) = True Then

            flag = flag + 1     ' count the number to be undone

        End If

    Next

End With

If (flag > 0) Then

    Commands.Undo flag          ' undo x-number of commands

End If


ICommands::Restart()
ICommands::Restart

 ICommands Class Overview

 See Also

BOOL Restart()

Restarts the previous command.  Same as using the default popup mouse menu’s Restart option (the center tile in the right mouse button context sensitive menu).

Visual Basic Code Sample:

‘ restart previous command

Vdraft.ActiveDocument.Commands.Restart


IApplicationIDs

(Interface Overview)

 See Also

C++ Class Constructors:

IApplicationIDs()

IApplicationIDs(LPDISPATCH pDispatch)

IApplicationIDs(const IApplicationIDs& dispatchSrc)

And application name is the name you give your application for internal tracking in the drawing database.  For example, with XData, the Application Names are used to tell which data belongs to which applications, since an entity could have any amount of XData attached to it, and this data could belong to any of several applications.

Properties:

Active	(read-only)

Application	(read-only)

Count	(read-only)

HasItem	(read-only)

Item	(read-only)

Parent	(read-only)

Methods:

Add

Dialog

Update


IApplicationIDs::Add()
IApplicationIDs::Add

 ICommands Class Overview

 See Also

void Add(BSTR Name)

Adds a new application name to the document.  You can use any number of applicaiton names that you find convenient.  But keep in mind that other add-on applications may also be adding application names to the same drawing.  Therefore, your applicaiton name should be relatively unique: “SmithsWidgets1” rather “app1” would be less likely to cause trouble.

For more information about ApplicationIDs and what they are really for, see XData.


IApplicationID

(Interface Overview)

 See Also

C++ Class Constructors:

IApplicationIDs()

IApplicationIDs(LPDISPATCH pDispatch)

IApplicationIDs(const IApplicationIDs& dispatchSrc)

And application name is the name you give your application for internal tracking in the drawing database.  For example, with XData, the Application Names are used to tell which data belongs to which applications, since an entity could have any amount of XData attached to it, and this data could belong to any of several applications.

Properties:

Application	(read-only)

Name	(read-only)

Parent	(read-only)


IApplicationID::Name()
IApplicationID::Name

 IApplicationID Class Overview

BSTR GetName()	(for C/C++ only)

void SetName(BSTR Name)	(for C/C++ only)

BSTR Name	(for VB only)

Gets and sets the actual application name text.


ILayers

(Interface Overview)

 See Also

C++ Class Constructors:

ILayers()

ILayers(LPDISPATCH pDispatch)

ILayers(const ILayers& dispatchSrc)

The ILayers class deals with the Layer Table in Vdraft.  It is the collection of all the layers in the document, or a collection of ILayer objects..

Properties:

Active	(read-only)

Application	(read-only)

Count	(read-only)

HasItem	(read-only)

Item	(read-only)

Parent	(read-only)

Methods:

Add

Dialog

Update


ILayer

(Interface Overview)

 See Also

C++ Class Constructors:

ILayer()

ILayer(LPDISPATCH pDispatch)

ILayer(const ILayer& dispatchSrc)

This object allows you access to a particular layer within a drawing, that is, one of the ILayer objects in the ILayers collection.

Properties:

Application	(read-only)

Color

ColorNumber

Frozen

Linetype

On

Name

Parent	(read-only)


ILayer::On()
ILayer::On

 ILayer Class Overview

BOOL GetOn()	(for C/C++ only)

void SetOn(BOOL)	(for C/C++ only)

On	(for VB only)

This is used for turning a layer on or off, or for telling if a layer is on or off.  If a layer is turned off, it is not visible to the user.  If you are doing a lot of new entity contruction on a particular layer, it may be desireable to turn it off first.

Visual Basic Code Sample:

Dim prevOnOff As Integer

Dim MyLayer As Object

Set MyLayer = Vdraft.ActiveDocument.Layers.Item(“MyLayer”)

prevOnOff = MyLayer.On

‘

‘  do some stuff to the layer

‘

MyLayer.On = prevOnOff	‘ restore layer’s previous on/off setting


ILayer::Frozen()
ILayer::Frozen

 ILayer Class Overview

BOOL GetFrozen()	(for C/C++ only)

void SetFrozen(BOOL)	(for C/C++ only)

Frozen	(for VB only)

A frozen layer is locked for changes.  These functions allow you to set or get the current setting of the layer as regards Frozen or not.  Can still put anything on the layer as you wish.

Visual Basic Code Sample:

Dim prevOnOff As Integer

Dim MyLayer As Object

Set MyLayer = Vdraft.ActiveDocument.Layers.Item(“MyLayer”)

prevFreeze = MyLayer.Frozen

MyLayer.Frozen = False	‘ be sure layer is “thawed”

‘

‘  do some stuff to the layer

‘

MyLayer.Frozen = prevFreeze	‘ restore layer’s previous frozen setting


ILayer::Color()
ILayer::Color

 ILayer Class Overview

 See Also

IColor GetColor)	(for C/C++ only)

void SetColor(IColor color)	(for C/C++ only)

Color	(for VB only)

Get or Set the color of the layer.  The value returned is a string that identifies the color.  It is the same string as what appears in the color selection dialog boxes in Vdraft.  For example, color number 5 comes back as “Blue”, while color number 134 comes back as “134”.  If the color selection for the layer is “Same as Block” then that exact string is what is returne.

Visual Basic Code Sample:

Dim prevOnOff As Object

Dim MyLayer As Object

Set MyLayer = Vdraft.ActiveDocument.Layers.Item(“MyLayer”)

prevColor = MyLayer.Color

 ‘

‘  do some stuff to the layer and/or its color

‘

MyLayer.Color = prevColor	‘ restore layer’s previous frozen setting


ILayer::ColorNumber()
ILayer::ColorNumber

 ILayer Class Overview

 See Also

short GetColorNumber()	(for C/C++ only)

void SetColorNumber(short color)	(for C/C++ only)

short Color	(for VB only)

Get or set the color of the layer, by the number of the color, that is, it's index value in the color table.  See also, IColor


ILayer::Linetype()
ILayer::Linetype

 ILayer Class Overview

 See Also

ILineType GetLinetype()	(for C/C++ only)

void SetLinetype(ILineType lyn)	(for C/C++ only)

Linetype	(for VB only)

Set or Get the current line type setting for the given layer.

Visual Basic Sample:

Under Visual Basic, if you issue the following commands in the debug window

Set Vdraft = CreateObject(‘Vdraft.Application”)

?Vdraft.ActiveDocument.Layers.Item("MyLayer").LineType

you will get back the name of the linetype, such as “CONTINUOUS” or “CENTER”.

C/C++ Code Sample:

In C/C++, what is returned by the GetLinetype() function is an interface to the matching linetype in the ILineTypes table, that is, to the linetype itself.


ILayer::Name()
ILayer::Name

 ILayer Class Overview

 See Also

BSTR GetName	(for C/C++ only)

void SetName(BSTR lyn)	(for C/C++ only)

BSTR Name	(for VB only)

Set or Get the current line type setting for the given layer.


ILinetypes

(Interface Overview)

 See Also

C++ Class Constructors:

ILinetypes()

ILinetypes(LPDISPATCH pDispatch)

ILinetypes(const ILinetypes& dispatchSrc)

The ILinetypes class deals with the linetypes table in the document.  It is a collection of ILinetype items.

There is source code provided with Vdraft for LineType.Exe (the LineTyper) that is a small appliation for helping the user to create new linetypes.  This code has many examples of manipulating the ILineTypes, ILineType objects, and more.

Properties:

Application	(read-only)

Parent	(read-only)

Active	(read-only)

Count	(read-only)

HasItem	(read-only)

Item	(read-only)

Scaling

PaperSpaceScaling

SameAsBlock	(read-only)

SameAsLayer	(read-only)

Methods:

Add

Dialog

Update


ILinetypes::PaperSpaceScaling

 IViewport Class Overview

boolean GetPaperSpaceScaling()	(for C/C++ only)

void SetPaperSpaceScaling(boolean)	(for C/C++ only)

boolean PaperSpaceScaling(boolean)	(for VB only)

Gets or Sets the linetype scaling factor for use in paperspace.


ILinetypes::SameAsLayer

 IViewport Class Overview

ILinetype GetSameAsLayer	(for C/C++ only)

ILinetype SameAsLayer	(for VB only)

Returns the linetype “SameAsLayer”.  This enables you to set the linetype of any particular entity to the SameAsLayer linetype.


ILinetypes::SameAsBlock

 IViewport Class Overview

ILinetype SameAsBlock

Returns the linetype “SameAsBlock”.  This enables you to set the linetype of any particular entity to the SameAsBlock linetype.


ILinetypes::Scaling()
ILinetypes::Scaling

 ILinetypes Class Overview

double GetScaling()	(for C/C++ only)

void SetScaling(double)	(for C/C++ only)

Scaling	(for VB only)

This reads and set the scaling factor for all linetypes.  It is a global setting in Vdraft, affecting all linetypes.  For more information on scaling factors, refer to the Vdraft on-line documentation.


ILinetype

(Interface Overview)

 See Also

C++ Class Constructors:

ILinetype()

ILinetype(LPDISPATCH pDispatch)

ILinetype(const ILinetype& dispatchSrc)

The ILinetype class contains all the properties and methods that apply to manipulating a given linetype.  ILinetype objects are the objects contained by the ILinetypes table.

NOTE: LineType.Exe is a sample application included with Vdraft; the full VB code for this app is also included, under \Vdraft\Programs\VB\LineType.  This example code is a great source of how to do things with linetypes, since the LineType.Exe does many things with linetypes.

Available Interfaces:

Application	(read-only)

Count	(read-only)

Description

Item

Name	(read-only)

Parent	(read-only)


ILinetype::Description()
ILinetype::Description

 ILinetype Class Overview

BSTR GetDescription()	(for C/C++ only)

void SetDescription(BSTR)	(for C/C++ only)

Description	(for VB only)

This sets or gets the description string that goes along with the given linetype.

Visual Basic Sample:

Running the following code from the Visual Basic debug window (with “Vdraft” being an object already set for “Vdraft.Application”)

?Vdraft.ActiveDocument.Linetypes.Item("CONTINUOUS").Description

will return “Solid Line” which is the description string for the built-in Continuous linetype.  Alternatively, you could enter it in as:

?Vdraft.ActiveDocument.Linetypes.Item(1).Description

which specified the index number of the linetype rather than its name.


ILinetype::Count()
ILinetype::Count

 ILinetype Class Overview

short GetCount()	(for C/C++ only)

Count	(for VB only)

Returns the number of linetypes currently in the drawing.

NOTE: The linetype dialog box in Vdraft will show, besides the builtin Continuous type, “Same as Layer” and “Same as Block”.  Even though these show up in the list of linetypes, they are not entries in the linetypes table.  On a brand new or empty drawing, then, though the linetypes dialog box lists three entries, Count() will return a value of 1 (or more if additional linetypes were defined in the template the new drawing was derived from).

Visual Basic Code Sample:

The following sample code shows how to display all the pieces of a particular line type in a listbox.  This illustrates several concepts for dealing with linetypes.  List1 is a listbox and Text1 is a text box on the main form.

Private Sub ShowLineType(Idx As Integer)

    ‘ fill a list box with the pieces of a given linetype

‘

    Dim Vdraft, LT As Object

    Dim I% As Integer

    Set Vdraft = CreateObject(“Vdraft.Application”)

    If Idx <= Vdraft.ActiveDocument.LineTypes.Count Then

        List1.Clear

        Set LT = Vdraft.ActiveDocument.LineTypes.Item(Idx)

        For I% = 1 To LT.Count

            List1.AddItem LT.Item(I%)

        Next

        ‘   get the linetype’s description string

        Text1.Text = LT.Description

End If


ILinetype::Item()
ILinetype::Item

 ILinetype Class Overview

double GetItem(short index)	(for C/C++ only)

double GetItem(BSTR name)	(for C/C++ only)

void SetItem(short index, double NewValue)	(for C/C++ only)

Item(integer index)	(for VB only)

Item(BSTR name)	(for VB only)

Used for retrieving the details of a linetype.  For example, the linetype “CENTER” might be defined to look like this:

____ _ ____ _ ____ _ ____ _ ____ _

The definition of this linetype would be thus:

 1.25	long dash, 1.25 units long

-0.25	space, 0.25 units long

 0.25	short dash, 0.25 units long

-0.25	space, 0.25 units long

Positive values indicate a length of line, negative values indicate a gap length.  If 0.0 is specified, it means a dot.

Each of the four items in the list above would be an “Item” for the linetype, retrievable by index values 1 thru 4, respectively.

Visual Basic Code Sample:

The following code will create the linetype outlined above.

Dim LTs, LineType As Object

Set LTs = Vdraft.ActiveDocument.LineTypes	' the linetypes table in the new dwg

LTs.Add “MyLineType”	' add new line type to linetypes table

Set LineType = LTs.Item(“MyLineType”)	' get handle to new linetype

LineType.Description = “----- - ----- - ----- - -----”

LineType.Item(1) = 1.25	‘ long dash

LineType.Item(2) = -0.25	‘ space

LineType.Item(3) = 0.25	‘ short dash

LineType.Item(4) = -0.25	‘ space


IBlocks

(Interface Overview)

 See Also

C++ Class Constructors:

IBlocks()

IBlocks(LPDISPATCH pDispatch)

IBlocks(const IBlocks& dispatchSrc)

The IBlocks object is a collection of IBlock objects, that is to say, of Blocks.

Properties:

Application	(read-only)

Count	(read-only)

HasItem	(read-only)

InsertBase

Item	(read-only)

PaperspaceInsertBase

Parent	(read-only)

XrefVisibility

Methods:

Add

Dialog

Load

Update


IBlocks::InsertBase()
IBlocks::InsertBase

 IBlocks Class Overview

IVector GetInsertBase()	(for C/C++ only)

void SetInsertBase(IVector)	(for C/C++ only)

IVector InsertBase	(for VB only)

Get and Set the insertion base point for the entire drawing.  This has effect when a drawing is inserted into another drawing as an XRef.  In that case, then the InsertBase point will act as the “block insertion point” for the drawing.


IBlocks::PaperspaceInsertBase

 IBlocks Class Overview

IVector GetPaperspaceInsertBase()	(for C/C++ only)

void SetPaperspaceInsertBase(IVector)	(for C/C++ only)

IVector PaperspaceInsertBase	(for VB only)

Set and Get the paperspace insertion base point.


IBlocks::XrefVisibility()
IBlocks::XrefVisibility

 IBlocks Class Overview

boolean GetXrefVisibility()	(for C/C++ only)

void SetXrefVisibility(boolean)	(for C/C++ only)

boolean XrefVisibility	(for VB only)


IBlocks::Add()
IBlocks::Add

 IBlocks Class Overview

 See Also

IBlocks::Add(BSTR name, IVector basepoint, VARIANT &how).

Creates a new block from the current selection set.  The final parameter can be an enumerated type eaBlockDefinitionMethod.


IBlocks::Load()
IBlocks::Load

 IBlocks Class Overview

 See Also

IBlock Load(LPCTSTR filename, const VARIANT& asxref, const VARIANT& blockname);

Loads a block in from file.

'asxref' is an optional boolean, which defaults to FALSE, that determines whether this block is to be treated as an external block reference or made into an internal block with in the drawing..

'blockname' is an optional string which is the name of the block.  If not specified, it uses the filename (without path or extension) as the name of the block.  It returns the new IBlock it created.

Visual Basic Code Sample:

Dim Vdraft, Blocks, Blok As Object

Set Vdraft = CreateObject(“Vdraft.Application”)

Set Blocks = Vdraft.ActiveDocument.Blocks

Set Blok = Blocks.Load(“c:\myblock”)

C/C++ Code Sample:

// assuming iVdraft already points to Vdraft

IDocument iDoc(iVdraft.GetActiveDocument());

IBlocks iBlox(iDoc.GetBlocks());

IBlock iNewBlok(iBlox.Load(“c:\myblock”, cVariant(), cVariant());


IBlock

(Interface Overview)

 See Also

C++ Class Constructors:

IBlock()

IBlock(LPDISPATCH pDispatch)

IBlock(const IBlock& dispatchSrc)

This is the collection of methods and properties related to blocks.  See IInsert for block insertions in a drawing.  There is excellent sample code that ships with Vdraft with the sample application “Attribs,” a VB applet for reading all blocks in a drawing and reporting various bits of information about each one.

Properties:

Application	(read-only)

ExentsMax	(read-only)

ExentsMin	(read-only)

HasAttributes	(read-only)

Inserts	(read-only)

IsAnonymous	(read-only)

IsXref

Name

Parent	(read-only)

Where


IBlock::Where()
IBlock::Where

 IBlock Class Overview

 See Also

IVector GetWhere()	(for C/C++ only)

void SetWhere(IVector vec)	(for C/C++ only)

Where	(for VB only)

The base point for the block.  Returns an IVector object.

Block Coordinate System is based on bounding box of the block.  Moving the base point will be relative to the 0,0 point of the bounding box around block.

Visual Basic Code Sample:

The follow sample will change the insertion point of the first block in the blocks table of the active drawing.  (In an ideal universe, of course, one would also check first to be sure that there even is a block #1 in the blocks table.)

Dim Vdraft, Block As Object

Set Vdraft = CreateObject(“Vdraft.Application”)

Set Block = Vdraft.ActiveDocument.Blocks.Item(1)

Block.Where.Set 10,10	‘ move insertion point to 10,10


IBlock::ExtentsMin()
IBlock::ExtentsMin

 IBlock Class Overview

IVector ExentsMin()	(read-only)

Returns the upper-left point of the extents box around the block.  It’s the “minimum” extents of the block.


IBlock::ExtentsMax()
IBlock::ExtentsMax

 IBlock Class Overview

IVector ExentsMax()	(read-only)

Returns the lower right point of the extents box around the block.  It’s the “maximum” extents of the block.


IBlock::HasAttributes()
IBlock::HasAttributes

 IBlock Class Overview

boolean GetHasAttributes()	(for C/C++ only)

boolean HasAttributes()	(for VB only)

Tells you whether the block has attributes attached to it or not.


IBlock::Inserts()
IBlock::Inserts

 IBlock Class Overview

IEntitySet GetInserts()	(for C/C++ only)

IEntitySet Inserts()	(for VB only)

Returns an entity set containing all the inserts in the drawing of this particular block.


IBlock::IsAnonymous()
IBlock::IsAnonymous

 IBlock Class Overview

boolean GetIsAnonymous()	(for C/C++ only)

boolean IsAnonymous()	(for VB only)

Tells you whether the block in anonymous block or not (such as hatching, dimensions, etc.)


IBlock::IsXref()
IBlock::IsXref

 IBlock Class Overview

BOOL GetIsXref()	(for C/C++ only)

BOOL IsXref()	(for VB only)

Read-Only.  Is the block an Xref (external reference) or not?  The alternative is a regular or internal block.


IDimStyles

(Interface Overview)

C++ Class Constructors:

IDimStyles()

IDimStyles(LPDISPATCH pDispatch)

IDimStyles(const IDimStyles& dispatchSrc)

This is the collection of all dim styles in the drawing.  From here you can create a new dimension style or access any of the existing ones in order to use it or modify it however you wish.

Properties:

Active

Application	(read-only)

Count	(read-only)

HasItem	(read-only)

Item	(read-only)

Parent	(read-only)

Unnamed	(read-only)

Methods:

Add

Dialog

Update


IDimStyles::Unnamed

 IDimStyle Class Overview

IDimStyle GetUnnamed()	(for C/C++ only)

IDimStyle Unnamed	(for VB only)

Gains you access to the “*Unnamed” dimension style.


IDimStyle

(Interface Overview)

 See Also

C++ Class Constructors:

IDimStyle()

IDimStyle(LPDISPATCH pDispatch)

IDimStyle(const IDimStyle& dispatchSrc)

IDimStyle is the largest set of interfaces in Vdraft.  This is a dimension style in Vdraft.  It allows you to set up any type of dimensioning you may wish or need.  There are many possible settings and you may want to experiment with them manually in Vdraft in order to get familiar with how these interact with each other.

Available Interfaces:

Alignment

AlternatePostText

AlternatePrecision

AlternateScaling

AlternateUnits

Application	(read-only)

Arrow1Block

Arrow1Type	(read-only)

Arrow2Block

Arrow2Type	(read-only)

ArrowsBlock

ArrowSize

ArrowsType

BaselineIncrement

BoxAroundText

CenterMarkSize

CreateCenterLines

DimensionLineColor

Extension1Visibility

Extension2Visibility

ExtensionAboveLine

ExtensionColor

ForceInteriorLines

Horizontal

LengthScaling

Lower

Name	(read-only)

OffsetFromFeature

Parent	(read-only)

PostText

PreText

RoundOff

Scaling

SeparateArrowHeads

TextColor

TextGap

TextHeight

TextHeightValue

TickExtension

TickSize

ToleranceHeightScaling

Tolerance

Upper

Vertical

VerticalPosition


IDimStyle::ExtensionAboveLine()
IDimStyle::ExtensionAboveLine

 IDimStyle Class Overview

double GetExtensionAboveLine()	(for C/C++ only)

void SetExtensionAboveLine(double)	(for C/C++ only)

double ExtensionAboveLine	(for VB only)

This gets/sets the ExtensionAboveLine dimension style setting.  For more information see the Vdraft on-line documentation.


IDimStyle::OffsetFromFeature()
IDimStyle::OffsetFromFeature

 IDimStyle Class Overview

double GetOffsetFromFeature()	(for C/C++ only)

void SetOffsetFromFeature(double)	(for C/C++ only)

double OffsetFromFeature	(for VB only)

This gets/sets the OffsetFromFeature dimension style setting.  For more information see the Vdraft on-line documentation.


IDimStyle::Extension1Visibility()
IDimStyle::Extension1Visibility

IDimStyle::Extension2Visibility

 IDimStyle Class Overview

BOOL GetExtension1Visibility()	(for C/C++ only)

void SetExtension1Visibility(BOOL)	(for C/C++ only)

BOOL Extension1Visibility	(for VB only)

This gets/sets the Extension 1 or 2 Visibility dimension style setting.  For more information see the Vdraft on-line documentation.


IDimStyle::CenterMarkSize()
IDimStyle::CenterMarkSize

 IDimStyle Class Overview

double GetCenterMarkSize()	(for C/C++ only)

void SetCenterMarkSize(double)	(for C/C++ only)

double CenterMarkSize	(for VB only)

This gets/sets the CenterMarkSize dimension style setting.  For more information see the Vdraft on-line documentation.


IDimStyle::ExtensionColor()
IDimStyle::ExtensionColor

 IDimStyle Class Overview

IColor GetExtensionColor()	(for C/C++ only)

void SetExtensionColor(IColor)	(for C/C++ only)

IColor ExtensionColor	(for VB only)

This gets/sets the EntensionColor dimension style setting.  For more information see the Vdraft on-line documentation.


IDimStyle::CreateCenterLines()
IDimStyle::CreateCenterLines

 IDimStyle Class Overview

BOOL GetCreateCenterLines()	(for C/C++ only)

void SetCreateCenterLines(BOOL)	(for C/C++ only)

BOOL CreateCenterLines	(for VB only)

This gets/sets the CreateCenterLines dimension style setting.  For more information see the Vdraft on-line documentation.


IDimStyle::ForceInteriorLines()
IDimStyle::ForceInteriorLines

 IDimStyle Class Overview

BOOL GetForceInteriorLines()	(for C/C++ only)

void SetForceInteriorLines(BOOL)	(for C/C++ only)

BOOL ForceInteriorLines	(for VB only)

This gets/sets the ForceInteriorLines dimension style setting.  For more information see the Vdraft on-line documentation.


IDimStyle::BoxAroundText()
IDimStyle::BoxAroundText

 IDimStyle Class Overview

BOOL GetBoxAroundText()	(for C/C++ only)

void SetBoxAroundText(BOOL)	(for C/C++ only)

BOOL BoxAroundText	(for VB only)

This gets/sets the BoxAroundText dimension style setting.  For more information see the Vdraft on-line documentation.


IDimStyle::Scaling()
IDimStyle::Scaling

 IDimStyle Class Overview

double GetScaling()	(for C/C++ only)

void SetScaling(double)	(for C/C++ only)

double Scaling	(for VB only)

This gets/sets the Scaling value in a dimension style..  For more information see the Vdraft on-line documentation.


IDimStyle::BaselineIncrement()
IDimStyle::BaslineIncrement

 IDimStyle Class Overview

double GetBaselineIncrement()	(for C/C++ only)

void SetBaselineIncrement(double)	(for C/C++ only)

double BaselineIncrement	(for VB only)

This gets/sets the Baseline Increment dimension style setting.  For more information see the Vdraft on-line documentation.


IDimStyle::TextGap()
IDimStyle::TextGap

 IDimStyle Class Overview

double GetTextGap()	(for C/C++ only)

void SetTextGap(double)	(for C/C++ only)

double TextGap	(for VB only)

This gets/sets the Text Gap dimension style setting.  For more information see the Vdraft on-line documentation.


IDimStyle::ArrowSize()
IDimStyle::ArrowSize

 IDimStyle Class Overview

double GetArrowSize()	(for C/C++ only)

void SetArrowSize(double)	(for C/C++ only)

double ArrowSize	(for VB only)

This gets/sets the Arrow Size dimension style setting.  For more information see the Vdraft on-line documentation.


IDimStyle::DimensionLineColor()
IDimStyle::DimensionLineColor

 IDimStyle Class Overview

IColor GetDimensionLineColor()	(for C/C++ only)

void SetDimensionLineColor(IColor)	(for C/C++ only)

IColor DimensionLineColor	(for VB only)

This gets/sets the Dimension Line Color dimension style setting.  For more information see the Vdraft on-line documentation.


IDimStyle::Arrow1()
IDimStyle::Arrow1

IDimStyle::Arrow2

 IDimStyle Class Overview

 See Also

VARIANT Arrow1

VARIANT Arrow2

(arrow, dot, tick, block)


IDimStyle::TickExtension()
IDimStyle::TickExtension

 IDimStyle Class Overview

double GetTickExtension()	(for C/C++ only)

void SetTickExtension(double)	(for C/C++ only)

double TickExtension	(for VB only)

This gets/sets the TickExtension dimension style setting.  For more information see the Vdraft on-line documentation.


IDimStyle::TextHeight()
IDimStyle::TextHeight

 IDimStyle Class Overview

double GetTextHeight()	(for C/C++ only)

void SetTextHeight(double)	(for C/C++ only)

doubel TextHeightValue	(for VB only)

This gets/sets the Text Height dimension style setting.  For more information see the Vdraft on-line documentation.


IDimStyle::VerticalPosition()
IDimStyle::VerticalPosition

 IDimStyle Class Overview

double GetVerticalPosition()	(for C/C++ only)

void SetVerticalPosition(double)	(for C/C++ only)

double VerticalPosition	(for VB only)

This gets/sets the Vertical Position dimension style setting.  For more information see the Vdraft on-line documentation.


IDimStyle::Alignment()
IDimStyle::Alignment

 IDimStyle Class Overview

short GetAlignment()	(for C/C++ only)

void SetAlignment(short)	(for C/C++ only)

short Alignment	(for VB only)

This gets/sets the Alignment dimension style setting.  For more information see the Vdraft on-line documentation.


IDimStyle::Vertical()
IDimStyle::Vertical

 IDimStyle Class Overview

short GetVertical()	(for C/C++ only)

void SetVertical(short)	(for C/C++ only)

short Vertical	(for VB only)

This gets/sets the Vertical dimension style setting.  For more information see the Vdraft on-line documentation.


IDimStyle::Horizontal()
IDimStyle::Horizontal

 IDimStyle Class Overview

short GetHorizontal()	(for C/C++ only)

void SetHorizontal(short)	(for C/C++ only)

short Horizontal	(for VB only)

This gets/sets the Horizontal dimension style setting.  For more information see the Vdraft on-line documentation.


IDimStyle::TextColor()
IDimStyle::TextColor

 IDimStyle Class Overview

IColor GetTextColor()	(for C/C++ only)

void SetTextColor(IColor)	(for C/C++ only)

IColor TextColor	(for VB only)

This gets/sets the Text Color dimension style setting.  For more information see the Vdraft on-line documentation.


IDimStyle::ToleranceHeightScaling()
IDimStyle::ToleranceHeightScaling

 IDimStyle Class Overview

double GetToleranceHeightScaling()	(for C/C++ only)

void SetToleranceHeightScaling(double)	(for C/C++ only)

double ToleranceHeightScaling	(for VB only)

This gets/sets the Tolerance Height Scaling dimension style setting.  For more information see the Vdraft on-line documentation.


IDimStyle::RoundOff()
IDimStyle::RoundOff

 IDimStyle Class Overview

double GetRoundOff()	(for C/C++ only)

void SetRoundOff(double)	(for C/C++ only)

double RoundOff	(for VB only)

This gets/sets the Round Off dimension style setting.  For more information see the Vdraft on-line documentation.


IDimStyle::PreText()
IDimStyle::PreText

 IDimStyle Class Overview

BSTR GetPreText()	(for C/C++ only)

void SetPreText(BSTR)	(for C/C++ only)

BSTR PreText	(for VB only)

This gets/sets the PreText dimension style setting.  For more information see the Vdraft on-line documentation.


IDimStyle::PostText()
IDimStyle::PostText

 IDimStyle Class Overview

BSTR GetPostText()	(for C/C++ only)

void SetPostText(BSTR)	(for C/C++ only)

BSTR PostText	(for VB only)

This gets/sets the PostText dimension style setting.  For more information see the Vdraft on-line documentation.


IDimStyle::LengthScaling()
IDimStyle::LengthScaling

 IDimStyle Class Overview

double GetLengthScaling()	(for C/C++ only)

void SetLengthScaling(double))	(for C/C++ only)

LengthScaling(double)	(for VB only)

This gets/sets the Length Scaling dimension style setting.  For more information see the Vdraft on-line documentation.


IDimStyle::Tolerance()
IDimStyle::Tolerance

 IDimStyle Class Overview

short GetTolerance()	(for C/C++ only)

void SetTolerance(short)	(for C/C++ only)

short Tolerance	(for VB only)

This gets/sets the Tolerance dimension style setting.  For more information see the Vdraft on-line documentation.


IDimStyle::Upper()
IDimStyle::Upper

 IDimStyle Class Overview

double GetUpper()	(for C/C++ only)

void SetUpper(double)	(for C/C++ only)

double Upper	(for VB only)

This gets/sets the “Upper” dimension style setting.  For more information see the Vdraft on-line documentation.


IDimStyle::Lower()
IDimStyle::Lower

 IDimStyle Class Overview

double GetLower()	(for C/C++ only)

void SetLower(double)	(for C/C++ only)

double Lower	(for VB only)

This gets/sets the “Lower” dimension style setting.  For more information see the Vdraft on-line documentation.


IDimStyle::AlternateUnits()
IDimStyle::AlternateUnits

 IDimStyle Class Overview

BOOL GetAlternateUnits()	(for C/C++ only)

void SetAlternateUnits(BOOL)	(for C/C++ only)

BOOL AlternateUnits	(for VB only)

This gets/sets the Alternate Units dimension style setting.  For more information see the Vdraft on-line documentation.


IDimStyle::AlternatePrecision()
IDimStyle::AlternatePrecision

 IDimStyle Class Overview

short GetAlternatePrecision()	(for C/C++ only)

void SetAlternatePrecision(short)	(for C/C++ only)

short AlternatePrecision	(for VB only)

This gets/sets the Alternate Precision dimension style setting.  For more information see the Vdraft on-line documentation.


IDimStyle::AlternatePostText()
IDimStyle::AlternatePostText

 IDimStyle Class Overview

BSTR GetAlternatePostText()	(for C/C++ only)

void SetAlternatePostText(BSTR)	(for C/C++ only)

BSTR AlternatePostText	(for VB only)

This gets/sets the Alternate Post Text dimension style setting.  For more information see the Vdraft on-line documentation.


IDimStyle::AlternateScaling()
IDimStyle::AlternateScaling

 IDimStyle Class Overview

double GetAlternateScaling()	(for C/C++ only)

void SetAlternateScaling(double)	(for C/C++ only)

double AlternateScaling	(for VB only)

This gets/sets the Alternate Scaling dimension style setting.  For more information see the Vdraft on-line documentation.


IDimStyle::SeparateArrowHeads()
IDimStyle::SeparateArrowHeads

 IDimStyle Class Overview

BOOL GetSeparateArrowHeads	(for C/C++ only)

void SetSeparateArrowHeads(BOOL)	(for C/C++ only)

BOOL SeparateArrowHeads	(for VB only)


IDimStyle::ArrowsType()
IDimStyle::ArrowsType

 IDimStyle Class Overview

veCommonArrowsType GetArrowsType()	(for C/C++ only)

void SetArrowsType(veCommonArrowsType at)	(for C/C++ only)

veCommonArrowsType ArrowsType	(for VB only)

Read-Only.


IDimStyle::ArrowsBlock

 IDimStyle Class Overview

IBlock GetArrowsBlock()	(for C/C++ only)

void SetArrowsBlock(IBlock)	(for C/C++ only)

IBlock ArrowsBlock	(for VB only)


IDimStyle::Arrow1Block

IDimStyle::Arrow2Block

 IDimStyle Class Overview

IBlock GetArrow1Block()	(for C/C++ only)

IBlock GetArrow2Block()	(for C/C++ only)

void SetArrow1Block(IBlock ab)	(for C/C++ only)

void SetArrow2Block(IBlock ab)	(for C/C++ only)

IBlock Arrow1Block	(for VB only)

IBlock Arrow2Block	(for VB only)


IDimStyle::TextHeightValue

 IDimStyle Class Overview

double GetTextHeightValue()	(for C/C++ only)

void SetTextHeightValue(double th)	(for C/C++ only)

double TextHeightValue	(for VB only)


IDimStyle::TickSize

 IDimStyle Class Overview

double GetTickSize()	(for C/C++ only)

void SetTickSize(double)	(for C/C++ only)

double TickSize	(for VB only)


ITextStyles

(Interface Overview)

 See Also

C++ Class Constructors:

ITextStyles()

ITextStyles(LPDISPATCH pDispatch)

ITextStyles(const ITextStyles& dispatchSrc)

Text Styles are preset collections of parameters about text: font, font size, backwards or not, upside down or not, etc.  ITextStyles is a collection of all the text styles that exist in the drawing (ITextStyleobjects).

Properties:

Active	(read-only)

Application	(read-only)

Count	(read-only)

HasItem	(read-only)

Item	(read-only)

Parent	(read-only)

Methods:

Add

Dialog

Update


ITextStyle

(Interface Overview)

 See Also

C++ Class Constructors:

ITextStyle()

ITextStyle(LPDISPATCH pDispatch)

ITextStyle(const ITextStyle& dispatchSrc)

The ITextStyle class deals with Text Styles, styles that can be applied to a piece of text when it is being created.  All the characteristics that make up a text style are accounted for here, to be read or set as needed.

NOTE: Editing this will not update any existing text in the drawing; it will only affect new text that is entered after this style has been edited.  Existing text can be edited directly; see IText for details.

Properties: Application (read-only) Backwards BigFont Font Height LastHeight Name (read-only) ObliqueAngle Parent (read-only) UpsideDown XScaling


ITextStyle::Height()
ITextStyle::Height

TextStyle Class Overview

 See Also

double GetHeight()	(for C/C++ only)

void SetHeight(double)	(for C/C++ only)

Height(double)	(for VB only)

Returns or sets the height of text for the given text style.  The Height of text is always in terms of drawing units.


ITextStyle::LastHeight()
ITextStyle::LastHeight

TextStyle Class Overview

double GetLastHeight()	(for C/C++ only)

void SetLastHeight(double)	(for C/C++ only)

LastHeight(double)	(for VB only)

Gets or sets the last text height specified by the user.  This is also used as the “next height.”  Next text created with this style will default to this height.


ITextStyle::GetObliqueAngle()
ITextStyle::ObliqueAngle

TextStyle Class Overview

double GetObliqueAngle()	(for C/C++ only)

void SetObliqueAngle(double)	(for C/C++ only)

ObliqueAngle(double)	(for VB only)

This is the angle at which the text is to be slanted (or obliqued).  Angle is always specified in radians.

Visual Basic Code Sample:

Dim ObAng As Double

ObAng = Vdraft.ActiveDocument.TextStyles.Item(1).ObliqueAngle

ObAng = ObAng * 1.50

Vdraft.ActiveDocument.TextStyles.Item(1).ObliqueAngle = ObAng


ITextStyle::GetXScaling()
ITextStyle::XScaling

TextStyle Class Overview

double GetXScaling()	(for C/C++ only)

void SetXScaling(double)	(for C/C++ only)

XScaling(double)	(for VB only)

Retrieves or sets the X-Scaling of the text style.


ITextStyle::GetUpsideDown()
ITextStyle::UpsideDown

TextStyle Class Overview

BOOL GetUpsideDown()	(for C/C++ only)

void SetUpsideDown(BOOL)	(for C/C++ only)

UpsideDown(BOOL)	(for VB only)

Is the text to be drawn upside down or right-side up?


ITextStyle::GetBackwards()
ITextStyle::Backwards

TextStyle Class Overview

BOOL GetBackwards()	(for C/C++ only)

void SetBackwards(BOOL)	(for C/C++ only)

Backwards(BOOL)	(for VB only)

Is the text to be drawn backwards (mirror image) or forwards (normal)?


ITextStyle::Font()
ITextStyle::Font

TextStyle Class Overview

BSTR GetFont()	(for C/C++ only)

void SetFont(BSTR)	(for C/C++ only)

Font(BSTR)	(for VB only)

What font is to be used when drawing any text with this text style?  This would be the name of a given font file somewhere on disk.  Takes a path and file name to an .SHX.  Path does not need to be specified if the font is in the standard place.  Extension does not need to be specified at all.


ITextStyle::BigFont()
ITextStyle::BigFont

TextStyle Class Overview

BSTR GetBigFont()	(for C/C++ only)

void SetBigFont(BSTR)	(for C/C++ only)

BigFont(BSTR)	(for VB only)

Is this text style using a “Big Font” font file?  (Big Font is 16 bit character set, instead of a “normal” 8 bit ASCII character set.)


IUcses

(Interface Overview)

 See Also

C++ Class Constructors:

IUcses()

IUcses(LPDISPATCH pDispatch)

IUcses(const IUcses& dispatchSrc)

This is a collection of IUcs objects, that is, UCSes.  It is related to the UCS table in the current drawing.

Properties:

Active	(read-only)

Application	(read-only)

Count	(read-only)

HasItem	(read-only)

Item	(read-only)

PaperSpace	(read-only)

Parent	(read-only)

Methods:

Add

Dialog

Remove

Update


IUcses::PaperSpace

IUcs GetPaperSpace()	(for C/C++ only)

void SetPaperSpace(IUcs ps)	(for C/C++ only)

IUcs PaperSpace	(for VB only)

Removes the given entry from the UCS table.


IUcses::Remove()
IUcses::Remove

void Remove(IUcs entry)

Removes the given entry from the UCS table.

Visual Basic Code Sample:

Dim Vdraft, Ucs As Object

Set Vdraft = CreateObject(“Vdraft.Application”)

Set Ucs = Vdraft.ActiveDocument.Ucses.Add(“Sample”)	‘ create new Ucs

‘

‘   do whatever you like with the UCS

‘

Vdraft.ActiveDocument.Ucses.Remove Ucs	‘ get rid of the Ucs, done with it


IUcs

(Interface Overview)

API Overview

C++ Class Constructors:

IUcs()

IUcs(LPDISPATCH pDispatch)

IUcs(const IUcs& dispatchSrc)

This is the UCS object, it contains all the information that make up a particular UCS (user coordinate system).

Properties:

Application	(read-only)

Name	(read-only)

Origin

Parent	(read-only)

XAxis

YAxis


IUcs::Origin

 IUcs Class Overview

 See Also

IVector GetOrigin()	(for C/C++ only)

void SetOrigin(IVector)	(for C/C++ only)

Origin(IVector)	(for VB only)

This is the origin point for the UCS.  In itself it’s a vector object.

Visual Basic Code Sample:

Dim Vdraft, Ucs As Object

Set Vdraft = CreateObject(“Vdraft.Application”)

Set Ucs = Vdraft.ActiveDocument.Ucses.Add(“MyUcs”)

Print Ucs.Origin	‘ prints “0, 0, 0”

Ucs.Origin.Set 12, 3	‘ set origin point on Ucs

Print Ucs.Origin	‘ prints “12, 2, 0”


IUcs::Axis

 IUcs Class Overview

 See Also

IVector GetXAxis()	(for C/C++ only)

IVector GetYAxis()

void SetXAxis(IVector)

void SetYAxis(IVector)

XAxis	(for VB only)

YAxis()

These methods allow you to retrieve or to set the X and Y axes for the Ucs.  This sets the overall alignment for the UCS.  The Z axis is a consequence of how the X and Y axes are set, therefore the Z axis does not need to be explicitly set.

Returns an IVector object.


INamedViews

(Interface Overview)

 See Also

C++ Class Constructors:

INamedViews()

INamedViews(LPDISPATCH pDispatch)

INamedViews(const INamedViews& dispatchSrc)

INamedViews is a container of INamedView objects.  Also think of it as the NamedViews table in the drawing docuemnt.

Properties:

Application	(read-only)

Count	(read-only)

HasItem	(read-only)

Item	(read-only)

Parent	(read-only)

Methods:

Add

Dialog

Update

Remove


INamedViews::Remove()
INamedViews::Remove

 INamedViews Class Overview

void Remove(INamedView entry)

This allows you to remove a Named View entry from the NamedViews table.

Visual Basic Code Sample:

Dim Vdraft, NView As Object

Set Vdraft = CreateObject(“Vdraft.Application”)

Vdraft.ActiveDocument.NamedViews.Add(“MyView”)

‘

‘   do what you need with the view

‘

Vdraft.ActiveDocument.NamedViews.Remove(“MyView”)	‘ remove the view that was created


INamedView

(Interface Overview)

 See Also

C++ Class Constructors:

INamedView()

INamedView(LPDISPATCH pDispatch)

INamedView(const INamedView& dispatchSrc)

This is the collection of properties and methods that relate to a named view object within the given drawing.  A named view is a view that can be setup, used and referred to by its given name.  “Left_View”, “Birds_View”, etc.

NOTE: At this time Vdraft does not implement a perspective view.  The data will be carried forward in the file for compatibility reasons,  but will not be acted upon by Vdraft.

Properties:

Application	(read-only)

BackClip

Center

Direction

FrontClip

Height

InPaperSpace	(read-only)

LensLength

Name	(read-only)

Parent	(read-only)

Target

Twist

UseBackClip

UseFrontClip

Width


INamedView::Center()
INamedView::Center

 INamedView Class Overview

 See Also

IVector GetCenter()	(for C/C++ only)

void SetCenter(IVector)	(for C/C++ only)

Center (IVector)	(for VB only)

This is the center point for the view.  The XY coordinate of the center point.  It’s a vector object.


INamedView::Direction()
INamedView::Direction

 INamedView Class Overview

 See Also

IVector GetDirection()	(for C/C++ only)

void SetDirection(IVector)	(for C/C++ only)

Direction (IVector)	(for VB only)

Established the line of sight along which the view is plotted toward the target.  We are standing in one in what direction are we facing?  By using this along with Target we can answer this question completely.


INamedView::Target()
INamedView::Target

API Overview

 INamedView Class Overview

 See Also

IVector GetTarget()	(for C/C++ only)

void SetTarget(IVector)	(for C/C++ only)

Target(IVector)	(for VB only)

This is the point at which the view is actually directed.  We are standing in one place (i.e., the Center point of the view); in what direction are we facing?


INamedView::InPaperSpace

 INamedView Class Overview

BOOL GetInPaperSpace()	(for C/C++ only)

BOOL InPaperSpace()	(for VB only)

Read-Only.  Tells you whether the named view is a paperspace view or not.  If you are in paper space when the named view is created, then it will be a paperspace view, and vice-versa.


INamedView::Height()
INamedView::Height

 INamedView Class Overview

double GetHeight()	(for C/C++ only)

void SetHeight(double)	(for C/C++ only)

Height(double)	(for VB only)

This is the height of the current view area.  In drawing units.


INamedView::Width()
INamedView::Width

 INamedView Class Overview

double GetWidth()	(for C/C++ only)

void SetWidth(double)	(for C/C++ only)

Width(double)	(for VB only)

This is the width of the view area.  In drawing units.


INamedView::Twist()
INamedView::Twist

 INamedView Class Overview

double GetTwist()	(for C/C++ only)

void SetTwist(double)	(for C/C++ only)

Twist(double)	(for VB only)

Twist indicates the angle at which the view is oriented.


INamedView::LensLength()
INamedView::LensLength

 INamedView Class Overview

double GetLensLength()	(for C/C++ only)

void SetLensLength(double)	(for C/C++ only)

LensLength(double)	(for VB only)

This indicates the lens length being used in the camera model for this named view.  Uses a 50mm lens by default.


INamedView::FrontClip()
INamedView::FrontClip

 INamedView Class Overview

 See Also

double GetFrontClip()	(for C/C++ only)

void SetFrontClip(double)	(for C/C++ only)

FrontClip(double)	(for VB only)

This specifies the font clipping plane, in terms of distance from the target point.


INamedView::BackClip()
INamedView::BackClip

 INamedView Class Overview

 See Also

double GetBackClip()	(for C/C++ only)

void SetBackClip(double)	(for C/C++ only)

BackClip(double)	(for VB only)

This specifies the back clipping plane, in terms of distance from the target point


INamedView::UseFrontClip()
INamedView::UseFrontClip

 INamedView Class Overview

 See Also

BOOL GetUseFrontClip()	(for C/C++ only)

void SetUseFrontClip(BOOL)	(for C/C++ only)

UseFrontClip(BOOL)	(for VB only)

This indicates whether the front clipping plane is to be used or not in this named view.


INamedView::UseBackClip()
INamedView::UseBackClip

 INamedView Class Overview

 See Also

BOOL GetUseBackClip()	(for C/C++ only)

void SetUseBackClip(BOOL)	(for C/C++ only)

UseBackClip(BOOL)	(for VB only)

This indicates whether the back clipping plane will be used in this named view or not.


IColors

(Interface Overview)

C++ Class Constructors:

IColors()

IColors(LPDISPATCH pDispatch)

IColors(const IColors& dispatchSrc)

This is the colors table.  This table, or collection of objects, does not allow to add or delete items from it.  The color items in this collection are already set and can be changed.  The is an AutoCAD-compatible color selection.

Properties:

Active

Application	(read-only)

Count	(read-only)

Item	(read-only)

Parent	(read-only)

SameAsBlock	(read-only)

SameAsLayer	(read-only)

Methods:

Dialog


IColors::SameAsLayer()
IColors::SameAsLayer

 IColors Class Overview

IColor SameAsLayer	(for C/C++ only)

short Closest	(for VB only)

Read-Only.  Allows you to set an entity to “SameAsLayer” for its color

Behind the scenes, 'same as layer' is 256 & 'same as block' is 0, though colors(0) & colors(257)

will both give you 'same as block' so you can loop from 1 to IColors::Count.


IColors::SameAsBlock()
IColors::SameAsBlock

 IColors Class Overview

IColor SameAsLayer	(for C/C++ only)

short Closest	(for VB only)

Read-Only.  Allows you to set an entity to “SameAsBlock” for its color

Behind the scenes, 'same as layer' is 256 & 'same as block' is 0, though colors(0) & colors(257)

will both give you 'same as block' so you can loop from 1 to IColors::Count.


IColors::Closest()
IColors::Closest

 IColors Class Overview

short GetClosest()	(for C/C++ only)

short Closest	(for VB only)

Returns the index in the colors table of the color that most matches the given color.

This method is Not Implemented At This Time


IColor

(Interface Overview)

C++ Class Constructors:

IColor()

IColor(LPDISPATCH pDispatch)

IColor(const IColor& dispatchSrc)

This is a color object, a member of the Colors Table.  It specifies one of the possible colors that can used on any drawing entity in Vdraft.

Available Interfaces:

Application	(read-only)

Blue	(read-only)

Green	(read-only)

Name	(read-only)

Number	(read-only)

Parent	(read-only)

Red	(read-only)

The order and nature of the colors in the color table follows that of AutoCAD.  Colors 1 - 7 return the following names:

1	Red

2	Yellow

3	Green

4	Cyan

5	Blue

6	Magenta

7	White

Additionally:

0 	“Same as Block”

“Same as Layer”

Colors beyond 7 do not have meaningful names; they return simply their index values as their names.  That is, color index 24, if queried for its name, will return “24.”

The above color names can also be used to retrieve the desired color object from the IColors table, using the IColors.Item() method.  You can pass to Item the color’s name, like so:

Dim Kolor As Object

Set Kolor = Vdraft.ActiveDocument.Colors.Item(“RED”)


IColor::Number()
IColor::Number

 IColor Class Overview

short GetNumber()	(for C/C++ only)

short Number	(for VB only)

Returns the color object’s index in the IColors table


IColor::Red()
IColor::Red

 IColor Class Overview

double GetRed()	(for C/C++ only)

double Red	(for VB only)

Returns the Red value of the given color.


IColor::Green()
IColor::Green

 IColor Class Overview

double GetGreen()	(for C/C++ only)

double Green	(for VB only)

Returns the Green value of the given color.


IColor::Blue()
IColor::Blue

 IColor Class Overview

double GetBlue()	(for C/C++ only)

double Blue	(for VB only)

Returns the Blue value of the given color.


IViews

(Interface Overview)

 See Also

C++ Class Constructors:

IViews()

IViews(LPDISPATCH pDispatch)

IViews(const IViews& dispatchSrc)

This is the collection of all views in the drawing.  A View is the more general case of a view, relative to NamedViews and Viewports, etc.

Properties:

ActiveView

Application	(read-only)

Count

ExtentsMax	(read-only)

ExtentsMin	(read-only)

HasPaperSpace	(read-only)

InPaperPorts

InPaperSpace

Item	(read-only)

PaperspaceExtentsMax	(read-only)

PaperspaceExtentsMin	(read-only)

PaperSpace	(read-only)

Parent	(read-only)

Methods:

Add

Remove


IViews::ExtentsMin()/Max()
IViews::ExtentsMin

IViews::ExtentsMax

 IViews Class Overview

IVector GetExtentsMin()	(for C/C++ only)

void SetExtentsMin(IVector)	(for C/C++ only)

IVector ExtentsMin()	(for VB only)

Same for:

ExtentsMax()


IViews::PaperSpaceExtentsMin()/Max()
IViews::PaperSpaceExtentsMin

IViews::PaperSpaceExtentsMax

 IViews Class Overview

IVector GetPaperspaceExtentsMin()	(for C/C++ only)

void SetPaperspaceExtentsMin(IVector)	(for C/C++ only)

IVector PaperspaceExtentsMin()	(for VB only)

Same for:

IVector PaperspaceExtentsMax()

Get and Set the extents of the given paper space view port.


IViews::Count()
IViews::Count

 IViews Class Overview

long Count()	(read-only)

The number of entries in the Views table.  This is the number of views in the current mode: paperspace or modelspace.  That is, if the drawing is currently set for modelspace and there are two views active in model space, then Count will return 2.  If you then switch to paperspace and ther is only one view currently active for paper space, then count will return 1.

Visual Basic Code Sample:

Dim Vdraft As Object

Set Vdraft = CreateObject(“Vdraft.Application”)

NumViews% = Vdraft.ActiveDocument.Views.Count


IViews::HasPaperSpace()
IViews::HasPaperSpace

 IViews Class Overview

 See Also

BOOL GetHasPaperSpace()	(for C/C++ only)

BOOL HasPaperSpace()	(for VB only)

Does this drawing have paperspace in it?  The drawing might or might have a paperspace view currently defined.


IViews::InPaperPorts

 IViews Class Overview

 See Also

BOOL GetInPaperPorts()	(for C/C++ only)

void SetInPaperPorts(BOOL)	(for C/C++ only)

BOOL InPaperPorts()	(for VB only)

This is a boolean property that works with IViews::InPaperSpace.  It switches in & out of paperports.


IViews::InPaperSpace()
IViews::InPaperSpace

 IViews Class Overview

 See Also

BOOL GetInPaperSpace()	(for C/C++ only)

void SetInPaperSpace(BOOL)	(for C/C++ only)

void InPaperSpace(BOOL)	(for VB only)

Is the current mode of the drawing paperspace or modelspace.


IViews::ActiveView()
IViews::ActiveView

 IViews Class Overview

IView GetActiveView()	(for C/C++ only)

void SetActiveView(IView view)	(for C/C++ only)

void ActiveView(IView view)	(for VB only)

Returns the IView obejct that is the currently active view for the drawing.

See Also:

IView


IViews::PaperSpace()
IViews::PaperSpace

 IViews Class Overview

 See Also

IView GetPaperSpace()	(for C/C++ only)

void SetPaperSpace(IView)	(for C/C++ only)

IView PaperSpace	(for VB only)


IViews::Item()
IViews::Item

 IViews Class Overview

 See Also

IView GetItem(long index)

This allows you retieve a particular view from the views table.  It is important to keep in mind that only the views relating to the current drawing mode (paperspace or modelspace) will be available.  To retrieve the views for the other mode, you will need to switch to the other mode.


IViews::Add()
IViews::Add

 IViews Class Overview

 See Also

IView Add(IVector corner1, IVector corner2)

Add a new view to the Views table.  Currently this only works with paperspace, not with modelspace.  Corner1 is the upper-left corner of the rectangle for the viewport and corner2 is the lower-right corner.


IViews::Remove()
IViews::Remove

 IViews Class Overview

 See Also

void Remove(IView entry)

Remove the specified view from the Views table.  This currently only works with paperspace, not with modelspace views.

NOTE: It is possible to remove all the views from paperspace, leaving you with what looks like no drawing.  In fact, the drawing is still there, you simply no longer have a paperspace view of it.


IView

(Interface Overview)

 See Also

C++ Class Constructors:

IView()

IView(LPDISPATCH pDispatch)

IView(const IView& dispatchSrc)

An IView is a view of the geometry.  It represents an active view into the drawing, as opposed to a INamedView which can be a defined but not active view.

Properties:

AngleSnap	(read-only)

Application	(read-only)

BackClip

Center

Direction

Entity	(read-only)

FrontClip

GridSnap	(read-only)

Height

LensLength

LowerLeft	(read-only)

Parent	(read-only)

Target

Twist

UpperRight	(read-only)

UseBackClip

UseFrontClip

Width

Methods:

CenterPostRotate

CenterPreRotate

Extents

PanWindow

PostRotate

PostScale

PostTranslate

PreRotate

PreScale

PreTranslate

Redraw

Regen

TranslatePoint

Update

View

ViewPoint

ZoomFactor

ZoomWindow


IView::Center()
IView::Center

 IView Class Overview

IVector GetCenter()	(for C/C++ only)

void SetCenter(IVector vec)	(for C/C++ only)

Center(IVector vec)	(for VB only)

This is the center point of the view.


IView::Direction()
IView::Direction

 IView Class Overview

IVector GetDirection()	(for C/C++ only)

void SetDirection(IVector)	(for C/C++ only)

Direction(IVector vec)	(for VB only)

This is the direction vector of the view, relative to the camera point.  It establishes the direction of view


IView::Entity

 IView Class Overview

IViewport GetEntity()	(for C/C++ only)

IViewport Entity	(for VB only)

Read-only.  Returns the associated viewport entity if it is a paperspace viewport.


IView::Target()
IView::Target

 IView Class Overview

IVector GetTarget()	(for C/C++ only)

void SetTarget(IVector vec)	(for C/C++ only)

Target(IVector vec)	(for VB only)

This identifies the target point for the camera model


IView::Height()
IView::Height

 IView Class Overview

double GetHeight()	(for C/C++ only)

void SetHeight(double)	(for C/C++ only)

SetHeight(double)	(for VB only)

This is the height of the view window.


IView::Width()
IView::Width

 IView Class Overview

double GetWidth()	(for C/C++ only)

void SetWidth(double)	(for C/C++ only)

Width(double)	(for VB only)

This is the width of the view window.


IView::Twist()
IView::Twist

 IView Class Overview

double GetTwist()	(for C/C++ only)

void SetTwist(double)	(for C/C++ only)

Twist(double)	(for VB only)

This specified the angle of the twist of the camera from plumb.  Units are specified in radians.


IView::LensLength()
IView::LensLength

 IView Class Overview

double GetLensLength()	(for C/C++ only)

void SetLensLength(double)	(for C/C++ only)

LensLength(double)	(for VB only)

The length of the lens used in the camera model for this view.


IView::FrontClip()
IView::FrontClip

 IView Class Overview

 See Also

double GetFrontClip()	(for C/C++ only)

void SetFrontClip(double)	(for C/C++ only)

FrontClip(double)	(for VB only)

This is the distance of the front clipping plane from the target point.  Distance in drawing units.


IView::BackClip()
IView::BackClip

 IView Class Overview

 See Also

double GetBackClip()	(for C/C++ only)

void SetBackClip(double)	(for C/C++ only)

BackClip(double)	(for VB only)

Distance of the back clipping plane from the target point.  Distance in drawing units.


IView::UseFrontClip()
IView::UseFrontClip

 IView Class Overview

 See Also

BOOL GetUseFrontClip()	(for C/C++ only)

void SetUseFrontClip(BOOL)	(for C/C++ only)

UseFrontClip(BOOL)	(for VB only)

Is the front clippng plane being used or not?


IView::UseBackClip()
IView::UseBackClip

 IView Class Overview

 See Also

BOOL GetUseBackClip()	(for C/C++ only)

void SetUseBackClip(BOOL)	(for C/C++ only)

UseBackClip(BOOL)	(for VB only)

Is the back clipping plane being used or not?


IView::UpperRight()
IView::UpperRight

IView::LowerLeft

 IView Class Overview

IVector GetUpperRight()	(for C/C++ only)

IVector GetLowerLeft()	(for C/C++ only)

IVector UpperRight	(for VB only)

IVector LowerLeft

Read-Only.  This returns or sets the extents of the view, via the UpperRight corner or the LowerLeft corner.


IView::GridSnap()
IView::GridSnap

 IView Class Overview

IGridSnap GetGridSnap()	(for C/C++ only)

IGridSnap GridSnap	(for VB only)

Is grid snap on or not for this view.


IView::AngleSnap()
IView::AngleSnap

 IView Class Overview

IAngleSnap GetAngleSnap()	(for C/C++ only)

IAngleSnap SetAngleSnap()	(for C/C++ only)

IAngleSnap AngleSnap	(for VB only)

Is angle snap on or off for this view.  Retrieve the value or set it here.


IView::TranslatePoint()
IView::TranslatePoint

 IView Class Overview

IVector TranslatePoint(IVector point)

Takes a point and converts it for the view based on the normal for that view.


IView::Redraw()
IView::Redraw

 IView Class Overview

 See Also

void Redraw()

Causes the view to redraw itself.


IView::Regen()
IView::Regen

 IView Class Overview

void Regen()

Causes the view to regenerate itself.  This is a longer process than Redraw.


IView::Extents()
IView::Extents

 IView Class Overview

void Extents()

Zoom extents for that view.


IView::View()
IView::View

 IView Class Overview

void View(INamedView namedView)

Sets the View to the NamedView.  A named view is a previously saved view, a possible view.  A View is an actual active view currently being shown on the drawing.


IView::ViewPoint()
IView::ViewPoint

 IView Class Overview

void ViewPoint(IVector vpoint)

Same as the Vdraft Viewpoint command.  Sets the viewpoint into the model.


IView::ZoomWindow()
IView::ZoomWindow

 IView Class Overview

void ZoomWindow(IVector corner1, IVector corner2)

Zoom the view to the window defined by the two corners passed in as parameters.


IView::PanWindow()
IView::PanWindow

 IView Class Overview

void PanWindow(IVector point1, IVector point2)


IView::ZoomFactor()
IView::ZoomFactor

 IView Class Overview

void ZoomFactor(double factor)


IView::PreTranslate()
IView::PreTranslate

 IView Class Overview

void PreTranslate(IVector offset)

This allows you to add a translation to the given entity before all other transformations that are currently applied to it.


IView::PostTranslate()
IView::PostTranslate

 IView Class Overview

void PostTranslate(IVector offset)

This allows you to add a translation to the given entity after, or in addition to, all other transformations that are currently applied to it.


IView::PreScale()
IView::PreScale

 IView Class Overview

void PreScale(IVector scale)

This allows you to add a scaling transformation to the given entity before all other transformations that are currently applied to it.


IView::PostScale()
IView::PostScale

 IView Class Overview

void PostScale(IVector scale)

This allows you to add a scaling transformation to the given entity after, or in addition to, all other transformations that are currently applied to it.


IView::PreRotate()
IView::PreRotate

 IView Class Overview

void PreRotate(double xangle, double yangle, double zangle)

This allows you to add a rotation to the given entity before all other transformations that are currently applied to it.


IView::PostRotate()
IView::PostRotate

 IView Class Overview

void PostRotate(double xangle, double yangle, double zangle)

This allows you to add a rotation to the given entity after, or in addition to, all other transformations that are currently applied to it.


IView::CenterPreRotate()
IView::CenterPreRotate

 IView Class Overview

void CenterPreRotate(double xangle, double yangle, double zangle)

This allows you to add a center rotation to the given entity before all other transformations that are currently applied to it.


IView::CenterPostRotate()
IView::CenterPostRotate

 IView Class Overview

void CenterPostRotate(double xangle, double yangle, double zangle)

This allows you to add a center rotation to the given entity after, or in addition to, all other transformations that are currently applied to it.


IView::Update

 IView Class Overview

void Update()

Allows the view to update itself immediately.  This would happen automatically whenever the object variable goes out of scope.  See All Tables::Update for a code example illustrating this.


Sample Code - Visual Basic
Visual Basic Code Samples

 See Also

There are fragments of sample code scattered all through this document.  The following are some code fragments that offer more pith than the usual example.  You may find these useful.

Of course, all the usual liability and “your mileage may vary” legal statements apply to these.  (You know what they are; we don’t need to elaborate.)  You are free to use these code samples any way you choose; but we don’t guarantee that they will work for your need.

The Vdraft package ships with sample applications with full source code.  For Visual Basic, look under

\Vdraft\Programs\VB\

Attribs	<- blocks and block attributes

DrawX	<- line drawing example

Linetype	<- create line types

List	<- list entities in a selection set

NewDwg	<- new drawing wizard

Zoomer	< drawing zoom applet

Aside from these complete examples, this document contains a number of code fragments scattered all about, as examples of the various individual APIs, plus the following examples:

 Essentials of Working with Vdraft

 Starting Vdraft

 Listing All Active Drawings in Vdraft


Sample Code - Starting Vdraft
Visual Basic Sample Code

Starting Vdraft

This sample shows how to start up Vdraft correctly from Visual Basic and also how to recover should Vdraft not be started by the CreateObject() call.  This might happen for any number of reasons (usually because the system could not locate Vdraft.exe).  This code will offer the user the option of continuing with the application without Vdraft’s presence.  This may or may not make sense depending on your app.

'

'   Open the communication channels to Vdraft

    Dim Vdraft As Object	‘ object handle to the Vdraft application

    Dim Docs As Object	‘ object handle to the Documents collection

    On Error GoTo Form_Load_Err1	‘ in case the CreateObject() fails

    Set Vdraft = CreateObject("Vdraft.Application")	‘ get a channel to Vdraft

    Set Docs = Vdraft.Documents	‘ successful: get the documents collection

    GoTo Form_Load_Continue	‘ continue around the error trap code

Form_Load_Err1:	‘ error with createobject()

    Dim Msg$	‘ user error message

    Msg$ = "Unable to get a connection to Vdraft"

    Msg$ = Msg$ & CRLF & CRLF & "'" & Err.Description

    Msg$ = Msg$ & "'" & CRLF & CRLF & "Continue without Vdraft?"

    If MsgBox(Msg$, 52, AppName$ & " -- Error!") = 7 Then

End	‘ quit

    End if

 ‘  what ever processing might be needed for your application.  Set flags, etc.,

‘  to show that Vdraft is not available.

On Error GoTo 0	‘ cancel the error trap

    Resume Form_Load_Continue

Form_Load_Continue:	‘ continue the form load process

'

'   continue on with what ever other startup code is needed…

‘


Sample Code - VB Essentials
Visual Basic Sample Code

The Essentials of Working with Vdraft

 See Also

Accessing Vdraft using ActiveX Automation from Visual Basic is very simple.  The syntax looks like normal Visual Basic syntax with methods (functions and procedures) and properties being referenced off of existing objects.

The first step is to use CreateObject to get the Vdraft application object.  From there you use the dot (".") syntax to access methods and properties as in the following example which prints out the name of the current layer in the current drawing.

Dim Vdraft, Drawing, Layers, ActiveLayer as Object

Set Vdraft = CreateObject(“Vdraft.Application”)

Set Drawing = Vdraft.ActiveDocument

Set Layers = Drawing.Layers

Set ActiveLayer = Layers.Active

Print ActiveLayer

…

NOTE: The above code is equivalent to the following code.  They are identical.  Visual Basic allows you to be somewhat cavalier with ActiveX Automation, if you wish.  The above code might be easier to read depending on your overall application.  The code below is considerably smaller.  Both work fine.

Dim Vdraft as Object

Set Vdraft = CreateObject(“Vdraft.Application”)

Print Vdraft.ActiveDocument.Layers.Active

Alternatively, especially from Visual Basic, you may wish to make use of the Vdraft OCX.  This also allows you to receive notification of certain events.  For Visual Basic, the OCX is the only way to receive such notifications.  See Vdraft OCX for more information


Sample Code - Listing All Active Drawings
Visual Basic Sample Code

Listing All Active Drawings

 See Also

The following code is a working sample snipped out of an actual VB application written for Vdraft.  It polls Vdraft for all the currently active (i.e., opened) drawings and lists them in a VB list box.

ActiveDrawingsList	is a list box used for holding and display all the active drawings

‘   Initialize

Dim I%, j%

Dim Vdraft, Docs, Dok As Object

Set Vdraft = CreateObject(“Vdraft.Application)

Set Docs = Vdraft.Documents

‘   Now fill in the list box

With MainForm.ActiveDrawingsList

        .Clear

    '   get all the current drawings from Vdraft

        If (Not Docs Is Nothing) Then

            i% = Docs.Count

            For j% = 1 To i%

                Set Dok = Docs.Item(j%)

                .AddItem Dok.Name

            Next

        End If

End With


PlugIn Exports

cVdraftEvent


PlugIn Exports

OCX Events

cVdraftEvent


OCX Events

cVdraftEvent


C/C++ Sample Code

VB Sample Code


VB Sample Code

C/C++ Sample Code


VB Sample Code


C/C++ Sample Code


C/C++ Sample Code

Defined Symbols for VB


VB Sample Code

C/C++ Sample Code


VB Sample Code

C/C++ Sample Code


Application

Object Hierarchy Chart


Parent


C/C++ Sample: Open Vdraft and Start a New Drawing


IDocuments

IDocument


IVdraft::Visible


IMatrix


IVector

IVdraft::NewMatrix


Code Samples Under IVdraft::Name


ActiveDocument

IDocuments Class Overview


C/C++ Sample: Open Vdraft and Start a New Drawing


IDocuments::New


IDocuments::Add


IDocument::Close


IVdraft::ActiveDocument

Sample VB Code: List All Active Drawings


IDocument::Name

IDocument::Save

IDocument::SaveAs

IDocument::Close


IDocument::FullName

IDocument::Save

IDocument::SaveAs

IDocument::Close


IDocument::FullName

IDocument::Name


IDocument::Save

IDocument::SaveAs


IEntitySnap


PlugIns

The Vevents OCX


IUnits


IEntities


ILayers

ILayer


ILineTypes

ILineType


IBlocks

IBlock


IDimStyles

IDimStyle


ITextStyles

ITextStyle


IUcses

IUcs


INamedViews

INamedView


IViews

IView


ICommands


IColors

IColor


IEntitySet


IDocument::StatusBar


IApplicationIDs

IXdata


IDocument::PrintPreview

IDocument::PrintSetup

cVariant


IDocument::PrintPreviewClose

IDocument::PrintSetup


IDocument::PrintPreview


IDocument::PrintPreview


IDocument::SaveAs


IDocument::Save


IVdraft::Quit()

IDocuments::Close


IHeader::Handles

IXData::Handle

All Entities::Handle


IColor


ILayer


ILineType


IVector


Regen

Update


Redraw

Update


Regen

Redraw


IUcs


XData

IApplicationIDs


HasXData

IApplicationIDs


IVectors


I2DVertex

IVertex

IFaceVertices

IFaceVertex


IFaceVertex

IVertex

I2DVertex

IVertices


IFace

IFaceVertices

IVertex

IPolyface


IFaceVertices

I2DVertex


I2DVertex

I3DPolyline

IPolymesh

IPolyface


I2DVertex

IPolymesh

IPolyface


vePolylineCurve


vePolylineCurve

I2DPolyline

IPolymesh

IPolyface

IVertex


IVertices

IVertex


vePolylineCurve


vePolylineCurve

IPolyface

I2DPolyline

I3DPolyline

IVertices


IVertices


IFaceVertices

IVertex


IVertices

IVertex


I2DPolyline


IVector


I2DVertex::StartWidth


I2DVertex::StartWidth


IDocument::Selection()

IEntitySet


IMatrix


IVector::LengthSquared


IVector::Length


cVariant Helper Class


IVector


ISelection


IApplicationIDs


IApplicationIDs


IBlock


IBlock


IVertex


IVertices

I2DPolyline

I2DVertex

I3DPolyline


IVdraft::NewMatrix

IVdraft::NewVector

IVector


Add


All Entities – Name

All Tables – Item


All Tables – Item


Enums - Angular Settings

IUnits::Linear


IUnits::Angular


IUnits::AngleBase


IUnits::Angular


IUnits::StringToCoordinate


IUnits::PointToString


IUnits::CoordinateToString


IUnits::AngleToString


IUnits::Linear

IUnits::LinearDigits


IUnits::StringToAngle

IUnits::Angular

IUnits::AngularDigits


Sample code for Undo-ing commands in the above listbox


Sample VB Code at ICommands::Count


Custom Mouse Menus


IXData


IXData


ILayer


ILayers


IColors


ILineTypes

ILineType


ILinetype


ILinetypes


IBlock


ISelection


cVariant


IBlocks


IVector


IDimStyles


eaDimStyleArrow


ITextStyle


ITextStyles

IText


IUnits


IUcs


IVector


IVector


INamedView


INamedViews


IVector


IVector

INamedView::Target


IVector

INamedView::Direction


INamedView::UseFrontClip


INamedView::UseBackClip


INamedView::FrontClip


INamedView::BackClip


IView


IViews::InPaperSpace

IViews::InPaperports

IViews::PaperSpace


IViews::InPaperSpace

IViews::HasPaperSpace

IViews::PaperSpace


IViews::HasPaperSpace

IViews::InPaperports

IViews::PaperSpace


IViews::HasPaperSpace

IViews::InPaperports

IViews::InPaperSpace


IView

IViews


IView

IViews::PaperSpace


IView

IViews


IViews


IView::UseFrontClip


IView::UseBackClip


IView::FrontClip


IView::BackClip


IView::Regen


Development Tools

Vdraft PlugIns


Sample C/C++ Code

IEntities

IVdraft


C/C++ Sample Code

IColors

IColor


VB Version of the Defined Symbols


veXDataType

IXData


ISelectionEvents::RequestSelect()


        Start Here !!

Welcome to Vdraft’s Developer’s On-Line Reference.

Creating custom extensions to Vdraft is easy.  If you are already familiar with either Visual Basic or C++  then there is really not too much more that you need to know.  Just run through these first few help pages to familiarize yourself with the basics, including how this help file is organized and then you will be on your way.

 Using VB with Vdraft

 Using C++ with Vdraft

Using This Help File

First thing is to note the buttons accross the top of the help window.
API	Clicking on this button will take you directly to the API overview page, from which you can select any of the interfaces (groupings of methods and properties that relate to a particular object with in Vdraft, such as the layers table or particular drawing entities).
SYMBOLS	This button takes you to a listing of the various ENUMS, or Symbol Definitions that are used with some of the methods and properties in Vdraft.  There’s a version for both C++ and for VB.
OBJECTS	This button takes you to a help page that lays out the various object interfaces in relationship to each other.  Similar to a class hierarhcy chart in C++, it shows the heirarchical relationship among the interfaces.  For instance, the obtain an interface to a layer, you can use this chart to trace the objects you need to get there: IVdraft -> IDocuments -> IDocument -> ILayers -> ILayer.

This help file has several sections to it and includes a lot of information.  We have tried to make it easy to use.  The major sections are these:

Start Here !!

This section.  It’s a quick introduction to creating extensions for Vdraft, an overview of this document and how to use it and some basic definitions and concepts.

Overview

A detailed overview of the customizing Vdraft, what all the options are and some of the approaches one might take.  It covers many of the important concepts needed for working with Vdraft.  It also covers some nifty tips and techniques that you can apply in your work.  This is an important section to look through.

API Reference

This is the nitty gritty core of it all.  This section covers all the Vdraft objects, their interfaces and the methods and properties belonging to each interface.  Many of these include short code fragments in either C++, VB or both.

Sample Code (for C++ and for VB)

This section includes some specific samples of VB and C++ code for accomplishing certain purposes.  In addition to these code samples, there are code fragments scattered all about the API Reference section and there are also complete working applications included with Vdraft.  You will find these samples in the directory  \Vdraft\Programs\CPP, \Vdraft\Programs\VB and \Vdraft\Programs\Excel.


    Using VB

Calling Vdraft from Visual Basic is extremely easy.  Everything in VB is an object, one way or another.  Forms, buttons, lines, circles, grid controls, pictures, etc.  Vdraft is basically just one more object – a very large object made up of a lot a of other objects.

Don’t get intimidated by Windows, OLE, ActiveX or Automation.  These can be complex topics to understand, but just using them is simplicity itself.

 The first step from Visual Basic is always to get a connection to Vdraft from your application.  This can be done when your application first starts up and kept throughout the life of your app, or it can be obtained at any time, released at any time and obtained again as needed.  This can be accomplished as shown here:

Dim Vdraft As Object

Set Vdraft = CreateObject("Vdraft.Application")

 This gives you an object which has the methods and properties listed under IVdraft.  It behaves just like any other object with methods and properties under VB.

 Properties and methods can be accessed using the “dot” syntax.  For example,

Set doc = Vdraft.ActiveDocument

This gives you an object with the methods and properties listed under IDocument.

 You declare Vdraft object variables As Object.  Use the Set syntax to set the variable.

Dim doc As Object

Set doc = Vdraft.ActiveDocument

 In some cases an alternate name is listed when there is a naming conflict with Visual Basic keywords, e.g. Closeout instead of Close in the IDocuments interface.  These are noted throughout the API reference; often you will see a version of a method or property listed for C++ and another listed for Visual Basic.

 Parameters listed as VARIANT are equivalent to VB’s Variant data type.  This means several different types may be valid.  For example, Item() in the IDocuments interface can accept either an index or a file name.

 Parameters listed as BSTR are normal Visual Basic strings.  (It stands for Basic String.)

 Parameters listed in square brackets are optional.  The following are all valid:

Set vec = Vdraft.NewVector(1,2,3)

Set vec = Vdraft.NewVector(1,2)

Set vec = Vdraft.NewVector

 If you don't explicitly list a property or method for an interface, the default (if any)will be used.  The following pairs of lines are equivalent:

Print Vdraft.Name

Print Vdraft

Set entity = Entities.Item(1)

Set entity = Entities(1)


    Using C++

Working with Vdraft from C++ is quite simple.  Using the tools provided you can access Vdraft as if it was just another collection of objects in your project.

Don’t get intimidated by Windows, OLE, ActiveX or Automation.  These can be complex topics to fully understand, but just using them is simple.  We have provided for you a CPP file and some header files that take away most of the complexity, awe and mystery of dealing with ActiveX Automation.  By adding Vdraft.Cpp to your project, you can then deal with Vdraft as it was just another set of classes: objects you create, call member methods and properties of, and so on.

 You start a conversation with the following lines:

#include "Vdraft.h"

IVdraft Vdraft;

Vdraft.CreateDispatch("Vdraft.Application", NULL);

 Methods are accessed using standard C++ syntax.

Vdraft.Quit();

 You can retrieve properties by prefixing the name with Get and set them by prefixing with Set.

IDocument doc( Vdraft.GetActiveDocument() );

vector.Setx(5);

 The return value of one function can be passed to the constructor of the appropriate class.

IVector vector( line.GetStartPoint() );

 Parameters listed as VARIANT can often be different data types.  Vutil.h defines cVariant, which can be used to conveniently pass VARIANT parameters.

IVector veq (Vdraft.NewVector(cVariant(1), cVariant(2), cVariant(3)));

 Parameters listed as BSTR are strings – of a special type.  If you are using MFC, you may simply pass a CString and not worry about it.  Otherwise, you can use the SysAllocString() function and its relatives to create BSTR’s suitable for passing across Automation.

 Parameters listed in square brackets are a special type of VARIANT where you don't need to specify a value.  Note that you still need to pass the parameter in C++.

IVector vector( Vdraft.NewVector(cVariant(1), cVariant(2), cVariant()) );	// z value empty

 Default properties and methods have no meaning in C++.

 Arrays are numbered starting at 1.  For example, when using Item() (which will accept an index as a parameter) with any of the tables the first entry is 1, not 0.