/// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // Declare a variable for the input String
            global::Topologic.Wire wire = null;
            double tolerance            = 0.0001;

            // Use the DA object to retrieve the data inside the first input parameter.
            // If the retieval fails (for example if there is no data) we need to abort.
            if (!DA.GetData(0, ref wire))
            {
                return;
            }
            if (!DA.GetData(1, ref tolerance))
            {
                return;
            }

            // If the retrieved data is Nothing, we need to abort.
            // We're also going to abort on a zero-length String.
            if (wire == null)
            {
                return;
            }
            //if (data.Length == 0) { return; }

            // Convert the String to a character array.
            //char[] chars = data.ToCharArray();

            Topologic.Wire newWire = global::Topologic.Utilities.WireUtility.RemoveCollinearEdges(wire, tolerance);

            // Use the DA object to assign a new String to the first output parameter.
            DA.SetData(0, newWire);
        }
Beispiel #2
0
        internal static global::Topologic.Face FaceByPlanarSurface(BH.oM.Geometry.PlanarSurface bhomPlanarSurface)
        {
            ICurve        bhomExternalBoundary   = bhomPlanarSurface.ExternalBoundary;
            List <ICurve> bhomInternalBoundaries = bhomPlanarSurface.InternalBoundaries;

            global::Topologic.Wire        externalBoundary   = Create.WireByCurve(bhomExternalBoundary);
            List <global::Topologic.Wire> internalBoundaries = new List <global::Topologic.Wire>();

            if (bhomInternalBoundaries != null)
            {
                foreach (ICurve bhomInternalBoundary in bhomInternalBoundaries)
                {
                    global::Topologic.Wire internalBoundary = Create.WireByCurve(bhomInternalBoundary);
                    internalBoundaries.Add(internalBoundary);
                }
            }
            return(global::Topologic.Face.ByExternalInternalBoundaries(externalBoundary, internalBoundaries));
        }
Beispiel #3
0
        internal static Polyline Polyline(global::Topologic.Wire wire)
        {
            List <global::Topologic.Vertex> vertices = wire.Vertices;
            List <Point> bhomPoints = new List <Point>();

            foreach (global::Topologic.Vertex vertex in vertices)
            {
                bhomPoints.Add(Convert.Point(vertex));
            }
            if (bhomPoints.Count > 0 && wire.IsClosed)
            {
                bhomPoints.Add(bhomPoints[0]);
            }

            return(new Polyline {
                ControlPoints = bhomPoints
            });
        }
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // Declare a variable for the input String
            global::Topologic.Wire     wire           = null;
            global::Topologic.Topology parentTopology = null;

            // Use the DA object to retrieve the data inside the first input parameter.
            // If the retieval fails (for example if there is no data) we need to abort.
            if (!DA.GetData(0, ref wire))
            {
                return;
            }
            if (!DA.GetData(1, ref parentTopology))
            {
                return;
            }

            // If the retrieved data is Nothing, we need to abort.
            // We're also going to abort on a zero-length String.
            if (wire == null)
            {
                return;
            }
            if (parentTopology == null)
            {
                return;
            }
            //if (data.Length == 0) { return; }

            // Convert the String to a character array.
            //char[] chars = data.ToCharArray();

            IList <global::Topologic.Shell> adjacentShells = global::Topologic.Utilities.WireUtility.AdjacentShells(wire, parentTopology);

            // Use the DA object to assign a new String to the first output parameter.
            DA.SetDataList(0, adjacentShells);
        }
Beispiel #5
0
 public static global::Topologic.Face FaceByExternalInternalBoundaries(global::Topologic.Wire outerWire, IEnumerable <global::Topologic.Wire> innerWires)
 {
     return(global::Topologic.Face.ByExternalInternalBoundaries(outerWire, innerWires));
 }
Beispiel #6
0
 public static global::Topologic.Face FaceByWire(global::Topologic.Wire wire)
 {
     return(global::Topologic.Face.ByWire(wire));
 }
Beispiel #7
0
        internal static IGeometry BasicGeometry(global::Topologic.Topology topology)
        {
            if (topology == null)
            {
                return(null);
            }

            global::Topologic.Vertex vertex = topology as global::Topologic.Vertex;
            if (vertex != null)
            {
                return(Convert.BasicGeometry(vertex));
            }

            global::Topologic.Edge edge = topology as global::Topologic.Edge;
            if (edge != null)
            {
                return(Convert.BasicGeometry(edge));
            }

            global::Topologic.Wire wire = topology as global::Topologic.Wire;
            if (wire != null)
            {
                return(Convert.BasicGeometry(wire));
            }

            global::Topologic.Face face = topology as global::Topologic.Face;
            if (face != null)
            {
                return(Convert.BasicGeometry(face));
            }

            global::Topologic.Shell shell = topology as global::Topologic.Shell;
            if (shell != null)
            {
                return(Convert.BasicGeometry(shell));
            }

            global::Topologic.Cell cell = topology as global::Topologic.Cell;
            if (cell != null)
            {
                return(Convert.BasicGeometry(cell));
            }

            global::Topologic.CellComplex cellComplex = topology as global::Topologic.CellComplex;
            if (cellComplex != null)
            {
                return(Convert.BasicGeometry(cellComplex));
            }

            global::Topologic.Cluster cluster = topology as global::Topologic.Cluster;
            if (cluster != null)
            {
                return(Convert.BasicGeometry(cluster));
            }

            //global::Topologic.Aperture aperture = topology as global::Topologic.Aperture;
            //if (aperture != null)
            //{
            //    return Aperture.Convert.BasicGeometry(aperture);
            //}

            throw new NotImplementedException("Geometry for this shape is not supported yet");
        }
Beispiel #8
0
 internal static IGeometry BasicGeometry(global::Topologic.Wire wire)
 {
     return(Polyline(wire));
 }
Beispiel #9
0
 public static List <global::Topologic.Vertex> Vertices(global::Topologic.Wire wire)
 {
     return(wire.Vertices);
 }
Beispiel #10
0
 public static bool IsClosed(global::Topologic.Wire wire)
 {
     return(wire.IsClosed);
 }
Beispiel #11
0
 public static List <global::Topologic.Face> Faces(global::Topologic.Wire wire)
 {
     return(wire.Faces);
 }
Beispiel #12
0
 public static List <global::Topologic.Edge> Edges(global::Topologic.Wire wire)
 {
     return(wire.Edges);
 }
Beispiel #13
0
 public static global::Topologic.Face TrimByWire(global::Topologic.Face face, global::Topologic.Wire wire, bool reverseWire)
 {
     return(global::Topologic.Utilities.FaceUtility.TrimByWire(face, wire, reverseWire));
 }
Beispiel #14
0
 public static global::Topologic.Wire RemoveCollinearEdges(global::Topologic.Wire wire, double tolerance = 0.0001)
 {
     return(global::Topologic.Utilities.WireUtility.RemoveCollinearEdges(wire, tolerance));
 }
Beispiel #15
0
 public static List <global::Topologic.Cell> AdjacentCells(global::Topologic.Wire wire, global::Topologic.Topology parentTopology)
 {
     return(global::Topologic.Utilities.WireUtility.AdjacentCells(wire, parentTopology));
 }