/***************************************************/ private List <RAMFactoredEndReactions> ReadBeamEndReactions(List <string> ids = null) { List <RAMFactoredEndReactions> barEndReactions = new List <RAMFactoredEndReactions>(); IModel ramModel = m_Application.GetDispInterfacePointerByEnum(EINTERFACES.IModel_INT); List <IBeam> ramBeams = ReadRamBeams(ramModel); foreach (IBeam beam in ramBeams) { IAnalyticalResult result = beam.GetAnalyticalResult(); IMemberForces forces = result.GetMaximumComboReactions(COMBO_MATERIAL_TYPE.GRAV_STEEL); RAMFactoredEndReactions bhomEndReactions = new RAMFactoredEndReactions() { ObjectId = beam.lUID, StartReaction = forces.GetAt(0).ToBHoMObject(), EndReaction = forces.GetAt(1).ToBHoMObject(), }; barEndReactions.Add(bhomEndReactions); } return(barEndReactions); }
/***************************************************/ public static Bar ToBHoMObject(this IBeam ramBeam, ILayoutBeam ramLayoutBeam, double dElevation) { // Get coordinates from IBeam SCoordinate startPt = new SCoordinate(); SCoordinate endPt = new SCoordinate(); ramBeam.GetCoordinates(EBeamCoordLoc.eBeamEnds, ref startPt, ref endPt); Node startNode = new Node { Position = startPt.PointFromRAM() }; Node endNode = new Node { Position = endPt.PointFromRAM() }; //Assign section property per bar string sectionName = ramBeam.strSectionLabel; ISectionProperty sectionProperty = ToBHoMSection(ramBeam); // Create bars with section properties Bar bhomBar = new Bar { StartNode = startNode, EndNode = endNode, SectionProperty = sectionProperty, Name = sectionName }; // Set Properties bhomBar.OrientationAngle = 0; // Unique RAM ID RAMId RAMId = new RAMId(); RAMId.Id = ramBeam.lUID; bhomBar.SetAdapterId(RAMId); RAMFrameData ramFrameData = new RAMFrameData(); ramFrameData.FrameNumber = ramBeam.lLabel; ramFrameData.StartCantilever = ramBeam.dStartCantilever.FromInch(); ramFrameData.EndCantilever = ramBeam.dEndCantilever.FromInch(); ramFrameData.IsStubCantilever = (ramLayoutBeam.IsStubCantilever() == 1); ramFrameData.FrameType = ramBeam.eFramingType.ToString(); ramFrameData.Material = ramBeam.eMaterial.ToString(); bhomBar.Tags.Add("Beam"); // Get Steel beam results ISteelBeamDesignResult Result = ramBeam.GetSteelDesignResult(); DAArray ppalNumStuds = Result.GetNumStudsInSegments(); int numStudSegments = new int(); ppalNumStuds.GetSize(ref numStudSegments); double camber = ramBeam.dCamber; int studCount = 0; IAnalyticalResult AnalyticalResult = ramBeam.GetAnalyticalResult(); COMBO_MATERIAL_TYPE Steel_Grav = COMBO_MATERIAL_TYPE.GRAV_STEEL; IMemberForces IMemberForces = AnalyticalResult.GetMaximumComboReactions(Steel_Grav); //Add studs to custom Data by total stud count only for (int i = 0; i < numStudSegments; i++) { var segStudCount = new object(); ppalNumStuds.GetAt(i, ref segStudCount); string segStudStr = segStudCount.ToString(); int segStudNum = System.Convert.ToInt16(segStudStr); studCount += segStudNum; ramFrameData.Studs = studCount; } // Add camber to Custom Data if (camber > Double.MinValue) { ramFrameData.Camber = camber.FromInch(); } // Translate RAM Releases to BHoM Releases (in progress; logic not yet complete since it is difficult map Maj/Min axes to global XYZ axes for every member) // May be better to just do in custom data, although if we can do this mapping it may be useful bhomBar.Release = new BarRelease(); bhomBar.Release.StartRelease = new Constraint6DOF(); bhomBar.Release.EndRelease = new Constraint6DOF(); bhomBar.Release.StartRelease.RotationX = new DOFType(); bhomBar.Release.EndRelease.RotationX = new DOFType(); bhomBar.Release.StartRelease.RotationY = new DOFType(); bhomBar.Release.EndRelease.RotationY = new DOFType(); if (ramBeam.bMajAxisBendFixedStart == 1) { bhomBar.Release.StartRelease.RotationX = DOFType.Fixed; } else { bhomBar.Release.StartRelease.RotationX = DOFType.Free; } if (ramBeam.bMajAxisBendFixedEnd == 1) { bhomBar.Release.EndRelease.RotationX = DOFType.Fixed; } else { bhomBar.Release.EndRelease.RotationX = DOFType.Free; } if (ramBeam.bMinAxisBendFixedStart == 1) { bhomBar.Release.StartRelease.RotationY = DOFType.Fixed; } else { bhomBar.Release.StartRelease.RotationY = DOFType.Free; } if (ramBeam.bMinAxisBendFixedEnd == 1) { bhomBar.Release.EndRelease.RotationY = DOFType.Fixed; } else { bhomBar.Release.EndRelease.RotationY = DOFType.Free; } double DCI = Result.dDesignCapacityInteraction; double CDI = Result.dCriticalDeflectionInteraction; // Add DCI and CDI data ramFrameData.DesignCapacityInteraction = DCI; ramFrameData.CriticalDeflectionInteraction = CDI; bhomBar.Fragments.Add(ramFrameData); return(bhomBar); }