/// <summary> /// Internal constructor. /// </summary> public FictitiousBar(Geometry.Edge edge, Geometry.FdVector3d localY, Bars.Connectivity startConnectivity, Bars.Connectivity endConnectivity, string name, double ae, double itg, double i1e, double i2e) { this.EntityCreated(); this.Edge = edge; this.LocalY = localY; this.StartConnectivity = startConnectivity; this.EndConnectivity = endConnectivity; this.Name = name; this.AE = ae; this.ItG = itg; this.I1E = i1e; this.I2E = i2e; }
protected override void SolveInstance(IGH_DataAccess DA) { // get indata bool mx = false, my = false, mz = false, rx = false, ry = false, rz = false; double mxRelease = 0, myRelease = 0, mzRelease = 0, rxRelease = 0, ryRelease = 0, rzRelease = 0; if (!DA.GetData(0, ref mxRelease)) { mx = true; } if (!DA.GetData(1, ref myRelease)) { my = true; } if (!DA.GetData(2, ref mzRelease)) { mz = true; } if (!DA.GetData(3, ref rxRelease)) { rx = true; } if (!DA.GetData(4, ref ryRelease)) { ry = true; } if (!DA.GetData(5, ref rzRelease)) { rz = true; } // connectivity FemDesign.Bars.Connectivity obj = new Bars.Connectivity(mx, my, mz, rx, ry, rz, mxRelease, myRelease, mzRelease, rxRelease, ryRelease, rzRelease); // return DA.SetData(0, obj); }
protected override void SolveInstance(IGH_DataAccess DA) { // get input Curve curve = null; if (!DA.GetData(0, ref curve)) { return; } double stiffness = 1E7; double ae = stiffness; if (!DA.GetData(1, ref ae)) { // pass } double itg = stiffness; if (!DA.GetData(2, ref itg)) { // pass } double i1e = stiffness; if (!DA.GetData(3, ref i1e)) { // pass } double i2e = stiffness; if (!DA.GetData(4, ref i2e)) { // pass } Bars.Connectivity startConnectivity = Bars.Connectivity.GetDefault(); Bars.Connectivity endConnectivity = Bars.Connectivity.GetDefault(); List <Bars.Connectivity> connectivity = new List <Bars.Connectivity>(); if (!DA.GetDataList(5, connectivity)) { // pass } else { if (connectivity.Count == 1) { startConnectivity = connectivity[0]; endConnectivity = connectivity[0]; } else if (connectivity.Count == 2) { startConnectivity = connectivity[0]; endConnectivity = connectivity[1]; } else { throw new System.ArgumentException($"Connectivity must contain 1 or 2 items. Number of items is {connectivity.Count}"); } } Vector3d v = Vector3d.Zero; if (!DA.GetData(6, ref v)) { // pass } bool orientLCS = true; if (!DA.GetData(7, ref orientLCS)) { // pass } string name = "BF"; if (!DA.GetData(8, ref name)) { // pass } if (curve == null || startConnectivity == null || endConnectivity == null || v == null || name == null) { return; } // convert geometry Geometry.Edge edge = curve.FromRhinoLineOrArc2(); // create virtual bar ModellingTools.FictitiousBar bar = new ModellingTools.FictitiousBar(edge, edge.CoordinateSystem.LocalY, startConnectivity, endConnectivity, name, ae, itg, i1e, i2e); // set local y-axis if (!v.Equals(Vector3d.Zero)) { bar.LocalY = v.FromRhino(); } // else orient coordinate system to GCS else { if (orientLCS) { bar.OrientCoordinateSystemToGCS(); } } // output DA.SetData(0, bar); }