示例#1
0
 public static string ToNative(this StructuralStagedNodalRestraints restraint)
 {
     return(new GSAStructuralStagedNodalRestraints()
     {
         Value = restraint
     }.SetGWACommand());
 }
示例#2
0
 public static string ToNative(this StructuralStagedNodalRestraints restraint)
 {
     return(SchemaConversion.Helper.ToNativeTryCatch(restraint, () => new GSAStagedNodalRestraints()
     {
         Value = restraint
     }.SetGWACommand()));
 }
        public void ParseGWACommand(List <GSANode> nodes, List <GSAConstructionStage> stages)
        {
            if (this.GWACommand == null)
            {
                return;
            }

            var obj = new StructuralStagedNodalRestraints();

            var pieces = this.GWACommand.ListSplit("\t");

            var counter = 1; // Skip identifier

            obj.Name          = pieces[counter++];
            obj.ApplicationId = HelperClass.GetApplicationId(this.GetGSAKeyword(), this.GSAId);
            //Restraints
            var restraints = new bool[6];

            for (var i = 0; i < 6; i++)
            {
                restraints[i] = pieces[counter++] == "1";
            }
            obj.Restraint = new StructuralVectorBoolSix(restraints);

            var targetNodeRefs = Initialiser.Interface.ConvertGSAList(pieces[counter++], SpeckleGSAInterfaces.GSAEntity.NODE);

            if (nodes != null)
            {
                var targetNodes = nodes
                                  .Where(n => targetNodeRefs.Contains(n.GSAId)).ToList();

                obj.NodeRefs = targetNodes.Select(n => (string)n.Value.ApplicationId).ToList();
                this.SubGWACommand.AddRange(targetNodes.Select(n => n.GWACommand));

                foreach (var n in targetNodes)
                {
                    n.ForceSend = true;
                }
            }

            var gwaStageDefGsaIds = pieces[counter++].ListSplit(" ");

            obj.ConstructionStageRefs = stages.Where(sd => gwaStageDefGsaIds.Any(gwaSDId => gwaSDId == sd.GSAId.ToString())).Select(x => (string)x.Value.ApplicationId).ToList();

            this.Value = obj;
        }