public override void ClearCaches()
        {
            //base.ClearCaches();

            if (m_value == null)
            {
                _polylines = null;
                _b         = BoundingBox.Empty;
                _mesh      = null;
            }
            else
            {
                _polylines = RhinoSupport.ToPolylines(m_value);

                _mesh = RhinoSupport.ToRhinoMesh(m_value);
            }
        }
        public Mesh[] GetPreviewMeshes()
        {
            if (m_value == null)
            {
                _mesh = null;
                return(null);
            }

            if (_mesh == null)
            {
                _mesh = RhinoSupport.ToRhinoMesh(m_value);
            }

            return(new Mesh[]
            {
                _mesh,
            });
        }
Beispiel #3
0
        public override bool CastTo <Q>(out Q target)
        {
            if (typeof(Q) == typeof(Mesh) || typeof(Q) == typeof(GeometryBase))
            {
                target = (Q)(object)RhinoSupport.ToRhinoMesh(m_value);
                return(true);
            }
            if (typeof(Q) == (typeof(GH_Mesh)))
            {
                target = (Q)(object)new GH_Mesh(RhinoSupport.ToRhinoMesh(m_value));
                return(true);
            }
            if (typeof(Q) == typeof(PlanktonMesh))
            {
                target = (Q)(object)m_value;
                return(true);
            }

            return(base.CastTo <Q>(out target));
        }
        public override bool CastTo <T>(out T target)
        {
            // cast to GH_Mesh
            if (typeof(T).IsAssignableFrom(typeof(GH_Mesh)))
            {
                object msh = new GH_Mesh(RhinoSupport.ToRhinoMesh(m_value));
                target = (T)msh;
                return(true);
            }

            // cast to Mesh
            if (typeof(T).IsAssignableFrom(typeof(Mesh)))
            {
                Object msh = RhinoSupport.ToRhinoMesh(m_value);
                target = (T)msh;
                return(true);
            }

            // cast to GH_PlanktonMesh
            if (typeof(T).IsAssignableFrom(typeof(GH_PlanktonMesh)))
            {
                object msh = new GH_PlanktonMesh(new PlanktonMesh(m_value));
                target = (T)msh;
                return(true);
            }

            // cast to PlanktonMesh
            if (typeof(T).IsAssignableFrom(typeof(PlanktonMesh)))
            {
                Object msh = new PlanktonMesh(m_value);
                target = (T)msh;
                return(true);
            }

            target = default(T);
            return(false);
        }