Exemplo n.º 1
0
        private void WriteSection(SectionFamily section, ETABSConversionContext context)
        {
            string name    = section.Name;
            string matProp = GetEquivalentMaterial(section.GetPrimaryMaterial());

            if (section.Profile == null)
            {
                var profile = section.Profile;
                SapModel.PropFrame.SetGeneral(name, matProp, 0, 0, 0,
                                              0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
                //TODO: ?
            }
            else if (section.Profile is SymmetricIProfile)
            {
                var profile = (SymmetricIProfile)section.Profile;
                SapModel.PropFrame.SetISection(name, matProp, profile.Depth, profile.Width, profile.FlangeThickness, profile.WebThickness, profile.Width, profile.FlangeThickness);
            }
            else if (section.Profile is RectangularHollowProfile)
            {
                var profile = (RectangularHollowProfile)section.Profile;
                SapModel.PropFrame.SetTube(name, matProp, profile.Depth, profile.Width, profile.FlangeThickness, profile.WebThickness);
            }
            else if (section.Profile is RectangularProfile)
            {
                var profile = (RectangularProfile)section.Profile;
                SapModel.PropFrame.SetRectangle(name, matProp, profile.Depth, profile.Width);
            }
            else if (section.Profile is CircularHollowProfile)
            {
                var profile = (CircularHollowProfile)section.Profile;
                SapModel.PropFrame.SetPipe(name, matProp, profile.Diameter, profile.WallThickness);
            }
            else if (section.Profile is CircularProfile)
            {
                var profile = (CircularProfile)section.Profile;
                SapModel.PropFrame.SetCircle(name, matProp, profile.Diameter);
            }
            else if (section.Profile is AngleProfile)
            {
                var profile = (AngleProfile)section.Profile;
                SapModel.PropFrame.SetAngle(name, matProp, profile.Depth, profile.Width, profile.FlangeThickness, profile.WebThickness);
            }
            else if (section.Profile is ChannelProfile)
            {
                var profile = (ChannelProfile)section.Profile;
                SapModel.PropFrame.SetChannel(name, matProp, profile.Depth, profile.Width, profile.FlangeThickness, profile.WebThickness);
            }
            else if (section.Profile is TProfile)
            {
                var profile = (TProfile)section.Profile;
                SapModel.PropFrame.SetTee(name, matProp, profile.Depth, profile.Width, profile.FlangeThickness, profile.WebThickness);
            }
            else
            {
                var profile = section.Profile;
                SapModel.PropFrame.SetGeneral(name, matProp, profile.OverallDepth, profile.OverallWidth, profile.Area,
                                              0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); //TODO: Replace with calculated properties
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Get a GSA section description of the current object
 /// </summary>
 /// <returns></returns>
 public string SectionDescription()
 {
     if (SourceObject is SectionFamily)
     {
         SectionFamily section = (SectionFamily)SourceObject;
         // TODO: Create section description
         if (section.Profile != null)
         {
             //if (section.Profile.CatalogueName != null)
             //   return "CAT " + section.Profile.CatalogueName;
             if (section.Profile is SymmetricIProfile)
             {
                 var profile = (SymmetricIProfile)section.Profile;
                 return(string.Format("STD I({0}) {1} {2} {3} {4}", "m", profile.Depth, profile.Width, profile.WebThickness, profile.FlangeThickness));
             }
             else if (section.Profile is RectangularHollowProfile)
             {
                 var profile = (RectangularHollowProfile)section.Profile;
                 return(string.Format("STD RHS({0}) {1} {2} {3} {4}", "m", profile.Depth, profile.Width, profile.WebThickness, profile.FlangeThickness));
             }
             else if (section.Profile is RectangularProfile)
             {
                 var profile = (RectangularProfile)section.Profile;
                 return(string.Format("STD R({0}) {1} {2}", "m", profile.Depth, profile.Width));
             }
             else if (section.Profile is CircularHollowProfile)
             {
                 var chsSection = (CircularHollowProfile)section.Profile;
                 return(string.Format("STD CHS({0}) {1} {2}", "m", chsSection.Diameter, chsSection.WallThickness));
             }
             else if (section.Profile is CircularProfile)
             {
                 var profile = (CircularProfile)section.Profile;
                 return(string.Format("STD C({0}) {1}", "m", profile.Diameter));
             }
             else if (section.Profile is TProfile)
             {
                 var profile = (TProfile)section.Profile;
                 return(string.Format("STD T({0}) {1} {2} {3} {4}", "m", profile.Depth, profile.Width, profile.WebThickness, profile.FlangeThickness));
             }
             else if (section.Profile is AngleProfile)
             {
                 var profile = (AngleProfile)section.Profile;
                 return(string.Format("STD A({0}) {1} {2} {3} {4}", "m", profile.Depth, profile.Width, profile.WebThickness, profile.FlangeThickness));
             }
             else if (section.Profile is ChannelProfile)
             {
                 var profile = (ChannelProfile)section.Profile;
                 //?:
                 return(string.Format("STD CH({0}) {1} {2} {3} {4}", "m", profile.Depth, profile.Width, profile.WebThickness, profile.FlangeThickness));
             }
             // TODO: Other types
         }
     }
     return("EXP");
 }
Exemplo n.º 3
0
        public override bool Execute(ExecutionInfo exInfo = null)
        {
            Elements = new ElementCollection();

            if (Geometry != null)
            {
                // Convert each geometry item:
                foreach (VertexGeometry shape in Geometry)
                {
                    if (shape is Curve) // Convert to linear element
                    {
                        LinearElement element = Model.Create.LinearElement((Curve)shape, exInfo);
                        if (FamiliesFromLayers && shape.Attributes != null && !string.IsNullOrWhiteSpace(shape.Attributes.LayerName))
                        {
                            string        layerName = shape.Attributes.LayerName;
                            SectionFamily sF        = Model.Families.Sections.FindByName(layerName);
                            if (sF == null)
                            {
                                sF = Model.Create.SectionFamily(layerName, exInfo);
                            }
                            element.Family = sF;
                        }
                        Elements.Add(element);
                    }
                    else if (shape is Surface) //Reminder: Meshes are also surfaces!
                    {
                        PanelElement element = Model.Create.PanelElement((Surface)shape, exInfo);
                        if (FamiliesFromLayers && shape.Attributes != null && !string.IsNullOrWhiteSpace(shape.Attributes.LayerName))
                        {
                            string        layerName = shape.Attributes.LayerName;
                            BuildUpFamily fF        = Model.Families.PanelFamilies.FindByName(layerName);
                            if (fF == null)
                            {
                                fF = Model.Create.BuildUpFamily(layerName, exInfo);
                            }
                            element.Family = fF;
                        }
                        Elements.Add(element);
                    }
                }
                Elements.GenerateNodes(new NodeGenerationParameters());
                return(true);
            }
            return(false);
        }
 /// <summary>
 /// Override function which invalidates the representations of objects as necessary when a design update occurs
 /// In this case, the section representations need to be updated whenever the section geometry changes as well as
 /// the element geometry (which is done by default)
 /// </summary>
 /// <param name="doc"></param>
 /// <param name="e"></param>
 public override void InvalidateOnUpdate(object modified, PropertyChangedEventArgs e)
 {
     if (modified is SectionFamily)
     {
         SectionFamily     sp  = (SectionFamily)modified;
         ElementCollection els = sp.Elements();
         foreach (LinearElement lEl in els)
         {
             InvalidateRepresentation(lEl);
         }
         Core.Instance.Host.Refresh();
     }
     else
     {
         base.InvalidateOnUpdate(modified, e);
         if (modified is LinearElement && (e.PropertyName == "Family" || e.PropertyName == "Orientation"))
         {
             Core.Instance.Host.Refresh();
         }
     }
 }
Exemplo n.º 5
0
 public override bool Execute(ExecutionInfo exInfo = null)
 {
     Section = Model.Families.FindByName(Name) as SectionFamily;
     return(true);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Remove a section entry
 /// </summary>
 /// <param name="section"></param>
 public void Remove(SectionFamily section)
 {
     Remove(SectionCategory, section.GUID);
 }
Exemplo n.º 7
0
 /// <summary>
 /// Add a new Section entry to this mapping table
 /// </summary>
 /// <param name="section"></param>
 /// <param name="label"></param>
 public void Add(SectionFamily section, IRobotLabel label)
 {
     Add(SectionCategory, section.GUID, label.Name);
 }