protected override void SolveInstance(IGH_DataAccess DA) { Point3d point = Point3d.Unset; string pattern = ""; Vector3d force = Vector3d.Unset; Vector3d moment = Vector3d.Unset; if (!DA.GetData(0, ref point)) { return; } if (!DA.GetData(1, ref pattern)) { return; } DA.GetData(2, ref force); DA.GetData(3, ref moment); string modelUnit = Rhino.RhinoDoc.ActiveDoc.ModelUnitSystem.ToString(); sRhinoConverter rhcon = new sRhinoConverter(modelUnit, "Meters"); int count = 0; sPointLoad pl = new sPointLoad(); pl.location = rhcon.TosXYZ(rhcon.EnsureUnit(point)); pl.loadPatternName = pattern; if (force != Vector3d.Unset) { pl.forceVector = rhcon.TosXYZ(force); count++; } if (moment != Vector3d.Unset) { pl.momentVector = rhcon.TosXYZ(moment); count++; } if (count > 0) { DA.SetData(0, rhcon.EnsureUnit(pl)); } else { DA.SetData(0, null); } }
protected override void SolveInstance(IGH_DataAccess DA) { List <IFrameSet> bsets = new List <IFrameSet>(); double tol = 0.005; if (!DA.GetDataList(0, bsets)) { return; } if (!DA.GetData(1, ref tol)) { return; } sFixity fxS = null; sFixity fxE = null; if (fixType == eFixityType.MOMENTREALESED_START) { fxS = new sFixity(); fxS.release = new bool[6] { true, true, true, false, false, false }; } else if (fixType == eFixityType.MOMENTREALESED_END) { fxE = new sFixity(); fxE.release = new bool[6] { true, true, true, false, false, false }; } else if (fixType == eFixityType.MOMENTREALESED_BOTH) { fxS = new sFixity(); fxS.release = new bool[6] { true, true, true, false, false, false }; fxE = new sFixity(); fxE.release = new bool[6] { true, true, true, true, false, false }; } else if (fixType == eFixityType.FIXITIES_BY_DOF) { List <bool> sss = new List <bool>(); List <bool> eee = new List <bool>(); if (!DA.GetDataList(2, sss)) { return; } if (!DA.GetDataList(3, eee)) { return; } bool[] fixedSet = new bool[6] { true, true, true, true, true, true }; if (sss.Count != 6) { sss = fixedSet.ToList(); } if (eee.Count != 6) { eee = fixedSet.ToList(); } fxS = new sFixity(); fxS.release = sss.ToArray(); fxE = new sFixity(); fxE.release = eee.ToArray(); } else if (fixType == eFixityType.FULLY_FIXED) { fxS = null; fxE = null; } string modelUnit = Rhino.RhinoDoc.ActiveDoc.ModelUnitSystem.ToString(); sRhinoConverter rhcon = new sRhinoConverter(modelUnit, "Meters"); sRhinoConverter rhcon_ToRhinoModel = new sRhinoConverter("Meters", modelUnit); if (modelUnit == "Feet") { tol = 0.015; } List <IFrameSet> duplicated = new List <IFrameSet>(); List <Point3d> locsStart = new List <Point3d>(); List <Point3d> locsEnd = new List <Point3d>(); foreach (IFrameSet bso in bsets) { IFrameSet bs = bso.DuplicatesFrameSet(); bs.ResetFixities(); if (bs.parentSegments.Count > 0) { if (fxS != null) { bs.segmentFixitiesAtStart = new List <sFixity>(); } if (fxE != null) { bs.segmentFixitiesAtEnd = new List <sFixity>(); } foreach (sCurve segc in bs.parentSegments) { Curve segrc = rhcon.ToRhinoCurve(segc); if (fxS != null) { fxS.location = rhcon.TosXYZ(segrc.PointAtStart); if (fxS.IsOnLocation(bs.associatedLocations, tol) == false) { bs.segmentFixitiesAtStart.Add(fxS.DuplicatesFixity()); } } if (fxE != null) { fxE.location = rhcon.TosXYZ(segrc.PointAtEnd); if (fxE.IsOnLocation(bs.associatedLocations, tol) == false) { bs.segmentFixitiesAtEnd.Add(fxE.DuplicatesFixity()); } } } bs.AwareElementFixitiesBySegementFixities(tol); } else { Curve rc = rhcon.ToRhinoCurve(bs.parentCrv); if (fxS != null && bs.parentFixityAtStart == null) { fxS.location = rhcon.TosXYZ(rc.PointAtStart); if (fxS.IsOnLocation(bs.associatedLocations, tol) == false) { bs.parentFixityAtStart = fxS.DuplicatesFixity(); } } if (fxE != null && bs.parentFixityAtEnd == null) { fxE.location = rhcon.TosXYZ(rc.PointAtEnd); if (fxE.IsOnLocation(bs.associatedLocations, tol) == false) { bs.parentFixityAtEnd = fxE.DuplicatesFixity(); } } bs.AwareElementsFixitiesByParentFixity(tol); } duplicated.Add(bs); } foreach (IFrameSet bs in duplicated) { if (bs.frames.Count == 0) { Curve rc = rhcon_ToRhinoModel.EnsureUnit(rhcon.ToRhinoCurve(bs.parentCrv)); if (bs.parentFixityAtStart != null) { locsStart.Add(rc.PointAtNormalizedLength(0.025)); } if (bs.parentFixityAtEnd != null) { locsEnd.Add(rc.PointAtNormalizedLength(0.975)); } } else { foreach (sFrame sb in bs.frames) { if (sb.fixityAtStart != null) { locsStart.Add(rhcon_ToRhinoModel.EnsureUnit(rhcon.ToRhinoPoint3d(sb.axis.PointAt(0.1)))); } if (sb.fixityAtEnd != null) { locsEnd.Add(rhcon_ToRhinoModel.EnsureUnit(rhcon.ToRhinoPoint3d(sb.axis.PointAt(0.9)))); } } } } this.Message = fixType.ToString(); DA.SetDataList(0, duplicated); DA.SetDataList(1, locsStart); DA.SetDataList(2, locsEnd); }
protected override void SolveInstance(IGH_DataAccess DA) { List <IFrameSet> beamsets = new List <IFrameSet>(); List <Vector3d> upvectors = new List <Vector3d>(); if (!DA.GetDataList(0, beamsets)) { return; } if (!DA.GetDataList(1, upvectors)) { return; } string modelUnit = Rhino.RhinoDoc.ActiveDoc.ModelUnitSystem.ToString(); sRhinoConverter rhcon = new sRhinoConverter(modelUnit, "Meters"); sRhinoConverter rhcon_ToRhinoModel = new sRhinoConverter("Meters", modelUnit); List <IFrameSet> duplicated = new List <IFrameSet>(); List <Point3d> pts = new List <Point3d>(); List <Vector3d> vecs = new List <Vector3d>(); this.Message = ""; int nonSegCount = 0; if (upvectors.Count == beamsets.Count) { for (int i = 0; i < beamsets.Count; ++i) { if (beamsets[i].frames.Count > 0) { sXYZ upvecThis = rhcon.TosXYZ(upvectors[i]); IFrameSet dubs = beamsets[i].DuplicatesFrameSet(); dubs.EnsureBeamElement(); foreach (sFrame sb in dubs.frames) { sb.AwareLocalPlane(upvecThis); pts.Add(rhcon_ToRhinoModel.EnsureUnit(rhcon.ToRhinoPoint3d(sb.axis.PointAt(0.5)))); vecs.Add(rhcon.ToRhinoVector3d(sb.upVector)); } duplicated.Add(dubs); } else { nonSegCount++; } } } else if (upvectors.Count == 1) { foreach (IFrameSet bs in beamsets) { if (bs.frames.Count > 0) { IFrameSet dubs = bs.DuplicatesFrameSet(); dubs.EnsureBeamElement(); foreach (sFrame sb in dubs.frames) { sb.AwareLocalPlane(rhcon.TosXYZ(upvectors[0])); pts.Add(rhcon_ToRhinoModel.EnsureUnit(rhcon.ToRhinoPoint3d(sb.axis.PointAt(0.5)))); vecs.Add(rhcon.ToRhinoVector3d(sb.upVector)); } duplicated.Add(dubs); } else { nonSegCount++; } } } else { this.Message = ""; return; } if (nonSegCount == 0) { DA.SetDataList(0, duplicated); DA.SetDataList(1, pts); DA.SetDataList(2, vecs); } else { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Segmentize Beam Set First To Assign Upvectors"); //this.Message = "Segmentize Beam Set First To Assign Upvectors"; } }
protected override void SolveInstance(IGH_DataAccess DA) { string patternName = ""; List <Vector3d> forceVectors = new List <Vector3d>(); if (!DA.GetData(0, ref patternName)) { return; } if (!DA.GetDataList(1, forceVectors)) { return; } string modelUnit = Rhino.RhinoDoc.ActiveDoc.ModelUnitSystem.ToString(); sRhinoConverter rhcon = new sRhinoConverter(modelUnit, "Meters"); object outobj = null; if (forceVectors.Count == 1) { sLineLoad l_before = new sLineLoad(patternName, eLoadType.DistributedLoad, true, rhcon.TosXYZ(forceVectors[0])); outobj = rhcon.EnsureUnit(l_before); } else if (forceVectors.Count > 1) { sLineLoadGroup lg = new sLineLoadGroup(); lg.loads = new List <sLineLoad>(); foreach (Vector3d lv in forceVectors) { sLineLoad sl = new sLineLoad(patternName, eLoadType.DistributedLoad, true, rhcon.TosXYZ(lv)); lg.loads.Add(rhcon.EnsureUnit(sl)); } outobj = lg; } DA.SetData(0, outobj); }
protected override void SolveInstance(IGH_DataAccess DA) { List <Point3d> points = new List <Point3d>(); if (!DA.GetDataList(0, points)) { return; } List <sPointSupport> nodes = new List <sPointSupport>(); string modelUnit = Rhino.RhinoDoc.ActiveDoc.ModelUnitSystem.ToString(); sRhinoConverter rhcon = new sRhinoConverter(modelUnit, "Meters"); if (supType == eSupportType.FIXED || supType == eSupportType.PINNED) { for (int i = 0; i < points.Count; ++i) { sXYZ sp = rhcon.TosXYZ((Point3d)rhcon.EnsureUnit(points[i])); sPointSupport n = new sPointSupport(); n.location = sp; n.supportType = supType; nodes.Add(n); } } else { bool xx = true; bool yy = true; bool zz = true; bool rxx = true; bool ryy = true; bool rzz = true; if (!DA.GetData(1, ref xx)) { return; } if (!DA.GetData(2, ref yy)) { return; } if (!DA.GetData(3, ref zz)) { return; } if (!DA.GetData(4, ref rxx)) { return; } if (!DA.GetData(5, ref ryy)) { return; } if (!DA.GetData(6, ref rzz)) { return; } foreach (Point3d p in points) { sXYZ sp = rhcon.TosXYZ((Point3d)rhcon.EnsureUnit(p)); sPointSupport n = new sPointSupport(); n.location = sp; n.supportType = supType; n.constraints = new bool[6] { xx, yy, zz, rxx, ryy, rzz }; nodes.Add(n); } } if (supType == eSupportType.FIXED) { this.Message = "ALL FIXED"; } else if (supType == eSupportType.PINNED) { this.Message = "ALL PINNED"; } else { this.Message = "By Constraints"; } DA.SetDataList(0, nodes); }