Exemplo n.º 1
0
        /// <summary>
        /// Gets an array of instance definitions.
        /// </summary>
        /// <param name="ignoreDeleted">If true then deleted idefs are filtered out.</param>
        /// <returns>An array of instance definitions. This can be empty, but not null.</returns>
        public InstanceDefinition[] GetList(bool ignoreDeleted)
        {
            SimpleArrayInt arr   = new SimpleArrayInt();
            IntPtr         ptr   = arr.m_ptr;
            int            count = UnsafeNativeMethods.CRhinoInstanceDefinitionTable_GetList(m_doc.m_docId, ptr, ignoreDeleted);

            InstanceDefinition[] rc = new InstanceDefinition[0];
            if (count > 0)
            {
                int[] indices = arr.ToArray();
                if (indices != null && indices.Length > 0)
                {
                    count = indices.Length;
                    rc    = new InstanceDefinition[count];
                    int doc_id = m_doc.m_docId;
                    for (int i = 0; i < count; i++)
                    {
                        // Purged instance definitions will still be in the document as null
                        // pointers so check to see if the index is pointing to a null
                        // definition and if it is then put a null entry in the array.
                        IntPtr idef = UnsafeNativeMethods.CRhinoInstanceDefinition_GetInstanceDef(doc_id, indices[i]);
                        rc[i] = IntPtr.Zero.Equals(idef) ? null : new InstanceDefinition(indices[i], m_doc);
                    }
                }
            }
            arr.Dispose();
            return(rc);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Gets a list of all the InstanceDefinitions that contain a reference this InstanceDefinition.
 /// </summary>
 /// <returns>An array of instance definitions. The returned array can be empty, but not null.</returns>
 public InstanceDefinition[] GetContainers()
 {
     using (SimpleArrayInt arr = new SimpleArrayInt())
     {
         IntPtr ptr              = arr.m_ptr;
         int    count            = UnsafeNativeMethods.CRhinoInstanceDefinition_GetContainers(m_doc.m_docId, m_index, ptr);
         InstanceDefinition[] rc = null;
         if (count > 0)
         {
             int[] indices = arr.ToArray();
             if (indices != null)
             {
                 count = indices.Length;
                 rc    = new InstanceDefinition[count];
                 for (int i = 0; i < count; i++)
                 {
                     rc[i] = new InstanceDefinition(indices[i], m_doc);
                 }
             }
         }
         else
         {
             rc = new InstanceDefinition[0];
         }
         return(rc);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Removes points at given indices.
        /// </summary>
        /// <param name="indices">An array of indices of the points to remove.</param>
        /// <returns>The number of points removed from the point cloud.</returns>
        /// <since>7.5</since>
        public int RemoveRange(IEnumerable <int> indices)
        {
            IntPtr ptr_this = NonConstPointer();

            using (var indexes = new SimpleArrayInt(indices))
            {
                IntPtr ptr_const_indexes = indexes.ConstPointer();
                return(UnsafeNativeMethods.ON_PointCloud_RemoveRange(ptr_this, ptr_const_indexes));
            }
        }
Exemplo n.º 4
0
 public static System.Windows.Forms.DialogResult ShowSelectMultipleLayersDialog(IEnumerable <int> defaultLayerIndices, string dialogTitle, bool showNewLayerButton, out int[] layerIndices)
 {
     using (var array_int = new SimpleArrayInt(defaultLayerIndices))
     {
         IntPtr ptr_array_int = array_int.NonConstPointer();
         bool   rc            = UnsafeNativeMethods.RHC_RhinoSelectMultipleLayersDialog(dialogTitle, ptr_array_int, true, showNewLayerButton);
         layerIndices = rc ? array_int.ToArray() : new int[0];
         return(rc ? System.Windows.Forms.DialogResult.OK : System.Windows.Forms.DialogResult.Cancel);
     }
 }
        /// <summary>
        /// Return list of faces that were added to connect transformed edges/faces to non-transformed edges/faces.
        /// </summary>
        /// <returns>List of wall faces</returns>
        /// <since>6.16</since>
        public List <int> GetWallFaces()
        {
            List <int> res = new List <int>();

            using (var wallFaces = new SimpleArrayInt())
            {
                IntPtr ptr_walFaces = wallFaces.NonConstPointer();
                UnsafeNativeMethods.RHC_RhinoMeshExtruder_GetWallFaces(m_ptr, ptr_walFaces);
                res.AddRange(wallFaces.ToArray());
            }
            return(res);
        }
Exemplo n.º 6
0
 /// <summary>
 /// Return plain text string for this annotation with field expressions unevaluated.
 /// </summary>
 /// <param name="map">an array of int values in groups of 3: run index, character start position, and length.</param>
 /// <returns>A plain text string.</returns>
 /// <since>7.0</since>
 public string GetPlainTextWithRunMap(ref int[] map)
 {
     using (var sw = new StringWrapper())
     {
         var    ptr_stringholder = sw.NonConstPointer;
         IntPtr const_ptr_this   = ConstPointer();
         var    runmap           = new SimpleArrayInt();
         UnsafeNativeMethods.ON_V6_Annotation_GetPlainTextWithRunMap(const_ptr_this, ptr_stringholder, runmap.m_ptr);
         map = runmap.ToArray();
         runmap.Dispose();
         return(sw.ToString());
     }
 }