Create .Net managed applications with 2D/3D graphics that manages(Import/export) a big range of formats and geometrical shapes
$ dotnet add package VectorDraw.Drawing.Framework.Net-6.xCreate .Net managed applications with 2D/3D graphics that manages(Import/export) a big range of formats and geometrical shapes
Add package to your .Net managed Application. This package Supports Windows 10 and above x64 Platform target. Can be used in Framework 6.x and above projects(7.x , 8.x , 9.x ...). See the following examples for quick start using
Registered users must also add VectorDraw Licence to their Applications. The license is added to the application by vdLic.exe and using the serial both provided by VectorDraw. If the license is not present then the package works in evaluation mode for 180 days. Edit the build events of your Application and add the followings to the .csproj file
<Target Name = "PostBuild" AfterTargets="PostBuildEvent">
<Exec Command = ""$(VDRAWDEV)vdlic.exe" "$(TargetPath)"" />
</Target >
<Target Name="AddPayloadsFolder" AfterTargets="Publish">
<Exec Command = ""$(VDRAWDEV)vdlic.exe" "$(PublishDir)$(targetfilename)"" />
</Target >
View and Edit Drawings inside a 'Window Form App':
public partial class Form1 : Form
{
vdControls.vdFramedControl vd = new();
public Form1()
{
InitializeComponent();
vd.Dock = DockStyle.Fill;
this.Controls.Add( vd );
this.WindowState = FormWindowState.Maximized;
}
}
Create simple entities and save to a drawing inside a 'Window Form App':
public partial class Form1 : Form
{
vdControls.vdFramedControl vd = new();
public Form1()
{
Application.SetHighDpiMode(HighDpiMode.SystemAware);
InitializeComponent();
vd.Dock = DockStyle.Fill;
this.Controls.Add(vd);
this.WindowState = FormWindowState.Maximized;
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
vdDocument doc = vd.BaseControl.ActiveDocument;
doc.New();//clear the document and initialize it to the defualt state with empty model entities
//create a new vdline
vdLine line1 = new vdLine(doc,new VectorDraw.Geometry.gPoint(0,0,0), new VectorDraw.Geometry.gPoint(2,2,0));
doc.Model.Entities.AddItem(line1);
vdCircle circle = new vdCircle(doc, new VectorDraw.Geometry.gPoint(1, 1, 0), 1.0);
doc.Model.Entities.AddItem(circle);
doc.ZoomExtents();
doc.Redraw(false);
//opens the Save dialog and prompts the user to select a file type to save the drawing
bool success = vdCommandAction.SaveAsEx(doc);
//alternate save it direct to a file type in local dist
//bool success = doc.SaveAs(System.IO.Path.GetDirectoryName(Application.ExecutablePath) + @"/vectordraw.pdf");
}
}
<!-- The main types provided in this library -->
<!-- The key features of this package -->
Create 3d entities inside a 'Window Form App':
public partial class Form1 : Form
{
vdControls.vdFramedControl vd = new();
public Form1()
{
Application.SetHighDpiMode(HighDpiMode.SystemAware);
InitializeComponent();
vd.Dock = DockStyle.Fill;
this.Controls.Add(vd);
this.WindowState = FormWindowState.Maximized;
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
vdDocument doc = vd.BaseControl.ActiveDocument;
doc.New();//clear the document and initialize it to the defualt state with empty model entities
//create a new cube
vdPolyface cube = new vdPolyface(doc);
cube.CreateBox(new VectorDraw.Geometry.gPoint(0, 0, 0), 4, 4, 4, 0);
//create a cylider represent the hole
vdPolyface cylider = new vdPolyface(doc);
cylider.CreateCone(new VectorDraw.Geometry.gPoint(2, 2, -1), 2, 2, 6, 16);
//subtruct the cylider from the cube to a new object entitiy
vdPolyface result = new vdPolyface(doc);
result.CombinePolyfacesEx(cube, cylider, BooleanOperation.Substraction);
//add the entitity to the document
doc.Model.Entities.AddItem(result);
//shading the result in NorthEast view
doc.RenderMode = VectorDraw.Render.vdRender.Mode.Shade;
doc.CommandAction.View3D("VINE");
doc.Redraw(false);
}
}Open IFC documents inside a 'Window Form App':
using VectorDraw.Professional.ActionUtilities;
using VectorDraw.Professional.vdObjects;
namespace WinFormsApp3
{
public partial class Form1 : Form
{
vdControls.vdFramedControl vd = new();
vdIFC.vdIFCComponent iFC = new vdIFC.vdIFCComponent();
public Form1()
{
Application.SetHighDpiMode(HighDpiMode.SystemAware);
InitializeComponent();
vd.Dock = DockStyle.Fill;
this.Controls.Add(vd);
this.WindowState = FormWindowState.Maximized;
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
vdDocument doc = vd.BaseControl.ActiveDocument;
iFC.MeterProgress = doc.MeterProgress;//pipe the IFC progress throw our base document progress
//events needs to implement IFC openning
doc.OnAfterOpenDocument += new vdDocument.AfterOpenDocument(doc_OnAfterOpenDocument);
doc.OnIsValidOpenFormat += Doc_OnIsValidOpenFormat;
doc.OnLoadUnknownFileName += Doc_OnLoadUnknownFileName;
doc.OnGetOpenFileFilterFormat += ActiveDocument_OnGetOpenFileFilterFormat;
//begin an open file dialog prompting the user to select a file from local disk
vdCommandAction.OpenEx(doc);
}
void ActiveDocument_OnGetOpenFileFilterFormat(ref string openFilter)
{
//add the ifc to the open dialog filter types
openFilter = vdIFC.vdIFCComponent.DefaultOpenDialogFilter + openFilter;
}
private void Doc_OnLoadUnknownFileName(object sender, string fileName, out bool success)
{
success = false;
vdDocument mdoc = (vdDocument)sender;
if (mdoc != null && vdIFC.vdIFCComponent.IsIFCExtension(fileName))
{
//because the vdIFCDocument represents a single entity
//if the selected file is IFC then add the vdIFCDocument to the document model entities
vdIFC.vdIFCDocument vdifcdoc = iFC.Open(fileName);
if (vdifcdoc != null)
{
mdoc.EnsureDefaults();
mdoc.Model.Entities.AddItem(vdifcdoc);
success = true;
}
}
}
private void Doc_OnIsValidOpenFormat(object sender, string extension, ref bool success)
{
//info the document that the IFC is a known valid format
success = vdIFC.vdIFCComponent.IsIFCExtension(extension);
}
void doc_OnAfterOpenDocument(object sender)
{
//because IFC are usually 3d drawings change the render mode to 3d shading and also change the background to White than black which is the default
vdDocument mdoc = (vdDocument)sender;
if (mdoc != null && vdIFC.vdIFCComponent.IsIFCExtension(mdoc.FileName))
{
mdoc.RenderMode = VectorDraw.Render.vdRender.Mode.Shade;
mdoc.Background = Color.White;
//view the drawing from North East direction
mdoc.CommandAction.View3D("VINE");
}
}
}
}
The main types provided by this library are:
VectorDraw.Professional.Components.vdDocumentComponentVectorDraw.Professional.Control.VectorDrawBaseControlvdControls.vdFramedControlVectorDraw.Professional.Converter.vdConvertervdIFC.vdIFCComponent