//Description: // Purges an instance definition and its definition geometry. //Parameters: // idef_index - [in] zero based index of instance definition to delete. // This must be in the range // 0 <= idefIndex < InstanceDefinitionTable.Count //Returns: // True if successful. False if the instance definition cannot be purged // because it is in use by reference objects or undo information. //bool PurgeInstanceDefinition( int idef_index ); //Description: // Purge deleted instance definition information that is not // in use. This function is time consuming and should be used // in a thoughtful manner. //Parameters: // bIgnoreUndoReferences: // If false, then deleted instance definition information // that could possibly be undeleted by the Undo command // will not be deleted. // If true, then all deleted instance definition information // is deleted. //void Compact( bool bIgnoreUndoReferences ); //Description: // Undeletes an instance definition that has been deleted by DeleteLayer(). //Parameters: // idef_index - [in] zero based index of an instance definition // to undelete. This must be in the range // 0 <= idefIndex < InstanceDefinitionTable.Count //Returns: // TRUE if successful. //bool UndeleteInstanceDefinition( int idef_index ); //Description: // Read the objects from a file and use them as the instance's // definition geometry. //Parameters: // idef_index - [in] // instance definition index // filename - [in] // name of file (can be any type of file that Rhino or a plug-in can read). // bUpdateNestedLinks - [in] // If true and the instance definition referes to a linked instance definition, // that needs to be updated, then the nested defition is also updated. // If false, nested updates are skipped. //Returns: // True if successful. //bool UpdateLinkedInstanceDefinition( // int idef_index, // const wchar_t* filename, // bool bUpdateNestedLinks // ); //Description: // Gets an array of pointers to layers that is sorted by // the values of CRhinoInstanceDefinition::m_sort_index. //Parameters: // sorted_list - [out] this array is filled in with // CRhinoInstanceDefinition pointers sorted by // the values of CRhinoInstanceDefinition::m_sort_index. // bIgnoreDeleted - [in] if TRUE then deleted layers are filtered out. //Remarks: // Use Sort() to set the values of m_sort_index. //void GetSortedList( // ON_SimpleArray<const CRhinoInstanceDefinition*>& sorted_list, // bool bIgnoreDeleted = false // ) const; /// <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 DocObjects.InstanceDefinition[] GetList(bool ignoreDeleted) { Runtime.InteropWrappers.SimpleArrayInt arr = new Runtime.InteropWrappers.SimpleArrayInt(); IntPtr ptr = arr.m_ptr; int count = UnsafeNativeMethods.CRhinoInstanceDefinitionTable_GetList(m_doc.m_docId, ptr, ignoreDeleted); DocObjects.InstanceDefinition[] rc = new InstanceDefinition[0]; if (count > 0) { int[] indices = arr.ToArray(); if (indices != null && indices.Length > 0) { count = indices.Length; rc = new Rhino.DocObjects.InstanceDefinition[count]; int docId = 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(docId, indices[i]); rc[i] = IntPtr.Zero.Equals(idef) ? null : new Rhino.DocObjects.InstanceDefinition(indices[i], m_doc); } } } arr.Dispose(); return(rc); }
/// <summary> /// Utility for picking mesh vertices /// </summary> /// <param name="mesh"></param> /// <returns>indices of mesh topology vertices that were picked</returns> /// <since>5.0</since> public int[] PickMeshTopologyVertices(Geometry.Mesh mesh) { using (var indices = new Runtime.InteropWrappers.SimpleArrayInt()) { IntPtr const_ptr_this = ConstPointer(); IntPtr const_ptr_mesh = mesh.ConstPointer(); IntPtr ptr_indices = indices.NonConstPointer(); int rc = UnsafeNativeMethods.CRhinoPickContext_PickMeshTopologyVertices(const_ptr_this, const_ptr_mesh, ptr_indices); return(rc < 1 ? new int[0] : indices.ToArray()); } }
/// <summary> /// Utility for picking mesh vertices /// </summary> /// <param name="mesh"></param> /// <returns>indices of mesh topology vertices that were picked</returns> public int[] PickMeshTopologyVertices(Rhino.Geometry.Mesh mesh) { using (var indices = new Runtime.InteropWrappers.SimpleArrayInt()) { IntPtr pConstThis = ConstPointer(); IntPtr pConstMesh = mesh.ConstPointer(); IntPtr pIndices = indices.NonConstPointer(); int rc = UnsafeNativeMethods.CRhinoPickContext_PickMeshTopologyVertices(pConstThis, pConstMesh, pIndices); if (rc < 1) { return(new int[0]); } return(indices.ToArray()); } }
/// <summary> /// Get a list of the RhinoCommon added content section serial numbers /// associated with this sections container. /// </summary> /// <returns> /// Return a list of the RhinoCommon added content section serial numbers /// associated with this sections container. /// </returns> private int[] GetSiblingIdList() { using (var idList = new Runtime.InteropWrappers.SimpleArrayInt()) { var pointerToIdList = idList.NonConstPointer(); var serialNumber = SerialNumber; UnsafeNativeMethods.Rdk_CoreContent_UiSectionConentSiblingList(serialNumber, ref m_SearchHint, pointerToIdList); return idList.ToArray(); } }
/// <summary> /// Utility for picking mesh vertices /// </summary> /// <param name="mesh"></param> /// <returns>indices of mesh topology vertices that were picked</returns> public int[] PickMeshTopologyVertices(Rhino.Geometry.Mesh mesh) { using (var indices = new Runtime.InteropWrappers.SimpleArrayInt()) { IntPtr pConstThis = ConstPointer(); IntPtr pConstMesh = mesh.ConstPointer(); IntPtr pIndices = indices.NonConstPointer(); int rc = UnsafeNativeMethods.CRhinoPickContext_PickMeshTopologyVertices(pConstThis, pConstMesh, pIndices); if (rc < 1) return new int[0]; return indices.ToArray(); } }