我想创建一个代表光束的IFC文件。我输入的内容是2点和一个横截面定义。目的是查看光束的形状。有人可以指出我正确的方向。 XBim是否有可以使之做到这一点的东西?
我尝试通读从Tekla导出的IFC文件,该文件只有一个光束。我尝试通读IFC Schema定义规范。(找到一个不是很成功)
未编写任何代码
我期望输入一个配置文件。 (我不知道如何输入轮廓),输入起点和终点以创建代表光束的IFC文件。然后,我应该能够在IFC查看器中打开文件并查看光束
答案 0 :(得分:0)
XBim将所有IFC实体作为C#类(早期绑定)提供。
您可以通过以下方式创建交叉配置文件:
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;
}
要创建笛卡尔二维点,请使用以下方法:
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;
}
可以通过以下方式创建轮廓的挤压实体:
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定义了许多可以使用的corss部分(配置文件):
顺便说一句,getDirection
方法如下:
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;
}