/***************************************************/ /**** Private methods ****/ /***************************************************/ private bool CreateObject(BarDistributedMass distributedMass) { int err = 0; int uID = 1; double tol = 0.001; int loadCaseId = GetAdapterId <int>(distributedMass.Loadcase); foreach (Bar bar in distributedMass.Objects.Elements) { double length = BH.Engine.Geometry.Query.Length(BH.Engine.Structure.Query.Centreline(bar)); int barId = GetAdapterId <int>(bar); if (distributedMass.MassA > 0 || distributedMass.MassB > 0) { int dlType = St7.dlLinear; double[] values = new double[10]; values[0] = distributedMass.MassA; values[1] = distributedMass.MassB; values[4] = distributedMass.DistanceFromA / length; values[5] = distributedMass.DistanceFromB / length; values[6] = distributedMass.DynamicFactor; values[7] = distributedMass.Offset.X; values[8] = distributedMass.Offset.Y; values[9] = distributedMass.Offset.Z; int globalDistMassCount = 0; err = St7.St7GetEntityAttributeSequenceCount(uID, St7.tyBEAM, barId, St7.aoBeamNSMass, ref globalDistMassCount); if (!St7ErrorCustom(err, "Couldn't get a number of global distributed beam masses for a loadcase " + loadCaseId + " beam " + barId)) { return(false); } err = St7.St7SetBeamNSMass10ID(uID, barId, loadCaseId, dlType, globalDistMassCount + 1, values); if (!St7ErrorCustom(err, "Couldn't set a distributed beam load for a loadcase " + loadCaseId + " beam " + barId)) { return(false); } } } return(true); }
private List <ILoad> ReadBarDistributedLoad(List <Loadcase> loadcases) { int err = 0; Dictionary <int, Loadcase> lcDict = loadcases.ToDictionary(x => GetAdapterId <int>(x)); List <ILoad> bhLoads = new List <ILoad>(); List <Bar> allBars = ReadBars(); foreach (Bar bar in allBars) { double length = BH.Engine.Geometry.Query.Length(BH.Engine.Structure.Query.Centreline(bar)); int barId = GetAdapterId <int>(bar); // global Distributed Forces int globalDistForceCount = 0; err = St7.St7GetEntityAttributeSequenceCount(1, St7.tyBEAM, barId, St7.aoBeamDLG, ref globalDistForceCount); if (globalDistForceCount > 0) { // getting load IDs and direction int[] sequenceNumbers = new int[globalDistForceCount * 4]; err = St7.St7GetEntityAttributeSequence(1, St7.tyBEAM, barId, St7.aoBeamDLG, globalDistForceCount, sequenceNumbers); for (int i = 0; i < globalDistForceCount; i++) { int loadCaseNum = sequenceNumbers[4 * i + St7.ipAttrCase]; int loadDir = sequenceNumbers[4 * i + St7.ipAttrAxis]; int loadID = sequenceNumbers[4 * i + St7.ipAttrID]; double loadX = loadDir == 1 ? 1 : 0; double loadY = loadDir == 2 ? 1 : 0; double loadZ = loadDir == 3 ? 1 : 0; int projected = 0; int distributionType = 0; double[] forcesG = new double[6]; err = St7.St7GetBeamDistributedForceGlobal6ID(1, barId, loadDir, loadCaseNum, loadID, ref projected, ref distributionType, forcesG); // adding load case, object information to loads bhLoads.AddRange(DistributedBarLoadsFromSt7(loadX, loadY, loadZ, distributionType, length, forcesG, new double[6], lcDict[loadCaseNum], bar, projected == St7.bpProjected, LoadAxis.Global)); } } // principal Distributed Forces int principalDistForceCount = 0; err = St7.St7GetEntityAttributeSequenceCount(1, St7.tyBEAM, barId, St7.aoBeamDLL, ref principalDistForceCount); if (principalDistForceCount > 0) { // getting load IDs and direction int[] sequenceNumbers = new int[principalDistForceCount * 4]; err = St7.St7GetEntityAttributeSequence(1, St7.tyBEAM, barId, St7.aoBeamDLL, principalDistForceCount, sequenceNumbers); for (int i = 0; i < principalDistForceCount; i++) { int loadCaseNum = sequenceNumbers[4 * i + St7.ipAttrCase]; int loadDir = sequenceNumbers[4 * i + St7.ipAttrAxis]; int loadID = sequenceNumbers[4 * i + St7.ipAttrID]; double loadX = loadDir == 1 ? 1 : 0; double loadY = loadDir == 2 ? 1 : 0; double loadZ = loadDir == 3 ? 1 : 0; int distributionType = 0; double[] forcesP = new double[6]; err = St7.St7GetBeamDistributedForcePrincipal6ID(1, barId, loadDir, loadCaseNum, loadID, ref distributionType, forcesP); bhLoads.AddRange(DistributedBarLoadsFromSt7(loadX, loadY, loadZ, distributionType, length, forcesP, new double[6], lcDict[loadCaseNum], bar, false, LoadAxis.Local)); } } // principal Distributed Moments int principalDistMomentCount = 0; err = St7.St7GetEntityAttributeSequenceCount(1, St7.tyBEAM, barId, St7.aoBeamDML, ref principalDistMomentCount); if (principalDistMomentCount > 0) { // getting load IDs and direction int[] sequenceNumbers = new int[principalDistMomentCount * 4]; err = St7.St7GetEntityAttributeSequence(1, St7.tyBEAM, barId, St7.aoBeamDML, principalDistMomentCount, sequenceNumbers); for (int i = 0; i < principalDistMomentCount; i++) { int loadCaseNum = sequenceNumbers[4 * i + St7.ipAttrCase]; int loadDir = sequenceNumbers[4 * i + St7.ipAttrAxis]; int loadID = sequenceNumbers[4 * i + St7.ipAttrID]; double loadX = loadDir == 1 ? 1 : 0; double loadY = loadDir == 2 ? 1 : 0; double loadZ = loadDir == 3 ? 1 : 0; int distributionType = 0; double[] momentsP = new double[6]; err = St7.St7GetBeamDistributedMomentPrincipal6ID(1, barId, loadDir, loadCaseNum, loadID, ref distributionType, momentsP); bhLoads.AddRange(DistributedBarLoadsFromSt7(loadX, loadY, loadZ, distributionType, length, new double[6], momentsP, lcDict[loadCaseNum], bar, false, LoadAxis.Local)); } } } return(bhLoads); }
/***************************************************/ /**** Private methods ****/ /***************************************************/ private bool CreateObject(BarPointLoad barPointLoad) { int err = 0; int uID = 1; int loadCaseId = GetAdapterId <int>(barPointLoad.Loadcase); // *************************** GLOBAL *************************** if (barPointLoad.Axis == LoadAxis.Global) { foreach (Bar bar in barPointLoad.Objects.Elements) { double length = BH.Engine.Geometry.Query.Length(BH.Engine.Structure.Query.Centreline(bar)); int barId = GetAdapterId <int>(bar); // creating global Point Forces if (BH.Engine.Geometry.Query.Length(barPointLoad.Force) > 0) { // get number of global point forces at the beam int globalPointForceCount = 0; err = St7.St7GetEntityAttributeSequenceCount(uID, St7.tyBEAM, barId, St7.aoBeamCFG, ref globalPointForceCount); if (!St7ErrorCustom(err, "Couldn't get a number of global point beam loads for a loadcase " + loadCaseId + " beam " + barId)) { return(false); } double[] forces = new double[4]; forces[0] = barPointLoad.Force.X; forces[1] = barPointLoad.Force.Y; forces[2] = barPointLoad.Force.Z; forces[3] = barPointLoad.DistanceFromA / length; err = St7.St7SetBeamPointForceGlobal4ID(uID, barId, loadCaseId, globalPointForceCount + 1, forces); if (!St7ErrorCustom(err, "Couldn't set global point beam loads for a loadcase " + loadCaseId + " beam " + barId)) { return(false); } } // creating global Point Moments if (BH.Engine.Geometry.Query.Length(barPointLoad.Moment) > 0) { // get number of global point moments at the beam int globalPointMomentCount = 0; err = St7.St7GetEntityAttributeSequenceCount(uID, St7.tyBEAM, barId, St7.aoBeamCMG, ref globalPointMomentCount); if (!St7ErrorCustom(err, "Couldn't get a number of global point beam moments for a loadcase " + loadCaseId + " beam " + barId)) { return(false); } double[] moments = new double[4]; moments[0] = barPointLoad.Moment.X; moments[1] = barPointLoad.Moment.Y; moments[2] = barPointLoad.Moment.Z; moments[3] = barPointLoad.DistanceFromA / length; err = St7.St7SetBeamPointMomentGlobal4ID(uID, barId, loadCaseId, globalPointMomentCount + 1, moments); if (!St7ErrorCustom(err, "Couldn't set global point beam moments for a loadcase " + loadCaseId + " beam " + barId)) { return(false); } } } } // *************************** LOCAL **************************** if (barPointLoad.Axis == LoadAxis.Local) { foreach (Bar bar in barPointLoad.Objects.Elements) { double length = BH.Engine.Geometry.Query.Length(BH.Engine.Structure.Query.Centreline(bar)); int barId = GetAdapterId <int>(bar); if (BH.Engine.Geometry.Query.Length(barPointLoad.Force) > 0) { // get number of local point forces at the beam int localPointForceCount = 0; err = St7.St7GetEntityAttributeSequenceCount(uID, St7.tyBEAM, barId, St7.aoBeamCFL, ref localPointForceCount); if (!St7ErrorCustom(err, "Couldn't get a number of local point beam loads for a loadcase " + loadCaseId + " beam " + barId)) { return(false); } double[] forces = new double[4]; forces[0] = barPointLoad.Force.X; forces[1] = barPointLoad.Force.Y; forces[2] = barPointLoad.Force.Z; forces[3] = barPointLoad.DistanceFromA / length; err = St7.St7SetBeamPointForcePrincipal4ID(uID, barId, loadCaseId, localPointForceCount + 1, forces); if (!St7ErrorCustom(err, "Couldn't set local point beam loads for a loadcase " + loadCaseId + " beam " + barId)) { return(false); } } // creating global Point Moments if (BH.Engine.Geometry.Query.Length(barPointLoad.Moment) > 0) { // get number of local point moments at the beam int localPointMomentCount = 0; err = St7.St7GetEntityAttributeSequenceCount(uID, St7.tyBEAM, barId, St7.aoBeamCML, ref localPointMomentCount); if (!St7ErrorCustom(err, "Couldn't get a number of local point beam moments for a loadcase " + loadCaseId + " beam " + barId)) { return(false); } double[] moments = new double[4]; moments[0] = barPointLoad.Moment.X; moments[1] = barPointLoad.Moment.Y; moments[2] = barPointLoad.Moment.Z; moments[3] = barPointLoad.DistanceFromA / length; err = St7.St7SetBeamPointMomentPrincipal4ID(uID, barId, loadCaseId, localPointMomentCount + 1, moments); if (!St7ErrorCustom(err, "Couldn't set local point beam moments for a loadcase " + loadCaseId + " beam " + barId)) { return(false); } } } } return(true); }
private List <ILoad> ReadBarPointLoad(List <Loadcase> loadcases) { int err = 0; Dictionary <int, Loadcase> lcDict = loadcases.ToDictionary(x => GetAdapterId <int>(x)); List <ILoad> bhLoads = new List <ILoad>(); List <Bar> allBars = ReadBars(); foreach (Bar bar in allBars) { double length = BH.Engine.Geometry.Query.Length(BH.Engine.Structure.Query.Centreline(bar)); int barId = GetAdapterId <int>(bar); // ***************** try to get point forces first ************************ // ****************************** global ********************************** int globalPointForceCount = 0; err = St7.St7GetEntityAttributeSequenceCount(1, St7.tyBEAM, barId, St7.aoBeamCFG, ref globalPointForceCount); if (globalPointForceCount > 0) { // getting load IDs int[] sequenceNumbers = new int[globalPointForceCount * 4]; err = St7.St7GetEntityAttributeSequence(1, St7.tyBEAM, barId, St7.aoBeamCFG, globalPointForceCount, sequenceNumbers); for (int i = 0; i < globalPointForceCount; i++) { int loadCaseNum = sequenceNumbers[4 * i + St7.ipAttrCase]; int loadID = sequenceNumbers[4 * i + St7.ipAttrID]; double[] forcesG = new double[4]; err = St7.St7GetBeamPointForceGlobal4ID(1, barId, loadCaseNum, loadID, forcesG); if (!IsZeroSqLength(forcesG)) { BarPointLoad bhLoad = new BarPointLoad() { DistanceFromA = length * forcesG[3], Force = new Vector() { X = forcesG[0], Y = forcesG[1], Z = forcesG[2] }, Loadcase = lcDict[loadCaseNum], Projected = false, Axis = LoadAxis.Global, Objects = new BHoMGroup <Bar>() { Elements = { bar } } }; bhLoads.Add(bhLoad); } } } int globalPointMomentCount = 0; err = St7.St7GetEntityAttributeSequenceCount(1, St7.tyBEAM, barId, St7.aoBeamCMG, ref globalPointMomentCount); if (globalPointMomentCount > 0) { // getting load IDs int[] sequenceNumbers = new int[globalPointMomentCount * 4]; err = St7.St7GetEntityAttributeSequence(1, St7.tyBEAM, barId, St7.aoBeamCMG, globalPointMomentCount, sequenceNumbers); for (int i = 0; i < globalPointMomentCount; i++) { int loadCaseNum = sequenceNumbers[4 * i + St7.ipAttrCase]; int loadID = sequenceNumbers[4 * i + St7.ipAttrID]; double[] momentsG = new double[4]; err = St7.St7GetBeamPointMomentGlobal4ID(1, barId, loadCaseNum, loadID, momentsG); if (!IsZeroSqLength(momentsG)) { BarPointLoad bhLoad = new BarPointLoad() { DistanceFromA = length * momentsG[3], Moment = new Vector() { X = momentsG[0], Y = momentsG[1], Z = momentsG[2] }, Loadcase = lcDict[loadCaseNum], Projected = false, Axis = LoadAxis.Global, Objects = new BHoMGroup <Bar>() { Elements = { bar } } }; bhLoads.Add(bhLoad); } } } // ****************************** principal ********************************** int principalPointForceCount = 0; err = St7.St7GetEntityAttributeSequenceCount(1, St7.tyBEAM, barId, St7.aoBeamCFL, ref principalPointForceCount); if (principalPointForceCount > 0) { // getting load IDs int[] sequenceNumbers = new int[principalPointForceCount * 4]; err = St7.St7GetEntityAttributeSequence(1, St7.tyBEAM, barId, St7.aoBeamCFL, principalPointForceCount, sequenceNumbers); for (int i = 0; i < principalPointForceCount; i++) { int loadCaseNum = sequenceNumbers[4 * i + St7.ipAttrCase]; int loadID = sequenceNumbers[4 * i + St7.ipAttrID]; double[] forcesP = new double[4]; err = St7.St7GetBeamPointForcePrincipal4ID(1, barId, loadCaseNum, loadID, forcesP); if (!IsZeroSqLength(forcesP)) { BarPointLoad bhLoad = new BarPointLoad() { DistanceFromA = length * forcesP[3], //Force = BH.Engine.Geometry.Modify.Transform(new Vector() { X = forcesP[0], Y = forcesP[1], Z = forcesP[2] }, transformMatrix), Force = new Vector() { X = forcesP[0], Y = forcesP[1], Z = forcesP[2] }, Loadcase = lcDict[loadCaseNum], Projected = false, Axis = LoadAxis.Local, Objects = new BHoMGroup <Bar>() { Elements = { bar } } }; bhLoads.Add(bhLoad); } } } int principalPointMomentCount = 0; err = St7.St7GetEntityAttributeSequenceCount(1, St7.tyBEAM, barId, St7.aoBeamCML, ref principalPointMomentCount); if (principalPointMomentCount > 0) { // getting load IDs int[] sequenceNumbers = new int[principalPointMomentCount * 4]; err = St7.St7GetEntityAttributeSequence(1, St7.tyBEAM, barId, St7.aoBeamCML, principalPointMomentCount, sequenceNumbers); for (int i = 0; i < principalPointMomentCount; i++) { int loadCaseNum = sequenceNumbers[4 * i + St7.ipAttrCase]; int loadID = sequenceNumbers[4 * i + St7.ipAttrID]; double[] momentsP = new double[4]; err = St7.St7GetBeamPointMomentPrincipal4ID(1, barId, loadCaseNum, loadID, momentsP); if (!IsZeroSqLength(momentsP)) { BarPointLoad bhLoad = new BarPointLoad() { DistanceFromA = length * momentsP[3], //Moment = BH.Engine.Geometry.Modify.Transform(new Vector() { X = momentsP[0], Y = momentsP[1], Z = momentsP[2] }, transformMatrix), Moment = new Vector() { X = momentsP[0], Y = momentsP[1], Z = momentsP[2] }, Projected = false, Axis = LoadAxis.Local, Loadcase = lcDict[loadCaseNum], Objects = new BHoMGroup <Bar>() { Elements = { bar } } }; bhLoads.Add(bhLoad); } } } } return(bhLoads); }
/***************************************************/ /**** Private methods ****/ /***************************************************/ private bool CreateObject(BarVaryingDistributedLoad distributedLoad) { int err = 0; int uID = 1; double tol = 0.001; int loadCaseId = GetAdapterId <int>(distributedLoad.Loadcase); // *************************** GLOBAL DISTRIBUTED *************************** if (distributedLoad.Axis == LoadAxis.Global) { foreach (Bar bar in distributedLoad.Objects.Elements) { double length = BH.Engine.Geometry.Query.Length(BH.Engine.Structure.Query.Centreline(bar)); int barId = GetAdapterId <int>(bar); if (BH.Engine.Geometry.Query.SquareLength(distributedLoad.ForceAtStart) > 0 || BH.Engine.Geometry.Query.SquareLength(distributedLoad.ForceAtEnd) > 0) { int dlType = St7.dlLinear; int projected = distributedLoad.Projected ? St7.bpProjected : St7.bpNone; // setting different directions if (Math.Abs(distributedLoad.ForceAtStart.X) > tol || Math.Abs(distributedLoad.ForceAtEnd.X) > tol) { int beamDir = 1; double[] values = new double[6]; values[0] = distributedLoad.ForceAtStart.X; values[1] = distributedLoad.ForceAtEnd.X; values[4] = distributedLoad.StartPosition / length; values[5] = distributedLoad.EndPosition / length; int globalDistForceCount = 0; err = St7.St7GetEntityAttributeSequenceCount(uID, St7.tyBEAM, barId, St7.aoBeamDLG, ref globalDistForceCount); if (!St7ErrorCustom(err, "Couldn't get a number of global distributed beam loads for a loadcase " + loadCaseId + " beam " + barId)) { return(false); } err = St7.St7SetBeamDistributedForceGlobal6ID(uID, barId, beamDir, projected, loadCaseId, dlType, globalDistForceCount + 1, values); if (!St7ErrorCustom(err, "Couldn't set a distributed beam load for a loadcase " + loadCaseId + " beam " + barId)) { return(false); } } if (Math.Abs(distributedLoad.ForceAtStart.Y) > tol || Math.Abs(distributedLoad.ForceAtEnd.Y) > tol) { int beamDir = 2; double[] values = new double[6]; values[0] = distributedLoad.ForceAtStart.Y; values[1] = distributedLoad.ForceAtEnd.Y; values[4] = distributedLoad.StartPosition / length; values[5] = distributedLoad.EndPosition / length; int globalDistForceCount = 0; err = St7.St7GetEntityAttributeSequenceCount(uID, St7.tyBEAM, barId, St7.aoBeamDLG, ref globalDistForceCount); if (!St7ErrorCustom(err, "Couldn't get a number of global distributed beam loads for a loadcase " + loadCaseId + " beam " + barId)) { return(false); } err = St7.St7SetBeamDistributedForceGlobal6ID(uID, barId, beamDir, projected, loadCaseId, dlType, globalDistForceCount + 1, values); if (!St7ErrorCustom(err, "Couldn't set a distributed beam load for a loadcase " + loadCaseId + " beam " + barId)) { return(false); } } if (Math.Abs(distributedLoad.ForceAtStart.Z) > tol || Math.Abs(distributedLoad.ForceAtEnd.Z) > tol) { int beamDir = 3; double[] values = new double[6]; values[0] = distributedLoad.ForceAtStart.Z; values[1] = distributedLoad.ForceAtEnd.Z; values[4] = distributedLoad.StartPosition / length; values[5] = distributedLoad.EndPosition / length; int globalDistForceCount = 0; err = St7.St7GetEntityAttributeSequenceCount(uID, St7.tyBEAM, barId, St7.aoBeamDLG, ref globalDistForceCount); if (!St7ErrorCustom(err, "Couldn't get a number of global distributed beam loads for a loadcase " + loadCaseId + " beam " + barId)) { return(false); } err = St7.St7SetBeamDistributedForceGlobal6ID(uID, barId, beamDir, projected, loadCaseId, dlType, globalDistForceCount + 1, values); if (!St7ErrorCustom(err, "Couldn't set a distributed beam load for a loadcase " + loadCaseId + " beam " + barId)) { return(false); } } } } } // *************************** PRINCIPAL DISTRIBUTED *************************** if (distributedLoad.Axis == LoadAxis.Local) { foreach (Bar bar in distributedLoad.Objects.Elements) { // get a principal coordinate system first int barId = GetAdapterId <int>(bar); double length = BH.Engine.Geometry.Query.Length(BH.Engine.Structure.Query.Centreline(bar)); // ******************************* FORCES ********************************** if (BH.Engine.Geometry.Query.SquareLength(distributedLoad.ForceAtStart) > 0 || BH.Engine.Geometry.Query.SquareLength(distributedLoad.ForceAtEnd) > 0) { int dlType = St7.dlLinear; // setting different directions if (Math.Abs(distributedLoad.ForceAtStart.X) > tol || Math.Abs(distributedLoad.ForceAtEnd.X) > tol) { int beamDir = 1; double[] values = new double[6]; values[0] = distributedLoad.ForceAtStart.X; values[1] = distributedLoad.ForceAtEnd.X; values[4] = distributedLoad.StartPosition / length; values[5] = distributedLoad.EndPosition / length; int localDistForceCount = 0; err = St7.St7GetEntityAttributeSequenceCount(uID, St7.tyBEAM, barId, St7.aoBeamDLL, ref localDistForceCount); if (!St7ErrorCustom(err, "Couldn't get a number of principal distributed beam loads for a loadcase " + loadCaseId + " beam " + barId)) { return(false); } err = St7.St7SetBeamDistributedForcePrincipal6ID(uID, barId, beamDir, loadCaseId, dlType, localDistForceCount + 1, values); if (!St7ErrorCustom(err, "Couldn't set a distributed beam load for a loadcase " + loadCaseId + " beam " + barId)) { return(false); } } if (Math.Abs(distributedLoad.ForceAtStart.Y) > tol || Math.Abs(distributedLoad.ForceAtEnd.Y) > tol) { int beamDir = 2; double[] values = new double[6]; values[0] = distributedLoad.ForceAtStart.Y; values[1] = distributedLoad.ForceAtEnd.Y; values[4] = distributedLoad.StartPosition / length; values[5] = distributedLoad.EndPosition / length; int localDistForceCount = 0; err = St7.St7GetEntityAttributeSequenceCount(uID, St7.tyBEAM, barId, St7.aoBeamDLL, ref localDistForceCount); if (!St7ErrorCustom(err, "Couldn't get a number of principal distributed beam loads for a loadcase " + loadCaseId + " beam " + barId)) { return(false); } err = St7.St7SetBeamDistributedForcePrincipal6ID(uID, barId, beamDir, loadCaseId, dlType, localDistForceCount + 1, values); if (!St7ErrorCustom(err, "Couldn't set a distributed beam load for a loadcase " + loadCaseId + " beam " + barId)) { return(false); } } if (Math.Abs(distributedLoad.ForceAtStart.Z) > tol || Math.Abs(distributedLoad.ForceAtEnd.Z) > tol) { int beamDir = 3; double[] values = new double[6]; values[0] = distributedLoad.ForceAtStart.Z; values[1] = distributedLoad.ForceAtEnd.Z; values[4] = distributedLoad.StartPosition / length; values[5] = distributedLoad.EndPosition / length; int localDistForceCount = 0; err = St7.St7GetEntityAttributeSequenceCount(uID, St7.tyBEAM, barId, St7.aoBeamDLL, ref localDistForceCount); if (!St7ErrorCustom(err, "Couldn't get a number of principal distributed beam loads for a loadcase " + loadCaseId + " beam " + barId)) { return(false); } err = St7.St7SetBeamDistributedForcePrincipal6ID(uID, barId, beamDir, loadCaseId, dlType, localDistForceCount + 1, values); if (!St7ErrorCustom(err, "Couldn't set a distributed beam load for a loadcase " + loadCaseId + " beam " + barId)) { return(false); } } } // ******************************* MOMENTS ********************************** if (BH.Engine.Geometry.Query.SquareLength(distributedLoad.MomentAtStart) > 0 || BH.Engine.Geometry.Query.SquareLength(distributedLoad.MomentAtEnd) > 0) { int dlType = St7.dlLinear; // setting different directions if (Math.Abs(distributedLoad.MomentAtStart.X) > tol || Math.Abs(distributedLoad.MomentAtEnd.X) > tol) { int beamDir = 1; double[] values = new double[6]; values[0] = distributedLoad.MomentAtStart.X; values[1] = distributedLoad.MomentAtEnd.X; values[4] = distributedLoad.StartPosition / length; values[5] = distributedLoad.EndPosition / length; int localDistMomentCount = 0; err = St7.St7GetEntityAttributeSequenceCount(uID, St7.tyBEAM, barId, St7.aoBeamDML, ref localDistMomentCount); if (!St7ErrorCustom(err, "Couldn't get a number of principal distributed beam moments for a loadcase " + loadCaseId + " beam " + barId)) { return(false); } err = St7.St7SetBeamDistributedMomentPrincipal6ID(uID, barId, beamDir, loadCaseId, dlType, localDistMomentCount + 1, values); if (!St7ErrorCustom(err, "Couldn't set a distributed beam moments for a loadcase " + loadCaseId + " beam " + barId)) { return(false); } } if (Math.Abs(distributedLoad.MomentAtStart.Y) > tol || Math.Abs(distributedLoad.MomentAtEnd.Y) > tol) { int beamDir = 2; double[] values = new double[6]; values[0] = distributedLoad.MomentAtStart.Y; values[1] = distributedLoad.MomentAtEnd.Y; values[4] = distributedLoad.StartPosition / length; values[5] = distributedLoad.EndPosition / length; int localDistMomentCount = 0; err = St7.St7GetEntityAttributeSequenceCount(uID, St7.tyBEAM, barId, St7.aoBeamDML, ref localDistMomentCount); if (!St7ErrorCustom(err, "Couldn't get a number of principal distributed beam loads for a loadcase " + loadCaseId + " beam " + barId)) { return(false); } err = St7.St7SetBeamDistributedMomentPrincipal6ID(uID, barId, beamDir, loadCaseId, dlType, localDistMomentCount + 1, values); if (!St7ErrorCustom(err, "Couldn't set a distributed beam moments for a loadcase " + loadCaseId + " beam " + barId)) { return(false); } } if (Math.Abs(distributedLoad.MomentAtStart.Z) > tol || Math.Abs(distributedLoad.MomentAtEnd.Z) > tol) { int beamDir = 3; double[] values = new double[6]; values[0] = distributedLoad.MomentAtStart.Z; values[1] = distributedLoad.MomentAtEnd.Z; values[4] = distributedLoad.StartPosition / length; values[5] = distributedLoad.EndPosition / length; int localDistMomentCount = 0; err = St7.St7GetEntityAttributeSequenceCount(uID, St7.tyBEAM, barId, St7.aoBeamDML, ref localDistMomentCount); if (!St7ErrorCustom(err, "Couldn't get a number of principal distributed beam moments for a loadcase " + loadCaseId + " beam " + barId)) { return(false); } err = St7.St7SetBeamDistributedMomentPrincipal6ID(uID, barId, beamDir, loadCaseId, dlType, localDistMomentCount + 1, values); if (!St7ErrorCustom(err, "Couldn't set a distributed beam moments for a loadcase " + loadCaseId + " beam " + barId)) { return(false); } } } } } return(true); }