public static string ToNative(this StructuralConstructionStage stage) { return((new GSAConstructionStage() { Value = stage }).SetGWACommand()); }
public static string ToNative(this StructuralConstructionStage stage) { return(SchemaConversion.Helper.ToNativeTryCatch(stage, () => (new GSAConstructionStage() { Value = stage }).SetGWACommand())); }
public void ParseGWACommand(List <GSA1DElement> e1Ds, List <GSA2DElement> e2Ds, List <GSA1DMember> m1Ds, List <GSA2DMember> m2Ds) { if (this.GWACommand == null) { return; } var obj = new StructuralConstructionStage(); var pieces = this.GWACommand.ListSplit("\t"); var counter = 1; // Skip identifier this.GSAId = Convert.ToInt32(pieces[counter++]); obj.ApplicationId = Helper.GetApplicationId(this.GetGSAKeyword(), this.GSAId); obj.Name = pieces[counter++]; counter++; //Skip colour var elementList = pieces[counter++]; obj.ElementRefs = new List <string>(); if (Initialiser.Settings.TargetLayer == GSATargetLayer.Analysis) { var elementId = Initialiser.Interface.ConvertGSAList(elementList, SpeckleGSAInterfaces.GSAEntity.ELEMENT); foreach (var id in elementId) { IGSASpeckleContainer elem = e1Ds.Where(e => e.GSAId == id).FirstOrDefault(); if (elem == null) { elem = e2Ds.Where(e => e.GSAId == id).FirstOrDefault(); } if (elem == null) { continue; } obj.ElementRefs.Add((elem.Value as SpeckleObject).ApplicationId); this.SubGWACommand.Add(elem.GWACommand); } } else { var groupIds = Helper.GetGroupsFromGSAList(elementList).ToList(); foreach (var id in groupIds) { var memb1Ds = m1Ds.Where(m => m.Group == id); var memb2Ds = m2Ds.Where(m => m.Group == id); obj.ElementRefs.AddRange(memb1Ds.Select(m => (string)m.Value.ApplicationId)); obj.ElementRefs.AddRange(memb2Ds.Select(m => (string)m.Value.ApplicationId)); this.SubGWACommand.AddRange(memb1Ds.Select(m => m.GWACommand)); this.SubGWACommand.AddRange(memb2Ds.Select(m => m.GWACommand)); } } counter++; //Skip creep coefficient obj.StageDays = Convert.ToInt32(pieces[counter++]); this.Value = obj; }