1

I want to create an IFC file which represents a beam. The inputs I have is 2 points and a cross section definition. The purpose is to view the shape of the beam. Can someone point me in the right direction. Does XBim have something which will enable one to do this?

I have tried to read through an IFC file exported from Tekla which has only one beam. I have tried to read through IFC Schema definition specification.(not very successful in locating one)

No code was written

What I am expecting is input a profile. (I do not know how to input a profile),Input start point and end point to create an IFC file which represents a beam. I should be then be able to open the file in an IFC viewer and view the beam

  • IFC Schema definitions can be found here: https://technical.buildingsmart.org/standards/ifc/ifc-schema-specifications/ – Vertexwahn Nov 04 '19 at 18:07

1 Answers1

1

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:

enter image description here

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;
}
Vertexwahn
  • 7,709
  • 6
  • 64
  • 90