In this article, we will explore how to use IfcBuilder methods in Eyeshot to create walls and roofs for a simple building design. We begin by generating two main Blocks: one for the North–South walls and one for the East–West walls. Each block contains the geometry and the openings belonging to its respective wall orientation. Later, we will place these blocks in the model using block references positioned at the correct coordinates. Finally, we will create the roof using extrusion techniques and add everything to the Design.
First, let's initialize the data:
double windowWidth = 12;
double windowHeight = 6;
double sillHeight = 15;
double wallThickness = 20;1. Creating the North and South Walls Blocks
We start by creating the block that represents both the north and south walls, using the CreateWallBlock1 function. This function defines the profile, extrudes it into a wall, adds windows and a door, and applies cuts to shape the final geometry. The result is a complete Block that can later be inserted multiple times in the Design with different transformations.
Block CreateWallBlock1(string blockName, Transformation transform)
{
var outerProf = devDept.Eyeshot.Entities.Region.CreateRectangle(60, 3);
outerProf.TransformBy(transform);
var extrusionDir = Vector3D.AxisZ * 40;
var wall = IfcBuilder.Extrude(outerProf, extrusionDir, ifcElementType.IfcWall);
var windowProf = devDept.Eyeshot.Entities.Region.CreateRectangle(Plane.XZ, windowWidth, windowHeight);
var win1 = (Region)windowProf.Clone();
win1.Translate(5, 7, sillHeight - windowHeight);
win1.TransformBy(transform);
IfcBuilder.ExtrudeRemove(wall, win1, wallThickness);
var win2 = (Region)windowProf.Clone();
extrusionDir = Vector3D.AxisY * (-wallThickness);
Brep opening = IfcBuilder.Extrude(win2, extrusionDir, ifcElementType.IfcOpeningElement);
IfcBuilder.TransformBy(opening, Transformation.CreateTranslation(41, 5, sillHeight - windowHeight));
opening.TransformBy(transform);
IfcBuilder.Difference(wall, opening);
double windowRadius = 3;
var windowcircularProf = devDept.Eyeshot.Entities.Region.CreateCircle(windowRadius);
var win3 = (Region)windowcircularProf.Clone();
win3.Rotate(Math.PI / 2, Vector3D.AxisX);
win3.Translate(30, 0, 30);
win3.TransformBy(transform);
IfcBuilder.ExtrudeRemoveThrough(wall, win3);
var door = devDept.Eyeshot.Entities.Region.CreateRectangle(Plane.XZ, 10, sillHeight);
door.Translate(25, 0, 0);
door.TransformBy(transform);
IfcBuilder.ExtrudeRemove(wall, door, -wallThickness);
Vector3D normal1 = new Vector3D(Point3D.Origin, new Point3D(-1, 0, 3));
normal1.Normalize();
Plane pln1 = new Plane(new Point3D(-90, 0, 0), normal1);
pln1.TransformBy(transform);
IfcBuilder.CutBy(wall, pln1);
Vector3D normal2 = new Vector3D(Point3D.Origin, new Point3D(1, 0, 3));
normal2.Normalize();
Plane pln2 = new Plane(new Point3D(60 + 90, 0, 0), normal2);
pln2.TransformBy(transform);
IfcBuilder.CutBy(wall, pln2);
var block = new Block(blockName);
block.Entities.Add(wall, Color.SandyBrown);
return block;
}This function builds the complete North–South wall block. The geometry is created using extrusion methods such as IfcBuilder.ExtrudeRemove, IfcBuilder.ExtrudeRemoveThrough, and IfcBuilder.Difference to define openings, while IfcBuilder.CutBy trims the wall into its final shape.
2. Creating the East and West Walls Blocks
Next, we create another Block for the east and west walls using the CreateWallBlock2 function. This Block follows a similar process to the first one, but with different profile dimensions.
Block CreateWallBlock2(string blockName, Transformation transform)
{
var outerProf = devDept.Eyeshot.Entities.Region.CreateRectangle(3, 80);
outerProf.TransformBy(transform);
var extrusionDir = Vector3D.AxisZ * 30;
var wall = IfcBuilder.Extrude(outerProf, extrusionDir, ifcElementType.IfcWall);
var windowProf = devDept.Eyeshot.Entities.Region.CreateRectangle(Plane.YZ, windowWidth, windowHeight);
var win1 = (Region)windowProf.Clone();
win1.Translate(7, 12, sillHeight - windowHeight);
win1.TransformBy(transform);
IfcBuilder.ExtrudeRemove(wall, win1, -wallThickness);
var win2 = (Region)windowProf.Clone();
extrusionDir = Vector3D.AxisX * (-wallThickness);
Brep opening = IfcBuilder.Extrude(win2, extrusionDir, ifcElementType.IfcOpeningElement);
IfcBuilder.TransformBy(opening, Transformation.CreateTranslation(5, 56, sillHeight - windowHeight));
opening.TransformBy(transform);
IfcBuilder.Difference(wall, opening);
var door = devDept.Eyeshot.Entities.Region.CreateRectangle(Plane.YZ, windowWidth, sillHeight);
door.Translate(0, 34, 0);
door.TransformBy(transform);
IfcBuilder.ExtrudeRemove(wall, door, wallThickness);
var block = new Block(blockName);
block.Entities.Add(wall, Color.SandyBrown);
return block;
}3. Creating the Roof
Lastly, we create the roof by extruding two roof profiles. These profiles are rotated and translated to form the two slopes of the roof.
double lengthRoof = Math.Sqrt(1e3) + 3;
var roofProf = devDept.Eyeshot.Entities.Region.CreateRectangle(lengthRoof, 80 + 2 * (3) + 2 * 3);
var roofProfR = (Region)roofProf.Clone();
roofProfR.Translate(0,-3);
double theta = Math.Acos(3 / Math.Sqrt(10));
roofProfR.Rotate(-theta, Vector3D.AxisY);
roofProfR.Translate(0, 0, 30);
roofProfR.Translate(-3 * Math.Cos(theta), 0, -3 * Math.Sin(theta));
var roofRight = IfcBuilder.Extrude(roofProfR, Vector3D.AxisZ, ifcElementType.IfcRoof);
var roofProfL = (Region)roofProf.Clone();
roofProfL.Rotate(theta, Vector3D.AxisY);
roofProfL.Translate(30, -3, 30 + 10);
var roofLeft = IfcBuilder.Extrude(roofProfL, Vector3D.AxisZ, ifcElementType.IfcRoof);The roof is generated by extruding the two rectangular profiles with IfcBuilder.Extrude and then placing them in the correct position to form a complete roof structure.
4. Adding into Design Entities and Blocks
After creating the two wall blocks and the roof geometry, we add them into the Design. First, we insert the wall blocks into the Design’s block collection. Then we create BlockReference entities, which place each wall block in the correct position within the model. Finally, the roof solids are added directly to the Design.
var wallNorthSouth = CreateWallBlock1("Wall_NorthSouth", Transformation.CreateIdentity());
var wallEastWest = CreateWallBlock2("Wall_EastWest", Transformation.CreateTranslation(0, 3));
design.Blocks.Add(wallNorthSouth);
design.Entities.Add(new BlockReference(0, 0, 0, "Wall_NorthSouth", 0)); // Wall North
design.Entities.Add(new BlockReference(0, 103, 0, "Wall_NorthSouth", 0)); // Wall South
design.Blocks.Add(wallEastWest);
design.Entities.Add(new BlockReference(0, 0, 0, "Wall_EastWest", 0)); // Wall East
design.Entities.Add(new BlockReference(57, 0, 0, "Wall_EastWest", 0)); // Wall West
design.Entities.Add(roofRight, Color.DarkRed);
design.Entities.Add(roofLeft, Color.DarkRed);
WriteIFC wIfc = new WriteIFC(design1, @"C:\Users\yourpath\fileIFC");
wIfc.DoWork();
Comments
Do you support IFC structure, e.g. project, site, building, storey, ...
No, Eyeshot’s IFC export does not currently support the full IFC spatial structure.
At the moment, when using WriteIFC, the export focuses on correctly generating IFC geometric elements, but these elements are not organized into the standard IFC hierarchy (IfcProject, IfcSite, IfcBuilding, IfcBuildingStorey).
Support for the IFC spatial hierarchy is planned for a future release.
Please sign in to leave a comment.