public static List <double> ToLadybugTools(this Spatial.Point3D point3D) { if (point3D == null) { return(null); } return(new List <double>() { point3D.X, point3D.Y, point3D.Z }); }
public static Spatial.Plane Plane(this View view) { if (view == null) { return(null); } Spatial.Vector3D right = view.RightDirection.ToSAM_Vector3D(false); Spatial.Vector3D up = view.UpDirection.ToSAM_Vector3D(false); Spatial.Point3D origin = view.Origin.ToSAM(); return(new Spatial.Plane(origin, right, up)); }
public static GH_Point ToGrasshopper(this Spatial.Point3D point3D) { return(new GH_Point(point3D.ToRhino())); }
public static Tag ToSAM(this IndependentTag independentTag, ConvertSettings convertSettings) { if (independentTag == null) { return(null); } Document document = independentTag.Document; if (document == null) { return(null); } Tag result = convertSettings?.GetObject <Tag>(independentTag.Id); if (result != null) { return(result); } TagType tagType = ToSAM_TagType(document.GetElement(independentTag.GetTypeId()) as FamilySymbol, convertSettings); if (tagType == null) { return(null); } ElementId elementId = independentTag.OwnerViewId; if (elementId == null) { return(null); } View view = document.GetElement(elementId) as View; if (view == null) { return(null); } IntegerId viewId = Query.IntegerId(view); #if Revit2017 IntegerId referenceId = null; #else IntegerId referenceId = Query.IntegerId(document.GetElement(independentTag.GetTaggedReference())); #endif if (referenceId == null) { return(null); } Spatial.Point3D location = ToSAM(independentTag.TagHeadPosition); if (location == null) { return(null); } Planar.Point2D elbow = null; Planar.Point2D end = null; if (independentTag.HasLeader) { #if Revit2017 #else if (independentTag.HasElbow) { Spatial.Point3D elbow3D = ToSAM(independentTag.LeaderElbow); if (elbow3D != null) { elbow = new Planar.Point2D(elbow3D.X, elbow3D.Y); } } #endif if (independentTag.LeaderEndCondition == LeaderEndCondition.Free) { Spatial.Point3D end3D = ToSAM(independentTag.LeaderEnd); if (end3D != null) { end = new Planar.Point2D(end3D.X, end3D.Y); } } } result = new Tag(tagType, viewId, new Planar.Point2D(location.X, location.Y), elbow, end, referenceId); if (result != null) { result.SetValue(ElementParameter.RevitId, Query.IntegerId(independentTag)); result.SetValue(TagParameter.Leader, independentTag.HasLeader); result.SetValue(TagParameter.Orientation, independentTag.TagOrientation.ToString()); Core.Revit.Modify.SetValues(independentTag, result); convertSettings?.Add(independentTag.Id, result); } return(result); }