using System.Collections; using System.Collections.Generic; using Rhino; using Rhino.Geometry; using Rhino.FileIO; using Rhino.Display; using Grasshopper; using Grasshopper.Kernel; using Grasshopper.Kernel.Data; using Grasshopper.Kernel.Types; using System; using GH_IO.Serialization; using Eto.Drawing; using System.Security.Cryptography.X509Certificates; using System.Runtime.CompilerServices; namespace FEAInterface.Core { public class Node : IGH_PreviewData { #region fields public int Id; public double X; public double Y; public double Z; public Point3d Point; #endregion #region Constructors public Node(int id, double x, double y, double z) { Id = id; X = x; Y = y; Z = z; } ///Secondary Constructor public Node(int id, Point3d point) { Id = id; Point = point; } #endregion #region properties public bool IsValid { get { if (Id <= 0) { return false; } if (X < 0.0) { return false; } if (Y < 0.0) { return false; } if (Z < 0.0) { return false; } return true; } } #endregion #region methods public override string ToString() { if (this != null) { string outputMessage = string.Format("ID:{0:0} X:{1:0.000} Y:{2:0.000} Z:{3:0.000}", Id, X, Y, Z); return outputMessage; } else { string outputMessage = "Node Null"; return outputMessage; } } #endregion #region draw public void DrawViewportWires(GH_PreviewWireArgs args) { if (this == null) { return; } else { Point3d dispP = new Point3d(X, Y, Z); args.Pipeline.DrawPoint(dispP, System.Drawing.Color.Red); } } public void DrawViewportMeshes(GH_PreviewMeshArgs args) { } public BoundingBox ClippingBox { get { Point3d c1 = new Point3d(this.X - 0.1, this.Y - 0.1, this.Z - 0.1); Point3d c2 = new Point3d(this.X + 0.1, this.Y + 0.1, this.Z + 0.1); BoundingBox box = new BoundingBox(c1, c2); box.Inflate(1); return box; } } #endregion } }