VD Framed Guide
VD Framed Guide
VD Framed Guide
This guide will help you add the new VectorDraw Developers Framework (VDF) version 6 vdFramedControl in
your Visual Studio 2005 projects and also show you some basic functionality of the vdFramedControl.
Click on the links below to see a "Getting started" guide, that is adding the vdFramedControl in a project and
creating a very simple project for the platform that you use :
● Visual C# 2005
The topics above contain information on how to add the VDF vdFramedControl to an empty Visual Studio
2005 project and also some steps to add to this project some basic functionality like open/save/new and
zoom.
You can also see some more complex examples on specific issues like (alphabetic order):
● ActionUtility
● Blocks
● CommandAction
● Dimensions
● DimStyles
● Globalization of Resources
● Grips
● Handle
● Hatches
● Images
● Layers
● Linetypes
● Osnaps
● Section Clipping
● Selections
● SupportPath
● TextStyles
See Also:
You can check the CADBasics.chm help file that is installed in your disk with our VDF setup
(in a folder like "C:\Program Files\VectorDraw\VectorDraw Developer Framework") to get a
general idea regarding CAD programs, and basic CAD terminology (like Line, Layer, Block,
Dimension etc)
You can also check our samples that are using the VectorDraw Developer Framework version
6 libraries that are compressed in a cab file (named vdfexamples.cab) and is installed with
our VDF setup in a folder like "C:\Program Files\VectorDraw\VectorDraw Developer
Framework\vdFramedControl Samples". These samples are available for C# and VB.NET
2005;
Below you can find some useful information and How-To regarding some basic objects and functionality of
the vdFramedControl
NOTE: In Windows Vista/Seven/Server2008 oper. systems and due to UAC make sure that you
ALWAYS run the VS2005/VS2008/VS2010 IDE with right-click and "Run as Administrator" option.
You can also use the VisualStudio 2008 or 2010 instead of VS2005 that is used in this guide.
The samples below without any major change can be made in VS2008 or VS2010 development
IDEs.
If you use VS2008 or VS2010: When you create a new project then in VS2008 C# do not check
"Client-only Framework subset" option. In VS2010 C# choose ".NET Framework 4" and not the
".NET Framework 4 Client Profile".
Product : Engine - vdFrammedControl, Version : 6
Getting Start Guide VDF vdFramedControl version 6
In order to add the VDF vdFramedControl in Visual C# 2005 the steps 1 to 5 must be followed:
1) Open the Visual C# 2005 IDE (see NOTE in 2nd page) and choose to create a new Windows project as "Windows Application"
2) Right click on the toolbox and in the menu that appears choose "Choose Items..."
3) You can add the vdFramedControl with 2 different ways:
A) In the "Choose Toolbox Items" scroll down to the "vdFramedControl" and check it.
- OR -
B 1)In the "Choose Toolbox Items" window and click "Browse..." button.
B 2) Go to the folder where the VectorDraw Developer Framework is installed (must be like "C:\Program
Files\VectorDraw\Common\") and click on (select) the vdFramedControl.dll and then click "Open" button.
4) You should see it checked in the "Choose Toolbox Items". Click the "OK" button.
5) The vdFramedControl component should be in the Toolbox.
6) Add it to the form and also 4 buttons that will do some simple functions like Open/Save a drawing, Create a new drawing and Zoom Extends.
7) Select the VDF references and in their properties set Copy Local to False and Specific Version to False too.
9) The code that is added to the buttons click is like below :.
In order to add the VDF vdFramedControl in Visual C++ 2005 the steps 1 to 5 must be followed:
1) Open the Visual C++ 2005 IDE (See NOTE in 2nd page) and choose to create a new Windows project as "Windows Forms Application"
2) Right click on the toolbox and in the menu that appears choose "Choose Items..."
A) In the "C hoose Toolbox Items" scroll down to the "vdFramedControl" and check it.
- OR -
B 1)In the "Choose Toolbox Items" window and click "Browse..." button.
B 2) Go to the folder where the VectorDraw Developer Framework is installed (must be like "C:\Program Files\VectorDraw\Common\6xxx") and click on (select)
the vdFramedControl.dll and then click "Open" button.
4) You should see it checked in the "Choose Toolbox Items". Clikc the "OK" button.
Note: you may also need to add this #include directive : #include <stdlib.h>
Product : Engine - vdFrammedControl, Version : 6
Getting Start Guide VDF vdFramedControl version 6
In order to add the VDF vdFramedControl in Visual Basic 2005 the steps 1 to 5 must be followed:
1) Open the Visual Basic 2005 IDE (See NOTE in 2nd page) and choose to create a new Windows project as "Windows Application"
2) Right click on the toolbox and in the menu that appears choose "Choose Items..."
A) In the "C hoose Toolbox Items" scroll down to the "vdFramedControl" and check it.
- OR -
B 1)In the "Choose Toolbox Items" window and click "Browse..." button.
B 2) Go to the folder where the VectorDraw Developer Framework is installed (must be like "C:\Program Files\VectorDraw\Common\6xxx") and click on (select)
the vdFramedControl.dll and then click "Open" button.
4) You should see it checked in the "Choose Toolbox Items". Clikc the "OK" button.
If you are a customer and not an evaluator then in order to be able to use the VDF libraries (like
vdFramedControl) and VectorDraw Professional 6.x Wrapper (vdraw.ocx) in your development platform you
should license/register it. This is done by using your Serial number of the version6 that is provided with the
purchase of the libraries and the vdAuthorizeApp.exe utility. You machine should be also connected to the
internet.
Run the vdAuthorizeApp.exe utility as administrator or as a user with administrative rights in your
Development machine and type your VDF serial (case sensitive) and click the "Authorize" button. Check the
"Result" window.
If you like to install and authorize the libraries in another machine like a presentation laptop PC then you
should Unauthorize your development machine and Authorize it again on the laptop. You cannot have
multiple machines authorized simultaneously with the same license. If you don't have access to the Internet
or you having troubles with this procedure then contact our sales department including the result you get.
The ActionUtility Object can be used in order to ask the user to input data in the application, like a point, a
rectangle, a distance etc.
For example if you like the user to input a point in the drawing the you can call a code like :
gPoint userpoint;
vdFC.BaseControl.ActiveDocument.Prompt("Select a Point:");
//The user can either click a point or type at the command line a point like
5,5,2
StatusCode ret =
vdFC.BaseControl.ActiveDocument.ActionUtility.getUserPoint(out userpoint);
vdFC.BaseControl.ActiveDocument.Prompt(null);
if (ret == StatusCode.Success){
MessageBox.Show("The user selected: x:" + userpoint.x.ToString() + " y:" +
userpoint.y.ToString() + " z:" + userpoint.z.ToString() + " In UCS(user
coordinate system)");
}
The above sample code can be changed so the user is asked for a second point and then create a rectangle
from these two points. Like :
vdFC.BaseControl.ActiveDocument.New();
gPoint userpoint;
vdFC.BaseControl.ActiveDocument.Prompt("Select a Point:");
//The user can either click a point or type at the command line a point like
5,5,2
StatusCode ret =
vdFC.BaseControl.ActiveDocument.ActionUtility.getUserPoint(out userpoint);
vdFC.BaseControl.ActiveDocument.Prompt(null);
if (ret == StatusCode.Success){
MessageBox.Show("The user selected: x:" + userpoint.x.ToString() + " y:"
+ userpoint.y.ToString() + " z:" + userpoint.z.ToString() + " In UCS(user
coordinate system)");
}
vdFC.BaseControl.ActiveDocument.Prompt("Other corner:");
//The user can either click a point or type at the command line a point like
5,5,2
object ret2 =
vdFC.BaseControl.ActiveDocument.ActionUtility.getUserRect(userpoint);
vdFC.BaseControl.ActiveDocument.Prompt(null);
Vector v = ret2 as Vector;
if (v != null) {
double angle = v.x;
double width = v.y;
double height = v.z;
//Calculate the point the user clicked.
//Use polar command to find the bottom right point moving width distance
from the initial point.
gPoint userpoint2 = userpoint.Polar(0.0, width);
//Use the polar again to go up height distance to find the upper right
point.
userpoint2 = userpoint2.Polar(VectorDraw.Geometry.Globals.HALF_PI,
height);
MessageBox.Show("The user selected 2nd point : x:" +
userpoint2.x.ToString() + " y:" + userpoint2.y.ToString() + " z:" +
userpoint2.z.ToString() + " In UCS(user coordinate system)");
vdFC.BaseControl.ActiveDocument.CommandAction.CmdRect(userpoint,
userpoint2);
}
For more detailed information about properties/methods/events etc of the above object(s), you can also
check our vdf.chm help file, topic(s): "Utility Class" and "ActionUtility Property".
Product : Engine - vdFrammedControl, Version : 6
Getting Start Guide VDF vdFramedControl version 6
A block is a collection of objects you can associate together to form a single object, or block definition. You can
insert, scale, and rotate a block in a drawing (this is called vdInsert). You can explode a block into its
component objects, modify them, and redefine the block definition. The use of Blocks streamline the drawing
process. For example, you can use blocks to build a standard library of frequently used symbols, components,
or standard parts.
You can insert the same block numerous times instead of re-creating the drawing elements each time. Revise
drawings efficiently by inserting, relocating, and copying blocks as components rather than individual
geometric objects. Save disk space by storing all references to the same block as one block definition in the
drawing database. When you insert a block in your drawing, you are creating a block instance. Each time you
insert a block instance, you assign a scale factor and rotation angle to the inserted block. You can also scale a
block instance using different values in any coordinate (X, Y, Z) direction. Blocks make it possible for you to
organize your drawing tasks in a systematic way, so that you can set up, redesign, and sort the objects in your
drawings and the information associated with them.
Below is a sample code that will add an new Block (vdBlock) object in the drawing named "CustomBlock" and
also an existing drawing (drawing is named vdblk.vdml) as "CustomBlock2" :
You can see the existing block in a drawing and also insert them using the InsertBlockDIalog:
vdFC.BaseControl.ActiveDocument.CommandAction.CmdInsert(form.blockname,
form.insertionPoint, form.scales, form.scales, form.rotationAngle);
else
{
double[] scales = form.scales as double[];
vdFC.BaseControl.ActiveDocument.CommandAction.CmdInsert(form.blockname,
form.insertionPoint, scales[0], scales[1], form.rotationAngle);
}
}
//The dialog can also be called using the CmdInsertBlockDialog command.
//vdFC.BaseControl.ActiveDocument.CommandAction.CmdInsertBlockDialog();
}
You can also insert the blocks created in AddBlockItems() using a code like :
vdFC.BaseControl.ActiveDocument.ActiveLayOut.Entities.AddItem(ins);
}
//Zoom extends and redraw to see the changes.
vdFC.BaseControl.ActiveDocument.ActiveLayOut.ZoomExtents();
vdFC.BaseControl.ActiveDocument.Redraw(true);
}
else MessageBox.Show("The custom block was not found");
}
For more detailed information about properties/methods/events etc of the above object(s), you can also check
our vdf.chm help file, topic(s): "vdBlock Class" and "vdBlocks Class".
Product : Engine - vdFrammedControl, Version : 6
Getting Start Guide VDF vdFramedControl version 6
Graphical objects in VectorDraw can have a specific pencolor. This color can be an RGB (Red Green Blue) value or a
specific color index from the VectorDraw pallete. The color of an object can also take some specific values that can
be "Color by Layer" or "Color by Block" where the object takes the color specified by the layer that is or the block.
Some object may be filled (like circles or polylines) and the fill color of these objects might be transparent (alpha
blending).
See the following code:
For more detailed information about properties/methods/events etc of the above object(s), you can also check our
vdf.chm help file, topic(s): "vdColor Class".
Product : Engine - vdFrammedControl, Version : 6
Getting Start Guide VDF vdFramedControl version 6
The CommandAction object offer to the developer a variety of tools in order to do some user specific
actions. For example developer may wants to offer to the end user the ability to add lines with points that
the user selects. In this case the only code that is required by the developer is to call cmdLine with "USER"
parameters, like:
vdFramedControl1.BaseControl.ActiveDocument.CommandAction.CmdLine(null);
//parameter null means that the user will pick the required point- distance
or everything that is required for the command.
There are also these commands that allow the user to add entities like CmdXLine, CmdRay, CmdPoint,
CmdArc, CmdCircle, CmdEllipse, CmdPolyLine, CmdText, CmdRect, CmdImage, CmdDim, CmdBox3d,
CmdSphere, CmdCone, Cmd3DMesh, Cmd3dFace and CmdPlineToMesh.
CommandAction has functionality to manipulate entities like copying, moving, deleting them etc. Like :
vdFramedControl1.BaseControl.ActiveDocument.CommandAction.CmdCopy(null, null,
null);
//This will prompt user to select entities and copy them from one point to
another
Developer can use : CmdRotate, CmdCopy, CmdErase, CmdMove, CmdExplode, CmdMirror, CmdBreak,
CmdOffset, CmdExtend, CmdTrim, CmdFillet, CmdStretch, CmdArrayPolar and CmdArrayRectangular,
CmdClipCopy, CmdClipPaste, CmdClipCut for editing/manipulating entities using CommandAction.
Besides the above functions CommandAction has viewing functionality like zooming to the whole document
or to a small window, change the 3D view etc. You can zoom to a user selected window like :
vdFramedControl1.BaseControl.ActiveDocument.CommandAction.Zoom("w", null,
null);
//This will prompt user to select entities and copy them from one point to
another
Developer can use : Zoom, Pan, View3D, UCS to change the view of the document.
You can see the "Commands" sample of the vdFrameWork samples collection. This sample demonstrates the
use of predefined commands that can be used to draw graphic objects like lines, circles etc (cmdLine,
cmdCircle etc) and also transform these objects like Copy, Move, Rotate etc.
For more detailed information about properties/methods/events etc of the above object(s), you can also
check our vdf.chm help file, topic(s): "vdCommandAction Class".
Product : Engine - vdFrammedControl, Version : 6
Getting Start Guide VDF vdFramedControl version 6
Dimensioning is the process of adding measurement annotation to a drawing. User has many ways to dimension objects and many ways
to format dimensions. You can create dimensions for a wide variety of object shapes in many different orientations. You can create
dimension styles to format dimensions quickly and ensure that dimensions in your drawing conform to industry or project standards.
Dimensions show the measurements of objects, the distances or angles between objects, or the distance of a feature from an origin you
specify. User has three basic types of dimensioning: linear, radial, and angular. Dimensions can be horizontal, vertical, aligned, rotated
or angular. A linear dimension measuring the distance between two points which is displayed parallel to the points being measured. In
aligned dimensions, the dimension line is parallel to the extension line origins. The extension line origins are specified using the
DefPoint1 and DefPoint2 properties.
Angular dimensions measure the angle between two lines or three points.
Dimensions use an existing DimStyle in order to display the lines and the texts/numbers of the dimension, see in this article.
You can also add dimensions with code like below (prior to this you should run the code in this article) :
For more detailed information about properties/methods/events etc of the above object(s), you can also check our vdf.chm help file,
topic(s): "vdDimension Class".
Product : Engine - vdFrammedControl, Version : 6
Getting Start Guide VDF vdFramedControl version 6
Dimension style (vdDimStyle object) is a group of dimension settings that determines the appearance of a dimension. The active
dimension style determines the appearance of new dimensions created in the drawing. To change the style of an existing
dimension, use the Style property found on the dimension.
When you create a dimension, the current dimension style is associated with that dimension. The dimension retains this
dimension style unless you apply a new dimension style to it or set up dimension style overrides.
The picture below shows where the vdDimstyle's properties apply to vdDimension objects.
In the DimStyle you can use an existing TextStyle in order to display the texts/numbers of the dimension, see in this article.
You can also create your own DimStyles with code like below:
For more detailed information about properties/methods/events etc of the above object(s), you can also check our vdf.chm help
file, topic(s): "vdDimstyle Class".
Product : Engine - vdFrammedControl, Version : 6
Getting Start Guide VDF vdFramedControl version 6
TextStyle is a named, saved collection of settings that determines the appearance of text strings. You can
create your own text styles which can have specific fonts and text height. You can also specify if the texts
(vdText/vdMText) will be underlined,bold etc. There is no limit to the number of text styles you can create in
your drawing. When you enter text, it uses the current text style, which sets the font, size, and other text
characteristics. If you want to create text using a different text style, you can make another text style
active.
In the TextStyle you can use Windows TTF fonts or CAD fonts named SHX fonts. More information regarding
these you can see in this article.
You can also create your own TextStyles with code like below:
For more detailed information about properties/methods/events etc of the above object(s), you can also
check our vdf.chm help file, topic(s): "vdTextstyle Class".
Product : Engine - vdFrammedControl, Version : 6
Getting Start Guide VDF vdFramedControl version 6
The VectorDraw Document object (named vdDocument Class; check also the "vdDocument Class" topic in our VDF Help file) is the
top-most object in the drawing and of course the basic object. It has many properties and methods. Some properties of Document
object (and ActiveLayout) are used in order to change the view/appearance of the document, like the "RenderMode" property,
the "ViewCenter" & "ViewSize" properties, the "Palette" etc. It also contains information regarding the interface, like
"OsnapMode" and "OrthoMode", "SnapAngle, SnapBase, SnapIso" and similar properties. It is also containing the table
collections of the drawing like the "TextStyles, DimStyles, Layers, Blocks etc" that are used in the drawing. And of course it
contains the basic I/O functions like Open and Save.
You can also see topics: "vdDocument Class", "vdDocument Class, Methods", "vdDocument Class, Properties" and "vdDocument
Class, Overview" in our VDF help (VDF.CHM).
The VectorDraw Document object has events that the developer can use to customize his/her application. The complete list of
these events and also a brief description can be found in our VDF Help file under "vdDocument Class Events " topic, check also the
"vdDocument Class" topic.
Lets see a simple example. We will add a form and a button. In the button click a cmdLine with user input will be run :
While this command is running and the user inputs points a "rubber" line is displayed. This example will also draw another
"rubber" entity that will be a circle besides the rubber line. The Event that fires while the command is active is the OnActionDraw
(the action is the cmdLine). So we have to "define" the event in the Form Load, like
After this we have to add the code to the OnActionDraw event that will draw the rubber circle along with the rubber line that is
drawn automatically by the cmdLine. The code :
Now lets see a different kind of event, the OnAfterAddItem event that fires after an entity is added to the document collection. We
will use this event to add also a rectangle (vdRect Object) to the document. This rectangle will be round the line that was added
with cmdLine code. First we will have to "define" this event in the form load too:
Now lets add an extra grip point to the lines we draw. In this case the OnGetGripPoints event will be use like :
The OnAfterOpenDocument event is fire after the user opens a drawing. In the example below, a message box will be shown with
the number of the entities of the ActiveLayout and also the UCS axis icon will be hidden :
The VectorDraw Developers Framework library has extensive Drag & Drop capability and can be fully
controlled by the developer. The drag & Drop can produce a block to another VDF component, a picture in a
picture box or even a VectorDraw file when it is dragged to the desktop. In the following code we have a
form with 2 VDF components (Source and Destination, named vdSource and vdDestination respectively) and
an ImageButton component.
Clicking on the circle in the vdSource control and dragging it to the vdDest control and then release the
mouse then an insert will be added (a block also). Doing the same thing to the ImageButton control then a
bitmap will be generated and added to the ImageButton.
You can also drag from the vdSource control and drop to an explorer (or to the desktop) to create a vdml file
with the destination's entities. You can also drag a file from a file explorer and drop it to the the vdSource
control and it will be opened there.
You can check the Drag & Drop sample for a code like :
The VectorDraw Developers Framework version 6 .NET component can be localized in any language. Basically
the words that are being localized are the prompt messages, the grid property names and also the forms. If
a customer wants to localize his VectorDraw component can contact with us and we will provide the
following:
1. vdRes.txt
vdRes.txt is a text document that contains all prompt messages and also all property names that are
being displayed in the property list. There he can translate these messages in any language.
2. vdFormsRes.dll, vdFormsRes project
vdFormsRes is a project that contains all forms of VDF component. In this project all labels and buttons
can be localized to any language. Also someone can change the appearance of the forms.
Limitations:
-The constants in the property grid cannot be changed (e.g. PlFlagOPEN ,PlFlagCLOSE constant of the
polyline's flag property cannot be localized).
-You cannot add new buttons, labels at the vdFormsRes project.
New method added to get/set resource directory for commands.txt, menu.txt, vdres.txt
VectorDraw.Serialize.Activator.GetResourcesDirectory
VectorDraw.Serialize.Activator.SetResourcesDirectory
This directory is set by application (when the application is loaded) and the component searches this
directory for the resource files Commands.txt, Menu.txt and vdres.txt.
Also in vdres.txt the first name represent a property name and if the second value is '-' (minus symbol) then
the property is hidden from property grid.
If you want to use the vdFormsRes.dll in order to load your own forms then you should set the directory that
this dll is located in the vdres.txt at GlobalizedFormsDirectory with full path and dll name at the beginning of
the text document.
Product : Engine - vdFrammedControl, Version : 6
Getting Start Guide VDF vdFramedControl version 6
Grips are small, squares that are displayed at strategic points on objects that you have selected with your
mouse. You can drag these grips to edit the object(s) (stretch, move, rotate etc) quickly. The picture below
shows the default Grip points that are displayed on some vdFigures:
VectorDraw automatically shows the Grips on objects that are click if the EnableAutoGripOn is true. The
EnableAutoGripOn property is a value representing if the mouse click will show the grips of the entities and
also if the window Select command will start when the user click's to the control and there is no Entity
below.
You can also show the grips of an entity if the EnableAutoGripOn is false, using code in this article.
You can change the size or the color of the grips that are displayed using the GripColor and GripSize of
vdRenderGlobalProperties.
VectorDraw has the ability to create and display your own grips. For example you can add a mid-point grip
on vdLine object. See the following code :
For more detailed information about properties/methods/events etc of the above object(s), you can also
check our vdf.chm help file, topic(s): "ShowGrips Method".
Product : Engine - vdFrammedControl, Version : 6
Getting Start Guide VDF vdFramedControl version 6
Handle is a unique hexadecimal number for every VectorDraw graphical object (like lines arcs etc) and for VectorDraw collections (like Layers,
Dimstyles etc). This number which is a read only property of string type is persistent (stays the same) in a drawing for the life time of the
object. Every time a drawing is opened the drawing's object's Handle are the same.
It is very useful when you want to "connect" a graphical object of your drawing to a data object in your database, for fast retrieving like when
you use FindFromHandle of vdDocument. See the simple example below :
For more detailed information about properties/methods/events etc of the above object(s), you can also check our vdf.chm help file, topic(s):
"Handle Property".
Product : Engine - vdFrammedControl, Version : 6
Getting Start Guide VDF vdFramedControl version 6
Hatches and Solid fills are used when you want to show an area different from another area. For example in a
drawing that shows a house you can use a "GRASS" hatch to draw the garden of the house and a "CONCRETE" hatch
to show the road outside this house. There are some predefined hatches in the hatches collection that you can use
but you can also add your own hatches. Hatches consist of lines that can be Dashes (-), Dots (.) and Spaces ( ).
Beside hatching you can also fill an area with a specific fillcolor that can also be transparent, with a block or with an
image.
Below is a sample code that will add a hatch pattern (named TEST_HATCH) with two lines to the existing hatch
collection:
After this lets some some entities with hatches and fillmode solid. See the sample code below :
You can call the hatch pattern dialog with a code like :
For more detailed information about properties/methods/events etc of the above object(s), you can also check our
vdf.chm help file, topic(s): "vdHatchProperties Class" "vdHatchPatterns Class" and "vdHatchPattern Class".
Product : Engine - vdFrammedControl, Version : 6
Getting Start Guide VDF vdFramedControl version 6
Image is a basic object for inserting images in the drawing. Inserted Images can be BMP, GIF, JPG, PNG and
TIFF.
Image has a Scale property that is used to resize keeping the aspect ratio of the image. The image is defined
by InsertionPoint, Rotation, Width and Height.
ImageDefs is the collection of the images used in the drawing. Every new image is added to this collection.
You can try a code like :
The You can see the image definition dialog using a code like:
For more detailed information about properties/methods/events etc of the above object(s), you can also
check our vdf.chm help file, topic(s): "vdImages Class".
Product : Engine - vdFrammedControl, Version : 6
Getting Start Guide VDF vdFramedControl version 6
Layer is the equivalent of the overlay used in paper-based drafting. It is the primary organizational tool in
VectorDraw, and you can use it to group information by function and to enforce linetype, color, and other
standards.
Organizing Layers and the objects on Layers make it easier to manage the information in your Drawings.
When you put one layer over another then the result is the complete drawing.
Having kindred objects on the same layer it is very helpfull in order to organise the drawing.
Properties:
● layer name
● color of the entities
● line type of the entities
● line weight of the entities
● if it is participate or not in the drawing (thawed or frozen)
● locked or not
When you begin a new drawing, VectorDraw creates a special layer named 0. By default, layer 0 is assigned
color number 6 (Foreground color : white or black depending upon your background color), the CONTINUOUS
linetype and a lineweight of Default (the default setting is .01 inch or .25 mm). Layer 0 cannot be deleted or
renamed.
All new objects are added to the active layer if no layer is specified. Using VectorDraw you can Freeze (Hide),
Thaw (Show) and Lock layers. By controlling whether a Layer's state is Thaw or Frozen you can change the
appearance of your drawing to display only the information on the Layers that are visible. Freezing unused
Layers will help the performance of VectorDraw.
In the drawing below (Picture 1) there are 3 types of items : walls (the lines and Polylines with red color),
doors&windows (Blue color) and furniture (Magenta).
These objects are teamed and drawn in different layers. Walls placed on layer "WALLS", Doors&windows are
placed on layer "WIN_DOORS" and furniture are placed on layer "FURNITURE".
Picture 1
Picture 2
Picture 3
You can also create your own custom Layers. Like in the code below :
For more detailed information about properties/methods/events etc of the above object(s), you can also
check our vdf.chm help file, topic(s): "vdLayer Class".
Product : Engine - vdFrammedControl, Version : 6
Getting Start Guide VDF vdFramedControl version 6
Layout is used to compose or lay out your model drawing for printing. A layout may consist of a title block,
one or more viewports, and annotations. As you create a layout, you can design floating Viewport
configurations to visualize different details in your drawing.
A layout is a paper space environment that simulates a sheet of paper. In a layout, you can create and
position viewport objects, and you can add a title block or other geometry. You can create multiple layouts in
a drawing to display various views. Each layout displays the drawing as it will be printed on the sheet of
paper.
Typically, when you begin designing a layout environment, you step through the following process:
- Create a model drawing.
- Activate or create a layout.
- Insert a title block if is necessary.
- Create floating viewports and position them in the layout.
- Set the view scale and 3D view angle of the floating viewports.
- Print your layout.
Viewports are areas that display different views of your model. As you work, you can split the drawing area
into one or more adjacent rectangular views known as model viewports. In large or complex drawings,
displaying different views reduces the time needed to zoom or pan in a single view. Also, errors you might
miss in one view may be apparent into others. ViewPorts are treated as rectangle drawing objects which
display views and can be moved or resized.
They can be created only in entity list collection of a layout and not in Model. Those rectangles filled with the
image of the model space objects in different scales depend from the ViewSize and the ViewCenter property.
This way in one paper you can print out different views (with different scales) of the same drawing (Model
Space) or parts of this drawing. In viewports commands like Pan, Zoom and View3D can be applied.
A sample picture of a Layout (Paper Space) with some Viewports:
Below is a sample code that will open an existing drawing and add layouts and viewports. The AddLayout
code should be run before the AddLayoutEntities code :
With the following code you can see the Layout control :
For more detailed information about properties/methods/events etc of the above object(s), you can also
check our vdf.chm help file, topic(s): "vdLayout Class" and "vdViewport Class".
Product : Engine - vdFrammedControl, Version : 6
Getting Start Guide VDF vdFramedControl version 6
Linetypes are different ways to display a line. This is useful when you want to distinct different lines, for example a line that represents a 12Volt wire
and another line that represents a 24 Volt wire in an electrical drawing. VectorDraw library have already some linetypes that can be used.
You can see them using the Linetype's dialog :
You can also create your own custom Linetypes using Dashes (-), Dots (.) and Spaces ( ). Like in the code below :
Beside this you can create a Linety that will also contain text:
linetype.Segments.AddItem(new VectorDraw.Render.LineTypeSegment(-2.0));//Blank
linetype.Segments.AddItem(new VectorDraw.Render.LineTypeSegment(2.0)); //Dash
linetype.Segments.AddItem(new VectorDraw.Render.LineTypeSegment(-1.0));//Blank
linetype.Segments.UpdateLength();
vdFC.BaseControl.ActiveDocument.LineTypes.AddItem(linetype);
MessageBox.Show("We created a custom Linetype named MyCustomLinetype2 and looks like this: _ VD _");
For more detailed information about properties/methods/events etc of the above object(s), you can also check our vdf.chm help file, topic(s):
"vdLinetype Class".
Product : Engine - vdFrammedControl, Version : 6
Getting Start Guide VDF vdFramedControl version 6
The Text (vdText object) and MultilineText (vdMText) object are use to add text strings in your drawings. These texts
follow the TextStyle properties (which is a collection of settings) that determines the appearance of text strings. You
can also specify if the texts (vdText/vdMText) will be underlined,bold etc. When you enter text, it uses the current
text style, which sets the font, size, and other text characteristics. If you want to create text using a different text
style, you can make another text style active.
In the TextStyle you can use Windows TTF fonts or CAD fonts named SHX fonts.
You can easily add a text (vdText Object) using a code like :
The above commands can be used for simple texts or for user-input texts. You can add more complex texts and
multiline texts using vdText and vdMText objects like below.
You can add a vdText object with code like below:
You can also create a MultiLine Text with code like below:
In the Text String some special control characters/strings can be used in order to change the appearence of the text.
These are :
For more detailed information about properties/methods/events etc of the above object(s), you can also check our
vdf.chm help file, topic(s): "vdText Class" and "vdMText Class".
Product : Engine - vdFrammedControl, Version : 6
Getting Start Guide VDF vdFramedControl version 6
Object options allow you to draw in the Object Snap (OSnap). An OSnap mode specifies a snap point at an exact location on an object (like the mid-point of a line).
The OSnap mode helps the user to draw an object in a position relative to a previously drawn object.
The snap point on an object can be; End-point, Mid-point, Center point, Insertion point, Perpendicular, Nearest, Apparent Intersection, Node (point), Quadrant,
Tangent and Intersection.
The OSnap mode remains active until you turn it off, and there is an OSnap indicator in status bar if you choose to set it visible.
You can create a simple project, a form with a vdFramedControl and a button and open adrawing that contains some enities like lines, points inserts etc. Then in the
button click code you can set the OSnaps to Mid point plus Center point and start a user command like cmdLine that will ask the use to give the line's points with
mouse :
vdFC.BaseControl.ActiveDocument.osnapMode = VectorDraw.Geometry.OsnapMode.CEN;
vdFC.BaseControl.ActiveDocument.osnapMode |= VectorDraw.Geometry.OsnapMode.MID;
vdFC.BaseControl.ActiveDocument.CommandAction.CmdLine("USER");
The code above will highlight the end points and center points while the cmdLine is active:
vdFC.BaseControl.ActiveDocument.osnapMode |= VectorDraw.Geometry.OsnapMode.MID;
vdFC.BaseControl.ActiveDocument.osnapMode ^= VectorDraw.Geometry.OsnapMode.MID;
The code above will remove the mid points from OSnaps.
There are also some extra snap features that can be used in command line. These can be used in the command line and override the current OsnapMode value until
the user input the point he wants or cancel the command.
These are :
These commands also overide the current OsnapMode and previous Open the VDFCad sample, in a new drawing add a circle and some
typed osnap commands. After user finishes input the OsnapMode lines and in the command line start a user command, like line or
returns to the previous value. polyline and while the program waits for user to input a point :
.end This enable the End Point object snap By typing .end the end point osnap is activated.
.cen This enable the Center Point object snap By typing .cen the center point osnap is activated.
.ins This enable the Insertion Point object snap By typing .ins the insertion point osnap is activated.
.int This enable the Intersection Point object snap By typing .int the intersection point osnap is activated.
.mid This enable the Middle Point object snap By typing .mid the middle point osnap is activated.
.nea This enable the Nearest Point object snap By typing .nea the nearest point osnap is activated.
.node This enable the Node Point (vdPoint) object snap By typing .node the node (for vdPoints) point osnap is activated.
.per This enable the Perpendicular Point object snap By typing .per the perpendicular point osnap is activated.
.qua This enable the Quadratic Point object snap By typing .qua the quadratic point osnap is activated.
.tang This enable the Tangent Point object snap By typing .tang the tangent point osnap is activated
.x This enable the same X coordinate object snap, after that is waiting By typing .x the user selects the X coordinate of the point and the Y,Z
for Y,Z coordinates should be given in the next step. In VDFCad you can type
.x and then .end to get the x coordinate of the endpoint of a line and
then choose the Y & Z coordinates.
.y This enable the same Y coordinate object snap, after that is waiting By typing .y the user selects the Y coordinate of the point and the X,Z
for X,Z coordinates should be given in the next step.
.z This enable the same Z coordinate object snap, after that is waiting By typing .z the user selects the Z coordinate of the point and the X,Y
for X,Y coordinates should be given in the next step.
.xy This enable the same X & Y coordinate object snap, after that is By typing .xy the user selects the X & Y coordinates of the point and
waiting for Z the Z coordinate should be given in the next step.
.xz This enable the same X & Z coordinate object snap, after that is By typing .xz the user selects the X & Z coordinates of the point and
waiting for Y the Y coordinate should be given in the next step.
.yz This enable the same Y & Z coordinate object snap, after that is By typing .yz the user selects the Y & Z coordinates of the point and
waiting for X the X coordinate should be given in the next step.
.from This enable the same X coordinate object snap By typing .from the user can enter a temporary reference or base
point from which he can specify an offset to locate the next point.
.par This enable the Parallel Point to a given line segment object snap By typing .par the user selects a line segment and then a parallel snap
to this line segment will be enabled.
For more detailed information about properties/methods/events etc of the above object(s), you can also check our vdf.chm help file, topic(s): "OsnapMode
Enumeration (VectorDraw.Geometry)" and "osnapMode Property (vdDocument)".
Product : Engine - vdFrammedControl, Version : 6
Getting Start Guide VDF vdFramedControl version 6
VectorDraw uses section clipping planes to hide an area of the drawing. This SectionClip defines the side of the drawing that will be visible.
The rest will be hidden and this applies to the Render mode. The visible plane is defined in the vdSectionClip object by defining the
OriginPoint and the Direction vector. The direction of that vector defines the visible area. The area in the opposite direction will be hidden.
Direction with the OriginPoint define the plane that will do the section clipping. Their values are always in World Coordinating System.
Multiple vdSectionClip objects will show the common viewable area of all. This allows an unobstructed interior view of a 3D drawing by
hiding the defined area from view.
Below is a sample code that will draw a sphere and will add two section clips :
For more detailed information about properties/methods/events etc of the above object(s), you can also check our vdf.chm help file,
topic(s): "vdSectionClipping Class".
Product : Engine - vdFrammedControl, Version : 6
Getting Start Guide VDF vdFramedControl version 6
The Selections objects (vdSelection) can be used in order to temporary (not saved in the drawing) create a
group of drawing objects (like lines, circles etc) in order to apply properties (like pencolor) or to transform
them (like using cmdMove):
1) A simple code:
private void butGetSelection_Click(object sender, EventArgs e)
{
vd.BaseControl.ActiveDocument.New();
AddSomeEntities(); // This function adds some entities like lines and cirlces
vd.BaseControl.ActiveDocument.Prompt("Select Entities:");
vdSelection selset = vd.BaseControl.ActiveDocument.ActionUtility.getUserSelection();
vd.BaseControl.ActiveDocument.Prompt(null);
if (selset != null) {
MessageBox.Show("You have selected " + selset.Count + " figures");
foreach (vdFigure var in selset)
var.HighLight = true;
vd.BaseControl.ActiveDocument.Redraw(true); }
}
The code above starts an new empty document, call a function to create some entities, and prompts the user
to select some entities by choosing a window. If there are entities selected then displays the number of them
and set the HighLight property of each of them to true.
2) If we want to move (transform the location of) the entites that are selected then the code can be :
private void butGetSelection_Click(object sender, EventArgs e)
{
vd.BaseControl.ActiveDocument.New();
AddSomeEntities(); // This function adds some entities like lines and cirlces
vd.BaseControl.ActiveDocument.Prompt("Select Entities:");
vdSelection selset = vd.BaseControl.ActiveDocument.ActionUtility.getUserSelection();
vd.BaseControl.ActiveDocument.Prompt(null);
if (selset != null) {
gPoint pt1 = new gPoint(0, 0, 0);
gPoint pt2 = new gPoint(2, 2, 0);
vd.BaseControl.ActiveDocument.CommandAction.CmdMove(selset, pt1 , pt2);
vd.BaseControl.ActiveDocument.Redraw(true); }
}
The code above will move the selected entities from point {0,0,0} to point {2,2,0}.
For more detailed information about properties/methods/events etc of the above object(s), you can also
check our vdf.chm help file, topic(s): "vdSelection Class".
Product : Engine - vdFrammedControl, Version : 6
Getting Start Guide VDF vdFramedControl version 6
SupportPath is a very useful property of the VectorDraw Developers Framework. This property specifies the
directories in which VDF searches for files when using methods for drawings like insert, file open, images and
XRef (External Reference) attach, SHX font files. It is a string with multi paths separated by semicolon < ; >
like:
c:\;c:\temp;c:\Program Files/VectorDraw;
For more detailed information about properties/methods/events etc of the above object(s), you can also
check our vdf.chm help file, topic(s):"SupportPath Property".
Product : Engine - vdFrammedControl, Version : 6
Getting Start Guide VDF vdFramedControl version 6
The ToolTips is a property that applies to vdFigures, it is used to display a text when the mouse is over this object if
EnableToolTips property of vdDocument is true. Like :
The tooltip can be a multi line text like in the above example that "\n" is used to break the text to 2 lines.
You can change the way that the tooltips appear using the properties that you can find under the in
"ToolTipDisplayProps Class, Members" topic of our help. Like:
Beside tooltips you can use URLs that can be used in order to guide the user to an external link like a website. URLs
apply to an vdFigure if this object has an non-empty URL property and also the EnableUrls Property is true. For
example you can set the URL property of a vdFigure to "http://www.vdraw.com" in order to open this web page
when the user clicks (holding down CTRL keyboard key) this figure. If CTRL keyboard key is not down then the web
page will not open.
For more detailed information about properties/methods/events etc of the above object(s), you can also check our
vdf.chm help file, topic(s): "EnableUrls Property", "EnableToolTips Property", "ToolTip Property" and "URL Property".
Product : Engine - vdFrammedControl, Version : 6
Getting Start Guide VDF vdFramedControl version 6
The VectorDraw Developer Framework has Undo and Redo functionality which is unlimited. You can undo the
last actions one by one or group them and undo the whole group. The same is for redo previously undo
actions. A simple code will be like adding an entity (using for example cmdCircle) and undo the last action.
Like :
After the Button_cmdCircle code run and the button_Undo run then the Redo can run and bring back the
circle, like :
Except this simple undo/redo calls, you can also group some code so this can be undo/redo as a group. See
the code below :
After this code run, 4 circles will be created. One undo call and these 4 circles will disappear like they were
never drawn. After this undo, one Redo will bring back thes four circles.
Beside this, you can also clear the undo & redo history, and after that previous undo/redo actions will not be
available. You can do this using a code like :
For more detailed information about properties/methods/events etc of the above object(s), you can also
check our vdf.chm help file, topic(s): "Undo Method (vdCommandAction)".
Product : Engine - vdFrammedControl, Version : 6
Getting Start Guide VDF vdFramedControl version 6
Coordinates are being expressed in drawing units (D.U.). Drawing units are not expressing particular units (meters, inches etc). In this part
user have to make some assumptions in order to define that the coordinates of the drawing mean particular units (meters, inches etc).
For example: For a mechanical drawing we can make the assumption for example: where one drawing unit defines one millimeter(1 D.U.
=1mm). For a architectural/technical drawing we can make the assumption for example: where one drawing unit defines one meter(1 D.U.
=1m). This can be very helpful in designing, dimensioning, retrieving information from the drawing (distances, area calculations etc)
You can specify the type of the current unit of measurement (linear and angle) and the precision for the current units as also the current angle
format and the precision for the current angle display. The type of measurement can be:
These Properties change only the display and not the values which are in Drawing Units.
Running a code like :
The Angular & Linear units also apply to the vdDimensions and Dimension Styles. See the following code :
private void button2_Click(object sender, EventArgs e)
{
vdFC.BaseControl.ActiveDocument.New();
vdFC.BaseControl.ActiveDocument.CommandAction.CmdDim(VectorDraw.Professional.Constants.VdConstDimType.dim_Angular,
"USER", "USER", 0);
VectorDraw.Professional.vdFigures.vdDimension dime;
dime =
vdFC.BaseControl.ActiveDocument.ActiveLayOut.Entities[vdFC.BaseControl.ActiveDocument.ActiveLayOut.Entities.Count
- 1] as VectorDraw.Professional.vdFigures.vdDimension;
if (dime != null)
{
MessageBox.Show("The Angular units will now change from au_Degrees to au_Radians.");
dime.Invalidate();
dime.DimAunit = VectorDraw.Geometry.AUnits.AUnitType.au_Radians;
dime.Update();
dime.Invalidate();
}
}
For more detailed information about properties/methods/events etc of the above object(s), you can also check our vdf.chm help file, topic(s):
"LUnits Class" and "AUnits Class".
Product : Engine - vdFrammedControl, Version : 6
Getting Start Guide VDF vdFramedControl version 6
The XProperties are used to store extended data in a object. For example you might add the part number as
a string in a vdInsert object that represents graphically the part. This can be connected to a database with
more information for this object.
For example if you like the user to input a point in the drawing the you can call a code like :
//We will add a circle (assume that the circle represents a part) to the
model with a xproperty in it's collection that will represent the part number
in our database.
VectorDraw.Professional.vdFigures.vdCircle circle = new
VectorDraw.Professional.vdFigures.vdCircle();
circle.SetUnRegisterDocument(vdFC.BaseControl.ActiveDocument);
circle.setDocumentDefaults();
circle.Radius = 5.0;
circle.Center = new VectorDraw.Geometry.gPoint(2, 2, 0);
//Add string value xproperty that will represent in our applicatio the part
number of this part.
VectorDraw.Professional.vdObjects.vdXProperty xprop = new
VectorDraw.Professional.vdObjects.vdXProperty();
xprop.Name = "Part No.";
xprop.PropValue = "FG 127-34566";
circle.XProperties.AddItem(xprop);
vdFC.BaseControl.ActiveDocument.Model.Entities.AddItem(circle);
vdFC.BaseControl.ActiveDocument.Redraw(true);
You can also see topic "vdLinetype Class" in our VDF help (VDF.CHM).
The XProperties can also be stored in other objects than graphical entities. The objects can be vdLayouts,
vdLayers etc.
There are also some Xproperties that are dynamic and are binded to the geometrical information of the
objects. For example you can have the length of the line binded to the line and when this line is stretched or
scaled the value of the XProperty is changed accordingly. See the code below:
External Reference files (XRefs) are drawings that can be attached for reference in a drawing. When you
attach a drawing as an xref, you link that referenced drawing to the current drawing; any changes to the
referenced drawing are displayed in the current drawing when it is opened or reloaded. A drawing can be
attached as an XRefs to multiple drawings at the same time and multiple drawings can be attached as
referenced drawings to a single drawing.
Note that the objects in the XRefs attached to the current drawing are model space objects only. You can
insert the xref into the current drawing in either model space or paper space. The XRefs can be attached at
any location, scale, and rotation. The XRefs is a vdBlock object that is inserted (instance) in the drawing as a
vdInsert object.
Below is a sample code that will add an existing drwaing as an XRef file. This should be defined as a vbBlock
with ExternalReferencePath property :
After this the XRef (vdBlock) should be inserted in the drawing. See the sample code below :