private void ApplyConnection(ObservableCollection <ConnectionSetting> collection, string component, string boltweldtype, string angletype) { if (collection.Count == 0 || collection == null) { return; } var model = new Tekla.Structures.Model.Model(); var modelname = model.GetInfo().ModelName; var jobcode = GetJobCodeOnProjectName(modelname); foreach (var item in collection) { if (item.IsChecked) { var EnumComponent = (int)Enum.Parse(typeof(ComponentType), component); var EnumBoltweldtype = (int)Enum.Parse(typeof(BoltWeldOrientation), boltweldtype); var EnumAngletype = (int)Enum.Parse(typeof(AngleTypes), angletype); ConnectionChecker cnc = new ConnectionChecker(); if (item.IsSingleConnection) { cnc.CreateConnection((Beam)item.PrimaryObject, (Beam)item.SecondaryObject, EnumComponent, jobcode, EnumBoltweldtype, EnumAngletype); } if (!item.IsSingleConnection) { cnc.CreateConnection((Beam)item.PrimaryObject, item.SecondaryObjects, EnumComponent, jobcode, EnumBoltweldtype, EnumAngletype); } } } model.CommitChanges(); }