Ejemplo n.º 1
0
        public static Section Define(List <Autodesk.DesignScript.Geometry.Surface> surfaces, string name, string materialType, string groupName, string typeName, string sizeName)
        {
            // check if string input is null
            if (name == null || materialType == null || groupName == null || typeName == null || sizeName == null)
            {
                throw new System.ArgumentException($"Some input is null. name: {name}, materialType: {materialType}, groupName: {groupName}, typeName: {typeName}, sizeName: {sizeName}");
            }

            // convert geometry
            List <Geometry.Region> regions = new List <Geometry.Region>();

            foreach (Autodesk.DesignScript.Geometry.Surface surface in surfaces)
            {
                regions.Add(Geometry.Region.FromDynamo(surface));
            }

            // create regions group
            Geometry.RegionGroup regionGroup = new Geometry.RegionGroup(regions);

            // get mat type
            FemDesign.Materials.MaterialTypeEnum matTypeEnum = (FemDesign.Materials.MaterialTypeEnum)Enum.Parse(typeof(FemDesign.Materials.MaterialTypeEnum), materialType);

            // create section
            Sections.Section section = new Sections.Section(regionGroup, name, "custom", matTypeEnum, groupName, typeName, sizeName);

            // return
            return(section);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Construct a new section
 /// <summary>
 public Section(Geometry.RegionGroup regionGroup, string name, string type, Materials.MaterialTypeEnum materialTypeEnum, string groupName, string typeName, string sizeName)
 {
     this.EntityCreated();
     this.RegionGroup  = regionGroup;
     this.Name         = name;
     this.Type         = type;
     this.MaterialType = ((int)materialTypeEnum).ToString();
     this.GroupName    = groupName;
     this.TypeName     = typeName;
     this.SizeName     = sizeName;
     this._end         = "";
 }