public static string ToNative(this Structural1DLoad load)
        {
            if (string.IsNullOrEmpty(load.ApplicationId) && !Helper.IsValidLoading(load.Loading))
            {
                return("");
            }

            //Note: only LOAD_BEAM_UDL is supported at this stage
            var keyword           = GsaRecord.GetKeyword <GsaLoadBeam>();
            var gwaSetCommandType = GsaRecord.GetGwaSetCommandType <GsaLoadBeam>();
            var streamId          = Initialiser.AppResources.Cache.LookupStream(load.ApplicationId);

            var loadCaseIndex = Initialiser.AppResources.Cache.ResolveIndex(GsaRecord.GetKeyword <GsaLoadCase>(), load.LoadCaseRef);

            var entityKeyword = (Initialiser.AppResources.Settings.TargetLayer == GSATargetLayer.Design) ? GsaRecord.GetKeyword <GsaMemb>() : GsaRecord.GetKeyword <GsaEl>();
            var entityIndices = Initialiser.AppResources.Cache.LookupIndices(entityKeyword, load.ElementRefs).Where(i => i.HasValue).Select(i => i.Value).ToList();

            var loadingDict = Helper.ExplodeLoading(load.Loading);

            foreach (var k in loadingDict.Keys)
            {
                var applicationId = string.Join("_", load.ApplicationId, k.ToString());
                var index         = Initialiser.AppResources.Cache.ResolveIndex(keyword, applicationId);
                var gsaLoad       = new GsaLoadBeamUdl()
                {
                    Index         = index,
                    ApplicationId = applicationId,
                    StreamId      = streamId,
                    Name          = load.Name,
                    LoadDirection = k,
                    Load          = loadingDict[k],
                    Projected     = false,
                    AxisRefType   = LoadBeamAxisRefType.Global,
                    LoadCaseIndex = loadCaseIndex,
                    Entities      = entityIndices
                };

                if (gsaLoad.Gwa(out var gwa, false))
                {
                    foreach (var gwaLine in gwa)
                    {
                        Initialiser.AppResources.Cache.Upsert(keyword, index, gwaLine, streamId, applicationId, gwaSetCommandType);
                    }
                }
            }

            return("");
        }
Exemple #2
0
        public static string ToNative(this Structural0DLoad load)
        {
            if (string.IsNullOrEmpty(load.ApplicationId) && !Helper.IsValidLoading(load.Loading))
            {
                return("");
            }

            var keyword         = GsaRecord.GetKeyword <GsaLoadNode>();
            var nodeKeyword     = GsaRecord.GetKeyword <GsaNode>();
            var loadCaseKeyword = GsaRecord.GetKeyword <GsaLoadCase>();

            var nodeIndices       = Initialiser.AppResources.Cache.LookupIndices(nodeKeyword, load.NodeRefs).Where(x => x.HasValue).Select(x => x.Value).OrderBy(i => i).ToList();
            var loadCaseIndex     = Initialiser.AppResources.Cache.ResolveIndex(loadCaseKeyword, load.LoadCaseRef);
            var streamId          = Initialiser.AppResources.Cache.LookupStream(load.ApplicationId);
            var gwaSetCommandType = GsaRecord.GetGwaSetCommandType <GsaLoadNode>();

            var gwaList     = new List <string>();
            var loadingDict = Helper.ExplodeLoading(load.Loading);

            foreach (var k in loadingDict.Keys)
            {
                var applicationId = string.Join("_", load.ApplicationId, k.ToString());
                var index         = Initialiser.AppResources.Cache.ResolveIndex(keyword, applicationId);
                var gsaLoad       = new GsaLoadNode()
                {
                    Index         = index,
                    ApplicationId = applicationId,
                    StreamId      = streamId,
                    Name          = load.Name,
                    LoadDirection = k,
                    Value         = loadingDict[k],
                    GlobalAxis    = true,
                    NodeIndices   = nodeIndices,
                    LoadCaseIndex = loadCaseIndex
                };
                if (gsaLoad.Gwa(out var gwa, false))
                {
                    Initialiser.AppResources.Cache.Upsert(keyword, index, gwa.First(), streamId, applicationId, gwaSetCommandType);
                }
            }

            return("");
        }