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