/// <summary> /// Return Dynamo Line object from the Beam System Line. Supports Straight Beam, Tapered Beam, Unfolded Beam or Compound Beam /// </summary> /// <param name="steelObject"> Advance Steel element</param> /// <returns name="line"> beam system line as line object</returns> public static Autodesk.DesignScript.Geometry.Line GetBeamLine(AdvanceSteel.Nodes.SteelDbObject steelObject) { Autodesk.DesignScript.Geometry.Line ret = null; using (var ctx = new SteelServices.DocContext()) { if (steelObject != null) { FilerObject filerObj = Utils.GetObject(steelObject.Handle); if (filerObj != null) { if (filerObj.IsKindOf(FilerObject.eObjectType.kStraightBeam) || filerObj.IsKindOf(FilerObject.eObjectType.kBeamTapered) || filerObj.IsKindOf(FilerObject.eObjectType.kUnfoldedStraightBeam) || filerObj.IsKindOf(FilerObject.eObjectType.kCompoundStraightBeam)) { Autodesk.AdvanceSteel.Modelling.Beam selectedObj = filerObj as Autodesk.AdvanceSteel.Modelling.Beam; Point3d foundStartPoint = selectedObj.GetPointAtStart(); Point3d foundEndPoint = selectedObj.GetPointAtEnd(); if (foundStartPoint != null || foundEndPoint != null) { ret = Autodesk.DesignScript.Geometry.Line.ByStartPointEndPoint(Utils.ToDynPoint(foundStartPoint, true), Utils.ToDynPoint(foundEndPoint, true)); } else { throw new System.Exception("No Points wer returned from the Object"); } } else { throw new System.Exception("Not a Straight Beam, Tapered Beam, Unfolded Beam or Compound Beam Object"); } } else { throw new System.Exception("AS Object is null"); } } else { throw new System.Exception("Steel Object is null"); } } return(ret); }
/// <summary> /// Get intersection point of Steel object system line with Dynamo plane /// </summary> /// <param name="steelObject"> Advance Steel element</param> /// <param name="intersectionPlane"> Dynamo Plane to intersect with Steel body</param> /// <returns name="point"> point formed by cutting the system line through a plane</returns> public static Autodesk.DesignScript.Geometry.Point CutSystemLineByPlane(AdvanceSteel.Nodes.SteelDbObject steelObject, Autodesk.DesignScript.Geometry.Plane intersectionPlane) { Autodesk.DesignScript.Geometry.Point ret = Autodesk.DesignScript.Geometry.Point.ByCoordinates(0, 0, 0); using (var ctx = new SteelServices.DocContext()) { if (steelObject != null || intersectionPlane != null) { FilerObject filerObj = Utils.GetObject(steelObject.Handle); Plane cutPlane = Utils.ToAstPlane(intersectionPlane, true); if (filerObj != null) { AtomicElement selectedObj = filerObj as AtomicElement; if (selectedObj.IsKindOf(FilerObject.eObjectType.kBeam)) { Autodesk.AdvanceSteel.Modelling.Beam passedBeam = selectedObj as Autodesk.AdvanceSteel.Modelling.Beam; Line3d line = new Line3d(passedBeam.GetPointAtStart(), passedBeam.GetPointAtEnd()); Point3d[] intPts = new Point3d[] { }; cutPlane.IntersectWith(line, ref intPts, new Tol()); if (intPts.Length > 0) { ret = Utils.ToDynPoint(intPts[0], true); } else { throw new System.Exception("No Intersection point found on steel object with current plane"); } } } else { throw new System.Exception("No Object found via registered handle"); } } else { throw new System.Exception("No Steel Object found or Plane is Null"); } } return(ret); }
/// <summary> /// Get Point at a distance from the START of the Beam /// </summary> /// <param name="steelObject">Advance Steel element</param> /// <param name="distance"> Distance from start point</param> /// <returns name="point"> from beam object start point return a point by the distance value</returns> public static Autodesk.DesignScript.Geometry.Point GetPointFromStart(AdvanceSteel.Nodes.SteelDbObject steelObject, [DefaultArgument("0")] double distance) { Autodesk.DesignScript.Geometry.Point ret = Autodesk.DesignScript.Geometry.Point.ByCoordinates(0, 0, 0); using (var ctx = new SteelServices.DocContext()) { if (steelObject != null) { FilerObject filerObj = Utils.GetObject(steelObject.Handle); if (filerObj != null) { if (filerObj.IsKindOf(FilerObject.eObjectType.kBeam)) { Autodesk.AdvanceSteel.Modelling.Beam selectedObj = filerObj as Autodesk.AdvanceSteel.Modelling.Beam; Point3d foundPoint = selectedObj.GetPointAtStart(distance); if (foundPoint != null) { ret = Utils.ToDynPoint(foundPoint, true); } else { throw new System.Exception("No Point was returned from Function"); } } else { throw new System.Exception("Not a BEAM Object"); } } else { throw new System.Exception("AS Object is null"); } } else { throw new System.Exception("Steel Object is null"); } } return(ret); }