public static string Description(this GenericSection section) { if (section == null) { return("null section"); } return("Generic " + section.SectionProfile.IDescription() + " - " + CheckGetMaterialName(section.Material)); }
public static GenericSection GenericSectionFromProfile(IProfile profile, IMaterialFragment material = null, string name = "") { //Run pre-process for section create. Calculates all section constants and checks name of profile var preProcessValues = PreProcessSectionCreate(name, profile); name = preProcessValues.Item1; profile = preProcessValues.Item2; Dictionary <string, double> constants = preProcessValues.Item3; GenericSection section = new GenericSection(profile, constants["Area"], constants["Rgy"], constants["Rgz"], constants["J"], constants["Iy"], constants["Iz"], constants["Iw"], constants["Wely"], constants["Welz"], constants["Wply"], constants["Wplz"], constants["CentreZ"], constants["CentreY"], constants["Vz"], constants["Vpz"], constants["Vy"], constants["Vpy"], constants["Asy"], constants["Asz"]); return(PostProcessSectionCreate(section, name, material, MaterialType.Undefined)); }
/***************************************************/ private IFAttribute CreateSection(GenericSection sectionProperty) { IFGeometricLine lusasGeometricLine = null; if (sectionProperty.SectionProfile != null) { lusasGeometricLine = d_LusasData.createGeometricLine(sectionProperty.DescriptionOrName()); lusasGeometricLine.setValue("elementType", "3D Thick Beam"); if (CreateProfile(sectionProperty.DescriptionOrName(), sectionProperty.SectionProfile as dynamic)) { if (!(sectionProperty.SectionProfile is TaperedProfile)) { lusasGeometricLine.setFromLibrary("User Sections", "Local", sectionProperty.DescriptionOrName(), 0, 0); } } } return(lusasGeometricLine); }
/***************************************************/ /**** Public Methods ****/ /***************************************************/ public static ISectionProperty ToSection(this IFAttribute lusasAttribute) { string attributeName = GetName(lusasAttribute); string attributeType = lusasAttribute.getAttributeType(); int rows = lusasAttribute.countRows("A"); IProfile profile; GenericSection section = null; List <int> interpolationOrders = new List <int>(); List <double> positions = new List <double>(); List <IProfile> profiles = new List <IProfile>(); for (int i = 0; i < rows; i++) { profile = ToProfile(lusasAttribute, i); double area = lusasAttribute.getValue("A", i); double rgy = lusasAttribute.getValue("ky", i); double rgz = lusasAttribute.getValue("kz", i); double j = lusasAttribute.getValue("J", i); double iy = lusasAttribute.getValue("Iyy", i); double iz = lusasAttribute.getValue("Izz", i); double iw = lusasAttribute.getValue("Cw", i); double wely = Math.Min(Math.Abs(lusasAttribute.getValue("Syt", i)), Math.Abs(lusasAttribute.getValue("Syb", i))); double welz = Math.Min(Math.Abs(lusasAttribute.getValue("Szt", i)), Math.Abs(lusasAttribute.getValue("Szb", i))); double wply = lusasAttribute.getValue("Zpy", i); double wplz = lusasAttribute.getValue("Zpz", i); double centreZ = 0; //Eccentricity is handeled in the Bar not at the section double centreY = 0; //Eccentricity is handeled in the Bar not at the section double zt = lusasAttribute.getValue("zt", i); double zb = Math.Abs(lusasAttribute.getValue("zb", i)); double yt = Math.Abs(lusasAttribute.getValue("yb", i)); //Lusas Y-Axis is opposite to the BHoM Y-axis double yb = lusasAttribute.getValue("yt", i); double asy = lusasAttribute.getValue("Asy", i); double asz = lusasAttribute.getValue("Asz", i); if (profile == null) { return(null); } profile = Engine.Structure.Compute.Integrate(profile, oM.Geometry.Tolerance.MicroDistance).Item1; if (attributeType == "Multiple Varying Geometric") { double position = lusasAttribute.getValue("distanceAlongBeam", i); positions.Add(position); profiles.Add(profile); } else { section = new GenericSection(profile, area, rgy, rgz, j, iy, iz, iw, wely, welz, wply, wplz, centreZ, centreY, zt, zb, yt, yb, asy, asz); } } if (lusasAttribute.getAttributeType() == "Multiple Varying Geometric") { for (int i = 0; i < profiles.Count - 1; i++) { interpolationOrders.Add(1); } TaperedProfile taperedProfile = Engine.Spatial.Create.TaperedProfile(positions, profiles, interpolationOrders); if (taperedProfile == null) { return(null); } section = Engine.Structure.Create.GenericSectionFromProfile(taperedProfile); } section.Name = attributeName; int adapterNameId = lusasAttribute.getID(); section.SetAdapterId(typeof(LusasId), adapterNameId); return(section); }
// Constructor. public civ3Game(MyBinaryReader saveStream) { // Initialize my list of sections I don't know what to do with yet. this.pileOfSectionsToSortLater = new List <SectionWithLength>(); // Initialize empty byte[] pad list. this.bytePads = new List <byte[]>(); // Initialize empty tile list. this.tileSection = new List <SectionWithLength>(); // Read save file stream assuming fixed order and general structure. // Trying to use class constructors but reading some padding in manually. // FIX: hard-coding CIV3 length of 0x1a this.civ3Section = new GenericSection(saveStream, 0x1a); this.bicSection = new SectionWithLength(saveStream); this.bicqSection = new BicqSection(saveStream); this.gameSection = new GenericSection(saveStream, 0x0ecf); // reading in five sections (DATE, PLGI, PLGI, DATE and DATE) this.pileOfSectionsToSortLater.Add(new SectionWithLength(saveStream)); this.pileOfSectionsToSortLater.Add(new SectionWithLength(saveStream)); this.pileOfSectionsToSortLater.Add(new SectionWithLength(saveStream)); this.pileOfSectionsToSortLater.Add(new SectionWithLength(saveStream)); this.pileOfSectionsToSortLater.Add(new SectionWithLength(saveStream)); // FIX: hard-coded byte padding here. Is it algined? Other way to realign? this.bytePads.Add(saveStream.ReadBytes(8)); // reading CNSL section this.pileOfSectionsToSortLater.Add(new SectionWithLength(saveStream)); // reading three WRLD sections this.pileOfSectionsToSortLater.Add(new SectionWithLength(saveStream)); this.pileOfSectionsToSortLater.Add(new SectionWithLength(saveStream)); // FIX: Ugly hack to grab presumed map width and height. int mapWidth = BitConverter.ToInt32(pileOfSectionsToSortLater[pileOfSectionsToSortLater.Count - 1].buffer, 0x04); int mapHeight = BitConverter.ToInt32(pileOfSectionsToSortLater[pileOfSectionsToSortLater.Count - 1].buffer, 0x18); Console.WriteLine(mapWidth); Console.WriteLine(mapHeight); this.pileOfSectionsToSortLater.Add(new SectionWithLength(saveStream)); // FIX: hard-seeking to first TILE section of my test file. // saveStream.BaseStream.Seek(0x34a4, SeekOrigin.Begin); // Read all TILE sections. There are mapWidth/2 * mapHeight * 4 of them // FIX: I really want one entity per game tile, but there are four TILE sections per game tile for (int i = 0; i < (mapWidth / 2) * mapHeight * 4; i++) { this.tileSection.Add(new SectionWithLength(saveStream)); } Console.WriteLine(tileSection.Count); /* * // FIX: Need to load all tiles. Load a single tile into the list. * this.tileSection.Add(new SectionWithLength(saveStream)); * this.tileSection.Add(new SectionWithLength(saveStream)); * this.tileSection.Add(new SectionWithLength(saveStream)); * this.tileSection.Add(new SectionWithLength(saveStream)); * this.tileSection.Add(new SectionWithLength(saveStream)); * this.tileSection.Add(new SectionWithLength(saveStream)); */ // Iterating and printing out section names of my junk pile. foreach (SectionWithLength mySection in this.pileOfSectionsToSortLater) { Console.WriteLine(mySection.Name); } }
/***************************************************/ private bool SetProfile(GenericSection bhomProfile, string sectionName, string matName) { Engine.Base.Compute.RecordError("GenericSection is not yet implemented in SAP2000 adapter"); return(false); }