XBim provides all IFC Entities as C# classes (Early Binding).
You can create a Cross-Profile for instance this way:
public IfcProfileDef getBasicProfileDescirption() {
IfcPolyline polyline = new IfcPolyline(id++);
model_.insertEntity(polyline);
double Left = -OverallWidth_ / 2.0;
double Right = OverallWidth_ / 2.0;
double Top = OverallDepth_ / 2.0;
double Bottom = -OverallDepth_ / 2.0;
polyline.Points.add(createPoint(Left,Top) ); // coordinate (A)
polyline.Points.add(createPoint(Right,Top) ); // coordinate (B)
polyline.Points.add(createPoint(Right,Top-FlangeThickness_)); // coordinate (C)
polyline.Points.add(createPoint(WebThickness_*0.5,Top-FlangeThickness_) ); // coordinate (D)
polyline.Points.add(createPoint(WebThickness_*0.5,Bottom+FlangeThickness_) ); // coordinate (E)
polyline.Points.add(createPoint(Right,Bottom+FlangeThickness_) ); // coordinate (F)
polyline.Points.add(createPoint(Right,Bottom) ); // coordinate (G)
polyline.Points.add(createPoint(Left,Bottom) ); // coordinate (H)
polyline.Points.add(createPoint(Left,Bottom+FlangeThickness_) ); // coordinate (I)
polyline.Points.add(createPoint(-WebThickness_*0.5,Bottom+FlangeThickness_) ); // coordinate (J)
polyline.Points.add(createPoint(-WebThickness_*0.5,Top-FlangeThickness_) ); // coordinate (K)
polyline.Points.add(createPoint(Left,Top-FlangeThickness_) ); // coordinate (L)
// close profile
polyline.Points.add(createPoint(Left,Top)); // coordinate (A)
IfcArbitraryClosedProfileDef profile = new IfcArbitraryClosedProfileDef(id++);
model_.insertEntity(profile);
//profile.ProfileType = new IfcProfileTypeEnum(IfcProfileTypeEnum.AREA);
profile.OuterCurve = polyline;
return profile;
}
To create a cartesian 2d point I use this method:
private IfcCartesianPoint createPoint(double x, double y) {
IfcCartesianPoint point = new IfcCartesianPoint(id++);
point.Coordinates.add(new IfcLengthMeasure(x));
point.Coordinates.add(new IfcLengthMeasure(y));
model_.insertEntity(point);
return point;
}
An extruded solid form a proifle can be created this way:
private IfcExtrudedAreaSolid getBasicProfileDescirption() {
IfcExtrudedAreaSolid baseMesh = new IfcExtrudedAreaSolid();
baseMesh.SweptArea = getBasicProfileDescirption();
baseMesh.ExtrudedDirection = createDirecton(0, 0, 1);
baseMesh.Depth = new IfcPositiveLengthMeasure(scale_ * height_);
return baseMesh;
}
IFC defines a number of corss sections (profiles) that can be used:

BTW the getDirection
method looks like this:
private IfcDirection createDirecton(double x, double y, double z) {
IfcDirection dir = new IfcDirection();
dir.DirectionRatios.add(new IfcReal(x));
dir.DirectionRatios.add(new IfcReal(y));
dir.DirectionRatios.add(new IfcReal(z));
return dir;
}