我使用此代码通过 xBim Toolkit 创建 IfcClosedShell。它编译得很好。但是在尝试将此几何图形添加到 IfcProduct 后,文件中没有任何可见的几何图形。
var ifcClosedShell = model.Instances.New<Xbim.Ifc2x3.TopologyResource.IfcClosedShell>(cs =>
{
//Запишем грани
foreach (var meshTuple in meshList)
{
var csMesh = m_Meshes[meshTuple.Item1];
for (int i = 0; i < csMesh.Faces; i++)
{
var face = model.Instances.New<Xbim.Ifc2x3.TopologyResource.IfcFace>(fc =>
{
var polyLoop = model.Instances.New<Xbim.Ifc2x3.TopologyResource.IfcPolyLoop>(pLoop =>
{
var v1 = csMesh.Vertices[csMesh.Index[i * 3]];
var v2 = csMesh.Vertices[csMesh.Index[i * 3 + 1]];
var v3 = csMesh.Vertices[csMesh.Index[i * 3 + 2]];
var pt1 = model.Instances.New<Xbim.Ifc2x3.GeometryResource.IfcCartesianPoint>(p =>
p.SetXYZ(v1.Position.x, v1.Position.y, v1.Position.z));
var pt2 = model.Instances.New<Xbim.Ifc2x3.GeometryResource.IfcCartesianPoint>(p =>
p.SetXYZ(v2.Position.x, v2.Position.y, v2.Position.z));
var pt3 = model.Instances.New<Xbim.Ifc2x3.GeometryResource.IfcCartesianPoint>(p =>
p.SetXYZ(v3.Position.x, v3.Position.y, v3.Position.z));
pLoop.Polygon.Add(pt1); pLoop.Polygon.Add(pt2); pLoop.Polygon.Add(pt3);
});
var faceBound = model.Instances.New<Xbim.Ifc2x3.TopologyResource.IfcFaceOuterBound>();
faceBound.Bound = polyLoop;
fc.Bounds.Add(faceBound);
cs.CfsFaces.Add(face);
});
}
}
});
谁能告诉我这段代码是否正确?谢谢!