Esempio n. 1
0
 public static string ToNative(this StructuralRigidConstraints constraint)
 {
     return(new GSARigidConstraints()
     {
         Value = constraint
     }.SetGWACommand());
 }
Esempio n. 2
0
 public static string ToNative(this StructuralRigidConstraints constraint)
 {
     return(SchemaConversion.Helper.ToNativeTryCatch(constraint, () => new GSARigidConstraints()
     {
         Value = constraint
     }.SetGWACommand()));
 }
Esempio n. 3
0
        public void ParseGWACommand(List <GSANode> nodes, List <GSAConstructionStage> stages)
        {
            if (this.GWACommand == null)
            {
                return;
            }

            var obj = new StructuralRigidConstraints();

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

            var counter = 1; // Skip identifier

            obj.Name          = pieces[counter++].Trim(new char[] { '"' });
            obj.ApplicationId = HelperClass.GetApplicationId(this.GetGSAKeyword(), this.GSAId);
            var masterNodeRef = Convert.ToInt32(pieces[counter++]);
            var masterNode    = nodes.Where(n => n.GSAId == masterNodeRef);

            if (masterNode.Count() > 0)
            {
                this.SubGWACommand.Add(masterNode.First().GWACommand);
                obj.MasterNodeRef = masterNode.First().Value.ApplicationId;
            }

            var constraint = new bool[6];

            var linkage = pieces[counter++];

            switch (linkage)
            {
            case "ALL":
            case "PIN":
                constraint = new bool[] { true, true, true, true, true, true };
                break;

            case "XY_PLANE":
            case "XY_PLANE_PIN":
                constraint = new bool[] { true, true, false, false, false, true };
                break;

            case "YZ_PLANE":
            case "YZ_PLANE_PIN":
                constraint = new bool[] { false, true, true, true, false, false };
                break;

            case "ZX_PLANE":
            case "ZX_PLANE_PIN":
                constraint = new bool[] { true, false, true, false, true, false };
                break;

            case "XY_PLATE":
            case "XY_PLATE_PIN":
                constraint = new bool[] { false, false, true, true, true, false };
                break;

            case "YZ_PLATE":
            case "YZ_PLATE_PIN":
                constraint = new bool[] { true, false, false, false, true, true };
                break;

            case "ZX_PLATE":
            case "ZX_PLATE_PIN":
                constraint = new bool[] { false, true, false, true, false, true };
                break;

            default:
                // Ignore non-diagonal terms of coupled directionsl.
                // Assume if rotational direction is locked, it is locked for all slave directions.
                constraint[0] = linkage.Contains("X:X");
                constraint[1] = linkage.Contains("Y:Y");
                constraint[2] = linkage.Contains("Z:Z");
                constraint[3] = linkage.Contains("XX:XX");
                constraint[4] = linkage.Contains("YY:YY");
                constraint[5] = linkage.Contains("ZZ:ZZ");
                break;
            }

            obj.Constraint = new StructuralVectorBoolSix(constraint);

            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();

            counter++; // Parent member

            this.Value = obj;
        }