internal override IntPtr _InternalGetConstPointer() { if (null != m_shallow_parent) return m_shallow_parent.ConstPointer(); #if RHINO_SDK Rhino.DocObjects.ObjRef obj_ref = m__parent as Rhino.DocObjects.ObjRef; if (null != obj_ref) return obj_ref.GetGeometryConstPointer(this); Rhino.DocObjects.RhinoObject parent_object = ParentRhinoObject(); if (parent_object == null) { Rhino.FileIO.File3dmObject fileobject = m__parent as Rhino.FileIO.File3dmObject; if (null != fileobject) return fileobject.GetGeometryConstPointer(); } uint serial_number = 0; if (null != parent_object) serial_number = parent_object.m_rhinoobject_serial_number; ComponentIndex ci = new ComponentIndex(); return UnsafeNativeMethods.CRhinoObject_Geometry(serial_number, ci); #else Rhino.FileIO.File3dmObject fileobject = m__parent as Rhino.FileIO.File3dmObject; if (null != fileobject) return fileobject.GetGeometryConstPointer(); return IntPtr.Zero; #endif }
/// <summary> /// Gets one of the longitudinal curves along the beam or extrusion. /// </summary> /// <param name="ci">The index of this profile.</param> /// <returns>The profile.</returns> public Curve WallEdge(ComponentIndex ci) { IntPtr ptr_const_this = ConstPointer(); IntPtr ptr_new_curve = UnsafeNativeMethods.ON_Extrusion_WallEdge(ptr_const_this, ci); return(CreateGeometryHelper(ptr_new_curve, null) as Curve); }
/// <summary> /// Gets one of the longitudinal surfaces of the extrusion. /// </summary> /// <param name="ci">The index specifying which precise item to retrieve.</param> /// <returns>The surface.</returns> public Surface WallSurface(ComponentIndex ci) { IntPtr pConstThis = ConstPointer(); IntPtr pSurface = UnsafeNativeMethods.ON_Extrusion_WallSurface(pConstThis, ci); return(GeometryBase.CreateGeometryHelper(pSurface, null) as Surface); }
/// <summary> /// Gets one of the longitudinal curves along the beam or extrusion. /// </summary> /// <param name="ci">The index of this profile.</param> /// <returns>The profile.</returns> public Curve WallEdge(ComponentIndex ci) { IntPtr pConstThis = ConstPointer(); IntPtr pCurve = UnsafeNativeMethods.ON_Extrusion_WallEdge(pConstThis, ci); return(GeometryBase.CreateGeometryHelper(pCurve, null) as Curve); }
/// <summary> /// Gets one of the longitudinal surfaces of the extrusion. /// </summary> /// <param name="ci">The index specifying which precise item to retrieve.</param> /// <returns>The surface.</returns> public Surface WallSurface(ComponentIndex ci) { IntPtr ptr_const_this = ConstPointer(); IntPtr ptr_new_surface = UnsafeNativeMethods.ON_Extrusion_WallSurface(ptr_const_this, ci); return(CreateGeometryHelper(ptr_new_surface, null) as Surface); }
public ComponentIndex ComponentIndex() { ComponentIndex ci = new ComponentIndex(); IntPtr ptr = ConstPointer(); UnsafeNativeMethods.ON_Geometry_ComponentIndex(ptr, ref ci); return(ci); }
public ComponentIndex[] ToArray() { int count = Count; if (count < 1) return null; ComponentIndex[] rc = new ComponentIndex[count]; UnsafeNativeMethods.ON_ComponentIndexArray_CopyValues(m_ptr, ref rc[0]); return rc; }
internal override IntPtr _InternalGetConstPointer() { if (null != m_shallow_parent) { return(m_shallow_parent.ConstPointer()); } #if RHINO_SDK ObjRef obj_ref = m__parent as ObjRef; if (null != obj_ref) { return(obj_ref.GetGeometryConstPointer(this)); } RhinoObject parent_object = ParentRhinoObject(); if (parent_object == null) { FileIO.File3dmObject fileobject = m__parent as FileIO.File3dmObject; if (null != fileobject) { return(fileobject.GetGeometryConstPointer()); } } uint serial_number = 0; IntPtr ptr_parent_rhinoobject = IntPtr.Zero; if (null != parent_object) { serial_number = parent_object.m_rhinoobject_serial_number; ptr_parent_rhinoobject = parent_object.m_pRhinoObject; if (IntPtr.Zero == ptr_parent_rhinoobject && parent_object.m__parent != null && parent_object.m__parent is ObjRef) { ObjRef objref = parent_object.m__parent as ObjRef; IntPtr constPtrObjRef = objref.ConstPointer(); ptr_parent_rhinoobject = UnsafeNativeMethods.CRhinoObjRef_Object(constPtrObjRef); } } ComponentIndex ci = new ComponentIndex(); // There are a few cases (like in ReplaceObject callback) where the parent // rhino object temporarily holds onto the CRhinoObject* because the object // is not officially in the document yet. if (ptr_parent_rhinoobject != IntPtr.Zero) { return(UnsafeNativeMethods.CRhinoObject_Geometry(ptr_parent_rhinoobject, ci)); } return(UnsafeNativeMethods.CRhinoObject_Geometry2(serial_number, ci)); #else var fileobject = m__parent as Rhino.FileIO.File3dmObject; if (null != fileobject) { return(fileobject.GetGeometryConstPointer()); } return(IntPtr.Zero); #endif }
private bool CircleWithRadiusOf10GeometryFilter (Rhino.DocObjects.RhinoObject rhObject, GeometryBase geometry, ComponentIndex componentIndex) { bool is_circle_with_radius_of10 = false; Circle circle; if (geometry is Curve && (geometry as Curve).TryGetCircle(out circle)) is_circle_with_radius_of10 = circle.Radius <= 10.0 + m_tolerance && circle.Radius >= 10.0 - m_tolerance; return is_circle_with_radius_of10; }
public override bool CustomGeometryFilter( Rhino.DocObjects.RhinoObject rhObject, Rhino.Geometry.GeometryBase geometry, Rhino.Geometry.ComponentIndex componentIndex) { var m = geometry as Mesh; if (m == null) { return(false); } return(m.IsValid); }
private Silhouette(IntPtr ptrSilEvent) { IntPtr ptr_curve = UnsafeNativeMethods.TLC_SilEvent_ExtractCurve(ptrSilEvent); Curve = GeometryBase.CreateGeometryHelper(ptr_curve, null) as Curve; ComponentIndex ci = ComponentIndex.Unset; var et = UnsafeNativeMethods.TLC_SilEvent_Extract(ptrSilEvent, ref ci); switch (et) { case UnsafeNativeMethods.SilEventType.None: SilhouetteType = SilhouetteType.None; break; case UnsafeNativeMethods.SilEventType.Tangent: SilhouetteType = SilhouetteType.Tangent; break; case UnsafeNativeMethods.SilEventType.Projecting: SilhouetteType = SilhouetteType.Projecting; break; case UnsafeNativeMethods.SilEventType.TanProjects: SilhouetteType = SilhouetteType.TangentProjects; break; case UnsafeNativeMethods.SilEventType.Boundary: SilhouetteType = SilhouetteType.Boundary; break; case UnsafeNativeMethods.SilEventType.Crease: SilhouetteType = SilhouetteType.Crease; break; case UnsafeNativeMethods.SilEventType.DraftCurve: SilhouetteType = SilhouetteType.DraftCurve; break; } GeometryComponentIndex = ci; }
internal override IntPtr _InternalGetConstPointer() { if (null != m_shallow_parent) return m_shallow_parent.ConstPointer(); #if RHINO_SDK Rhino.DocObjects.ObjRef obj_ref = m__parent as Rhino.DocObjects.ObjRef; if (null != obj_ref) return obj_ref.GetGeometryConstPointer(this); Rhino.DocObjects.RhinoObject parent_object = ParentRhinoObject(); if (parent_object == null) { Rhino.FileIO.File3dmObject fileobject = m__parent as Rhino.FileIO.File3dmObject; if (null != fileobject) return fileobject.GetGeometryConstPointer(); } uint serial_number = 0; IntPtr pParentRhinoObject = IntPtr.Zero; if (null != parent_object) { serial_number = parent_object.m_rhinoobject_serial_number; pParentRhinoObject = parent_object.m_pRhinoObject; } ComponentIndex ci = new ComponentIndex(); // There are a few cases (like in ReplaceObject callback) where the parent // rhino object temporarily holds onto the CRhinoObject* because the object // is not officially in the document yet. if (pParentRhinoObject != IntPtr.Zero) return UnsafeNativeMethods.CRhinoObject_Geometry(pParentRhinoObject, ci); return UnsafeNativeMethods.CRhinoObject_Geometry2(serial_number, ci); #else Rhino.FileIO.File3dmObject fileobject = m__parent as Rhino.FileIO.File3dmObject; if (null != fileobject) return fileobject.GetGeometryConstPointer(); return IntPtr.Zero; #endif }
public override bool CustomGeometryFilter( Rhino.DocObjects.RhinoObject rhObject, Rhino.Geometry.GeometryBase geometry, Rhino.Geometry.ComponentIndex componentIndex) { var c = geometry as Curve; if (c == null) { return(false); } if (c.IsPolyline()) { Polyline pl; if (!c.TryGetPolyline(out pl)) { return(false); } return(pl.Count > 3); } return(false); }
/// <summary> /// Gets one of the longitudinal surfaces of the extrusion. /// </summary> /// <param name="ci">The index specifying which precise item to retrieve.</param> /// <returns>The surface.</returns> public Surface WallSurface(ComponentIndex ci) { IntPtr pConstThis = ConstPointer(); IntPtr pSurface = UnsafeNativeMethods.ON_Extrusion_WallSurface(pConstThis, ci); return GeometryBase.CreateGeometryHelper(pSurface, null) as Surface; }
/// <summary> /// Gets one of the longitudinal curves along the beam or extrusion. /// </summary> /// <param name="ci">The index of this profile.</param> /// <returns>The profile.</returns> public Curve WallEdge(ComponentIndex ci) { IntPtr pConstThis = ConstPointer(); IntPtr pCurve = UnsafeNativeMethods.ON_Extrusion_WallEdge(pConstThis, ci); return GeometryBase.CreateGeometryHelper(pCurve, null) as Curve; }
private bool FilterHandles(RhinoObject rObj, RC.GeometryBase geometry, RC.ComponentIndex index) { return(Host.Instance.Handles.Links.ContainsSecond(rObj.Id)); }
internal static extern IntPtr CRhinoObject_Geometry(uint rhino_object_serial_number, ComponentIndex componentIndex);
/// <summary>Reports if an object can be selected.</summary> /// <param name="componentIndex">Index of subobject to check.</param> /// <param name="select">The new selection state; true activates selection.</param> /// <param name="syncHighlight"> /// (default=true) /// If true, then the object is highlighted if it is selected /// and unhighlighted if is is not selected. /// </param> /// <returns> /// 0: object is not selected /// 1: object is selected /// 2: object is selected persistently. /// </returns> /// <remarks> /// Objects that are locked, hidden, or on locked or hidden layers /// cannot be selected. If IsSelectableWithGripsOn() returns false, /// then an that object is not selectable if it has grips turned on. /// </remarks> public int SelectSubObject(ComponentIndex componentIndex, bool select, bool syncHighlight) { IntPtr ptr = ConstPointer(); return UnsafeNativeMethods.CRhinoObject_SelectSubObject(ptr, componentIndex, select, syncHighlight); }
internal static extern void CRhinoObjRef_GeometryComponentIndex(IntPtr pConstRhinoObjRef, ref ComponentIndex pComponentIndex);
internal static extern void ON_ComponentIndexArray_CopyValues(IntPtr pArray, ref ComponentIndex ci);
internal static extern bool ON_Brep_GetClosestPoint(IntPtr pBrep, Point3d testPoint, ref Point3d closestPoint, ref ComponentIndex ci, ref double u, ref double v, double maximumDistance, ref Vector3d normal);
internal static extern int CRhinoObject_SelectSubObject(IntPtr pConstRhinoObject, ComponentIndex componentIndex, [MarshalAs(UnmanagedType.U1)]bool select, [MarshalAs(UnmanagedType.U1)]bool syncHighlight);
internal static extern bool CRhinoObject_IsSubObjectHighlighted(IntPtr pRhinoObject, ComponentIndex componentIndex);
/// <summary> /// Highlights a subobject. /// </summary> /// <param name="componentIndex">A subobject component index.</param> /// <param name="highlight">true if the subobject should be highlighted.</param> /// <returns>true if the subobject is now highlighted.</returns> public bool HighlightSubObject(ComponentIndex componentIndex, bool highlight) { IntPtr ptr = ConstPointer(); return UnsafeNativeMethods.CRhinoObject_HighlightSubObject(ptr, componentIndex, highlight); }
/// <summary> /// Determines if a subobject is highlighted. /// </summary> /// <param name="componentIndex">A subobject component index.</param> /// <returns>true if the subobject is highlighted.</returns> public bool IsSubObjectHighlighted(ComponentIndex componentIndex) { IntPtr ptr = ConstPointer(); return UnsafeNativeMethods.CRhinoObject_IsSubObjectHighlighted(ptr, componentIndex); }
internal static extern IntPtr ON_Extrusion_WallSurface(IntPtr pConstExtrusion, ComponentIndex componentIndex);
// [skipping] BOOL SwapCoordinates( int i, int j ); // Not exposed here // virtual bool Morph( const ON_SpaceMorph& morph ); // virtual bool IsMorphable() const; // Moved to SpaceMorph class // Not exposed here // bool HasBrepForm() const; // ON_Brep* BrepForm( ON_Brep* brep = NULL ) const; // Implemented in static Brep.TryConvertBrep function /// <summary> /// If this piece of geometry is a component in something larger, like a BrepEdge /// in a Brep, then this function returns the component index. /// </summary> /// <returns> /// This object's component index. If this object is not a sub-piece of a larger /// geometric entity, then the returned index has /// m_type = ComponentIndex.InvalidType /// and m_index = -1. /// </returns> public ComponentIndex ComponentIndex() { ComponentIndex ci = new ComponentIndex(); IntPtr ptr = ConstPointer(); UnsafeNativeMethods.ON_Geometry_ComponentIndex(ptr, ref ci); return ci; }
/// <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 always returns true.</returns> public virtual bool CustomGeometryFilter( DocObjects.RhinoObject rhObject, GeometryBase geometry, ComponentIndex componentIndex ) { return true; }
internal static extern bool CRhinoObject_IsSubObjectSelectable(IntPtr pConstRhinoObject, ComponentIndex componentIndex, [MarshalAs(UnmanagedType.U1)]bool ignoreSelectionState);
/// <summary>Reports if a subobject can be selected.</summary> /// <param name="componentIndex">index of subobject to check.</param> /// <param name="ignoreSelectionState"> /// If true, then selected objects are selectable. /// If false, then selected objects are not selectable. /// </param> /// <returns>true if the specified subobject can be selected.</returns> /// <remarks> /// Objects that are locked, hidden, or on locked or hidden layers /// cannot be selected. If IsSelectableWithGripsOn() returns false, /// then that object is not selectable if it has grips turned on. /// </remarks> public bool IsSubObjectSelectable(ComponentIndex componentIndex, bool ignoreSelectionState) { IntPtr ptr = ConstPointer(); return UnsafeNativeMethods.CRhinoObject_IsSubObjectSelectable(ptr, componentIndex, ignoreSelectionState); }
internal static extern IntPtr ON_Extrusion_Profile3d2(IntPtr pConstExtrusion, ComponentIndex componentIndex);
private static GetObject m_active_go; // = null; [runtime default] 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; }
internal static extern void ON_Geometry_ComponentIndex(IntPtr ptr, ref ComponentIndex ci);
internal static extern bool CRhinoObject_IsSubObjectSelected(IntPtr pConstRhinoObject, ComponentIndex componentIndex);
/// <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); }
internal static extern bool CRhinoObject_HighlightSubObject(IntPtr pRhinoObject, ComponentIndex componentIndex, [MarshalAs(UnmanagedType.U1)]bool highlight);
private static bool CustomGeometryFilter(IntPtr rhObject, IntPtr ptrGeometry, ComponentIndex componentIndex) { bool rc = true; if (g_active_go != null) { try { RhinoObject rh_object = RhinoObject.CreateRhinoObjectHelper(rhObject); GeometryBase geom = GeometryBase.CreateGeometryHelper(ptrGeometry, rh_object); rc = g_active_go.CustomGeometryFilter(rh_object, geom, componentIndex); } catch (Exception ex) { Runtime.HostUtils.ExceptionReport(ex); } } return rc; }
internal static extern bool CRhinoGetObject_PassesGeometryAttributeFilter(IntPtr ptr, IntPtr pRhinoObject, IntPtr pGeometry, ComponentIndex ci);
/// <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; }
internal static extern void CRhinoObjRef_SetSelectionComponent(IntPtr pRhinoObjRef, ComponentIndex componentIndex);