Table of Contents

Method New

Namespace
vdIFC
Assembly
vdIFC.dll

New(LengthUnits)

Creates and returns a new empty vdIFCDocument

public vdIFCDocument New(LengthUnits lengthUnits = LengthUnits.Millimetre)

Parameters

lengthUnits LengthUnits

Returns

vdIFCDocument

Examples

IFC New Open and Save example.

//create a new empty IFC Document
vdIFCDocument vdifcdoc = vdIFCComponent1.New();

//Set some properties for the IFC Document project
vdifcdoc.Project.Name = "MyProject";
vdifcdoc.Project.Site.Address = new vdAddress() { Country = "Greece", Region = "Attica", Town = "Glyfada", InternalLocation = "VectorDraw Software Corporation 11 Kyrillou - Methodiou Street" };

//Create a new Bulding and add it to the Buildings collection of the project site
vdIFCBuilding building = vdifcdoc.Project.Site.Buildings.Add("Building 1");

//create a new storey and add it to the previous created building
vdIFCBuildingStorey storey = building.BuildingStoreys.Add("Ground");

//create an IFC element that represents an ifc wall element type
vdIFCProduct mywall = new vdIFCProduct() { Name = "Wall_1", IFCType = vdIFCProduct.IfcElementTypeName.IfcWall.ToString() };
//create a vdRect that represents the wall element grapics
vdFigure mywallGraphics = new vdRect() { PenColor = new vdColor(vdColor.ColorType.ByBlock), Width = 10, Height = 0.4, Thickness = 3, HatchProperties = new vdHatchProperties(VectorDraw.Professional.Constants.VdConstFill.VdFillModeSolid) };
//add the graphic representation to the wall product entities
mywall.Entities.AddItem(mywallGraphics);

//select a color for the wall
mywall.PenColor = new vdColor(Color.Brown);
//set some properties that will be exported to the ifc file format
vdIFCProperties vdprops = mywall.PropertiesGroup.Add("VectorDraw Wall Properties");
vdprops.Properties["Wall_Length"] = 10;
vdprops.Properties["Wall_Width"] = 0.4;
vdprops.Properties["Wall_Height"] = 3.0;
//add the wall to the storey
storey.Products.Add(mywall);

//Note if the object you create does not have the Building logic for example as simple space area (vdIFCProduct.IfcElementTypeName.IfcSpace) 
//you can add it to vdifcdoc.Project.Site.Products as follow

vdIFCProduct myspace = new vdIFCProduct() { Name = "Space_1", IFCType = vdIFCProduct.IfcElementTypeName.IfcSpace.ToString() };
//create a vdRect that represents the space element grapics
vdFigure myspaceGraphics = new vdRect() { PenColor = new vdColor(vdColor.ColorType.ByBlock), InsertionPoint = new gPoint(-5, -10, 0), Width = 20, Height = 20, HatchProperties = new vdHatchProperties(VectorDraw.Professional.Constants.VdConstFill.VdFillModeSolid) };
//add the graphic representation to the space product entities
myspace.Entities.AddItem(myspaceGraphics);

//select a color for the wall
myspace.PenColor = new vdColor(Color.Green);

//set some properties that will be exported to the ifc file format
vdIFCProperties space_vdprops = myspace.PropertiesGroup.Add("VectorDraw Space Properties");
space_vdprops.Properties["Sapce_Length"] = 20;
space_vdprops.Properties["Space_Width"] = 20;
space_vdprops.Properties["Space_Area"] = 400;

//add the space to the project Site products
vdifcdoc.Project.Site.Products.Add(myspace);



//save the ifc file to IFC4 format
string filename = System.IO.Path.GetDirectoryName(Application.ExecutablePath) + @"\test.ifc";

bool suc = vdIFCComponent1.Save(vdifcdoc, filename);

//Open an ifc file and create a new vdIFCDocument with contents of the file
vdIFCDocument vdifcdoc2 = vdIFCComponent1.Open(filename);
//add the file to the Model Entities of an existing vdDocument object (doc) in order to view and edit it.
//Then if vdDocument is saved as vdml/vdcl format will contain the vdIFCDocument in the document.Model.Entities
//Note that the vdIFC.dll must exist in the VectorDraw FrameWork Installation path in order to read the vdIFCDocument else
//it will be read as vdProxyFigure
if (vdifcdoc2 != null)
{
    doc.New();
    doc.Model.Entities.AddItem(vdifcdoc2);
    doc.ZoomExtents();
    doc.Redraw(true);
}