Exemplo n.º 1
0
 public void WriteSets(ModelObjectSetCollection sets, ETABSConversionContext context)
 {
     foreach (var set in sets)
     {
         string setName = set.Name;
         SapModel.GroupDef.SetGroup(setName);
         if (set is LinearElementSet)
         {
             var lES   = (LinearElementSet)set;
             var items = lES.Items;
             foreach (var item in items)
             {
                 string id = context.IDMap.GetSecondID(item);
                 if (id != null)
                 {
                     SapModel.FrameObj.SetGroupAssign(id, setName);
                 }
             }
         }
         else if (set is PanelElementSet)
         {
             var lES   = (PanelElementSet)set;
             var items = lES.Items;
             foreach (var item in items)
             {
                 string id = context.IDMap.GetSecondID(item);
                 if (id != null)
                 {
                     SapModel.AreaObj.SetGroupAssign(id, setName);
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Write the sets in the model to ETABS groups
 /// </summary>
 /// <param name="sets"></param>
 /// <param name="context"></param>
 public void WriteSets(ModelObjectSetCollection sets, ETABSConversionContext context)
 {
     foreach (var set in sets)
     {
         string setName = set.Name;
         SapModel.GroupDef.SetGroup(setName);
         if (set is LinearElementSet lES)
         {
             WriteSet(setName, lES, context);
         }
         else if (set is PanelElementSet pES)
         {
             WriteSet(setName, pES, context);
         }
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Write a Nucleus model to the currently open ETABS model
        /// </summary>
        /// <param name="model"></param>
        /// <param name="context"></param>
        /// <returns></returns>
        private bool WriteToETABS(Model.Model model, ETABSConversionContext context)
        {
            RaiseMessage("Writing data to ETABS...");

            SapModel.File.NewBlank(); //TODO: check if updating
            //SapModel.File.NewSteelDeck(0, 12, 12, 0, 0, 24, 24);

            if (context.Options.Levels)
            {
                LevelCollection levels = model.Levels;
                // Seemingly can only write whole table at once - updating individuals may not be wise...
                if (levels.Count > 0)
                {
                    RaiseMessage("Writing levels...");
                    WriteStoreys(levels, context);
                }
            }

            if (context.Options.Nodes)
            {
                NodeCollection nodes = model.Nodes;
                if (context.Options.Update)
                {
                    nodes = nodes.Modified(context.Options.UpdateSince);
                }
                if (nodes.Count > 0)
                {
                    RaiseMessage("Writing nodes...");
                }
                WriteNodes(nodes, context);
            }

            if (context.Options.Families)
            {
                FamilyCollection families = model.Families;
                if (context.Options.Update)
                {
                    families = families.Modified(context.Options.UpdateSince);
                }
                if (families.Count > 0)
                {
                    RaiseMessage("Writing properties...");
                }
                WriteFamilies(families, context);
            }

            if (context.Options.LinearElements)
            {
                LinearElementCollection linearElements = model.Elements.LinearElements;
                if (context.Options.Update)
                {
                    linearElements = linearElements.Modified(context.Options.UpdateSince);
                }
                if (linearElements.Count > 0)
                {
                    RaiseMessage("Writing linear elements...");
                }
                WriteLinearElements(linearElements, context);
            }

            if (context.Options.PanelElements)
            {
                PanelElementCollection panelElements = model.Elements.PanelElements;
                if (context.Options.Update)
                {
                    panelElements = panelElements.Modified(context.Options.UpdateSince);
                }
                if (panelElements.Count > 0)
                {
                    RaiseMessage("Writing Panels...");
                }
                WritePanelElements(panelElements, context);
            }

            if (context.Options.Sets)
            {
                ModelObjectSetCollection sets = model.Sets;
                //if (context.Options.Update) sets = //TODO?
                if (sets.Count > 0)
                {
                    RaiseMessage("Writing Groups...");
                }
                WriteSets(sets, context);
            }

            if (context.Options.Loading)
            {
                var cases = model.LoadCases;
                if (cases.Count > 0)
                {
                    RaiseMessage("Writing Load Cases...");
                }
                WriteLoadCases(cases, context);

                var loads = model.Loads;
                if (loads.Count > 0)
                {
                    RaiseMessage("Writing Loads...");
                }
                WriteLoads(loads, context);
            }

            return(true);
        }