/// <summary> Add a RhinoObject to this list </summary> /// <param name="rhinoObject"></param> /// <since>5.10</since> public void Add(DocObjects.RhinoObject rhinoObject) { IntPtr const_ptr_rhinoobject = rhinoObject.ConstPointer(); IntPtr ptr_this = NonConstPointer(); UnsafeNativeMethods.CRhinoXformObjectList_AddObject2(ptr_this, const_ptr_rhinoobject); }
/// <summary> /// Checks geometry to see if it can be selected. /// Override to provide fancy filtering. /// </summary> /// <param name="rhObject">parent object being considered.</param> /// <param name="geometry">geometry being considered.</param> /// <param name="componentIndex"> /// if >= 0, geometry is a proper sub-part of object->Geometry() with componentIndex. /// </param> /// <returns> /// The default returns true unless you've set a custom geometry filter. If a custom /// filter has been set, that delegate is called /// </returns> public virtual bool CustomGeometryFilter(DocObjects.RhinoObject rhObject, GeometryBase geometry, ComponentIndex componentIndex) { if (m_filter != null) { return(m_filter(rhObject, geometry, componentIndex)); } return(true); }
/// <summary> /// Returns the underlying const CRhinoObject* for a RhinoCommon class. You should only /// be interested in using this function if you are writing C++ code. /// </summary> /// <param name="rhinoObject">A Rhino object.</param> /// <returns>A pointer to the Rhino const object.</returns> /// <since>5.0</since> public static IntPtr RhinoObjectConstPointer(DocObjects.RhinoObject rhinoObject) { IntPtr rc = IntPtr.Zero; if (rhinoObject != null) { rc = rhinoObject.ConstPointer(); } return(rc); }
private static int SupportsObject(int serial, uint obj_serial) { var client = FromSerialNumber(serial); if (client != null) { Rhino.DocObjects.RhinoObject obj = new DocObjects.RhinoObject(obj_serial); bool save_doc = client.SupportsObject(obj); return(save_doc ? 1 : 0); } return(0); }
private static void ExtendBoundingBoxForObjectAnimation(int serial, uint pDoc_serial, uint obj_serial, ref Geometry.Transform transform, IntPtr pArchive_start, IntPtr pArchive_stop, ref Geometry.BoundingBox bbox) { var client = FromSerialNumber(serial); if (client != null) { RhinoDoc doc = RhinoDoc.FromRuntimeSerialNumber(pDoc_serial); Rhino.DocObjects.RhinoObject obj = new DocObjects.RhinoObject(obj_serial); BinaryArchiveReader archive_start = new BinaryArchiveReader(pArchive_start); BinaryArchiveReader archive_stop = new BinaryArchiveReader(pArchive_stop); client.ExtendBoundingBoxForObjectAnimation(doc, obj, ref transform, archive_start, archive_stop, ref bbox); } }
private static int RestoreObject(int serial, uint doc_serial, uint obj_serial, ref Geometry.Transform transform, IntPtr pArchive) { var client = FromSerialNumber(serial); if (client != null) { RhinoDoc doc = RhinoDoc.FromRuntimeSerialNumber(doc_serial); BinaryArchiveReader archive = new BinaryArchiveReader(pArchive); Rhino.DocObjects.RhinoObject obj = new DocObjects.RhinoObject(obj_serial); bool save_doc = client.RestoreObject(doc, obj, ref transform, archive); return(save_doc ? 1 : 0); } return(0); }
private static int PrepareForObjectAnimation(int serial, uint pDoc_serial, uint obj_serial, ref Geometry.Transform transform, IntPtr pArchive_start, IntPtr pArchive_stop) { var client = FromSerialNumber(serial); if (client != null) { RhinoDoc doc = RhinoDoc.FromRuntimeSerialNumber(pDoc_serial); Rhino.DocObjects.RhinoObject obj = new DocObjects.RhinoObject(obj_serial); BinaryArchiveReader archive_start = new BinaryArchiveReader(pArchive_start); BinaryArchiveReader archive_stop = new BinaryArchiveReader(pArchive_stop); bool animate_doc = client.PrepareForObjectAnimation(doc, obj, ref transform, archive_start, archive_stop); return(animate_doc ? 1 : 0); } return(0); }
/// <summary> /// Checks geometry to see if it passes the basic GeometryAttributeFilter. /// </summary> /// <param name="rhObject">parent object being considered.</param> /// <param name="geometry">geometry being considered.</param> /// <param name="componentIndex">if >= 0, geometry is a proper sub-part of object->Geometry() with componentIndex.</param> /// <returns> /// true if the geometry passes the filter returned by GeometryAttributeFilter(). /// </returns> public bool PassesGeometryAttributeFilter(DocObjects.RhinoObject rhObject, GeometryBase geometry, ComponentIndex componentIndex) { IntPtr pRhinoObject = IntPtr.Zero; if (rhObject != null) { pRhinoObject = rhObject.ConstPointer(); } IntPtr pGeometry = IntPtr.Zero; if (geometry != null) { pGeometry = geometry.ConstPointer(); } IntPtr ptr = NonConstPointer(); return(UnsafeNativeMethods.CRhinoGetObject_PassesGeometryAttributeFilter(ptr, pRhinoObject, pGeometry, componentIndex)); }
private static bool CustomGeometryFilter(IntPtr rhObject, IntPtr geometry, ComponentIndex componentIndex) { bool rc = true; if (m_active_go != null) { try { DocObjects.RhinoObject _rhObj = DocObjects.RhinoObject.CreateRhinoObjectHelper(rhObject); GeometryBase _geom = GeometryBase.CreateGeometryHelper(geometry, _rhObj); rc = m_active_go.CustomGeometryFilter(_rhObj, _geom, componentIndex); } catch (Exception ex) { Runtime.HostUtils.ExceptionReport(ex); } } return(rc); }
private static int IsCurrentObjModelStateInAnySnapshot(int serial, uint pDoc_serial, uint obj_serial, IntPtr pArchive, IntPtr pArchives, IntPtr pTextLog) { var client = FromSerialNumber(serial); if (client != null) { RhinoDoc doc = RhinoDoc.FromRuntimeSerialNumber(pDoc_serial); BinaryArchiveReader archive = new BinaryArchiveReader(pArchive); SimpleArrayBinaryArchiveReader archives = new SimpleArrayBinaryArchiveReader(pArchives); Rhino.DocObjects.RhinoObject obj = new DocObjects.RhinoObject(obj_serial); TextLog log = null; if (IntPtr.Zero != pTextLog) { new TextLog(pTextLog); } bool equal_doc = client.IsCurrentModelStateInAnySnapshot(doc, obj, archive, archives, log); return(equal_doc ? 1 : 0); } return(0); }
public GeometryBase[] Explode() { using (Runtime.InteropWrappers.SimpleArrayGeometryPointer geometry = new Runtime.InteropWrappers.SimpleArrayGeometryPointer()) { IntPtr ptr_parent_rhinoobject = IntPtr.Zero; if (IsDocumentControlled) { DocObjects.RhinoObject rhobj = ParentRhinoObject(); if (rhobj != null) { ptr_parent_rhinoobject = rhobj.ConstPointer(); } } IntPtr ptr_geometry_array = geometry.NonConstPointer(); IntPtr const_ptr_this = ConstPointer(); UnsafeNativeMethods.ON_Hatch_Explode(const_ptr_this, ptr_parent_rhinoobject, ptr_geometry_array); GeometryBase[] rc = geometry.ToNonConstArray(); return(rc); } }