private void CreateMaterialLayers(IBimBuildingElementType tType, XbimBuildingElementType sType)
        {
            foreach (XbimMaterialLayer layer in sType.MaterialLayers)
            {
                string matName = layer.Material.Name;
                
                IBimMaterial material = Target.GetMaterial(matName);
                if (material == null) material = Source.MaterialHelper.Convert(layer.Material);

                int layerIndex = sType.MaterialLayers.IndexOf(layer);
                tType.AddMaterialLayer(material, layer.Thickness, false, sType.GetMaterialFunction(layerIndex));
            }
        }
        private IBimBuildingElementType BaseConversion(IBimBuildingElementType tType, XbimBuildingElementType sType)
        {

            //set guid
            tType.GlobalId = sType.Guid;

            //set material layers if it exists in the object and object has appropriate type
            CreateMaterialLayers(tType, sType);

            //parameters
            PropertiesHelper.Convert(tType.Properties, sType.Properties);

            //add converted element to the stack of converted elements
            Source.AddConvertedObject(sType);

            return tType;


        }
 public IBimBuildingElementType ConvertSlabType(IBimBuildingElementType type)
 {
     XbimSlabType sType = type as XbimSlabType;
     if (sType == null) throw new ArgumentException("Unexpected type");
     CheckName(sType);
     IBimBuildingElementType tType = Target.NewSlabType(sType.Name, sType.Description, sType.PredefinedType);
     return BaseConversion(tType, sType);
 }
 public IBimBuildingElementType ConvertCoveringType(IBimBuildingElementType type)
 {
     XbimCoveringType sType = type as XbimCoveringType;
     if (sType == null) throw new ArgumentException("Unexpected type");
     CheckName(sType);
     IBimBuildingElementType tType = Target.NewCeilingType(sType.Name, sType.Description);
     return BaseConversion(tType, sType);
 } 
 public IBimBuildingElementType ConvertWindowType(IBimBuildingElementType type)
 {
     XbimWindowStyle sType = type as XbimWindowStyle;
     if (sType == null) throw new ArgumentException("Unexpected type");
     CheckName(sType);
     IBimBuildingElementType tType = Target.NewWindowType(sType.Name, sType.Description, sType.ConstructionType, sType.OperationType);
     return BaseConversion(tType, sType);
 }