需在事务中进行修改
private void SetFloorThickness(Floor floor, double thickness) {
if (floor != null)
{
double dThickness = thickness/304.8;
FloorType floorType = floor.FloorType;
CompoundStructure cs = floorType.GetCompoundStructure();
//获取所有层
IList<CompoundStructureLayer> lstLayers = cs.GetLayers();
foreach (CompoundStructureLayer item in lstLayers)
{
if (item.Function == MaterialFunctionAssignment.Structure)
{//这里只考虑有一个结构层,如果有多个就自己算算
item.Width = dThickness;
break;
}
}
//修改后要设置一遍
cs.SetLayers(lstLayers);
floorType.SetCompoundStructure(cs);
}
}