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
    }
示例#2
0
        /// <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);
        }
示例#3
0
        /// <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);
        }
示例#4
0
        /// <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);
        }
示例#5
0
        /// <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);
        }
示例#6
0
        public ComponentIndex ComponentIndex()
        {
            ComponentIndex ci  = new ComponentIndex();
            IntPtr         ptr = ConstPointer();

            UnsafeNativeMethods.ON_Geometry_ComponentIndex(ptr, ref ci);
            return(ci);
        }
示例#7
0
 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;
 }
示例#8
0
        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;
 }
示例#10
0
            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);
            }
示例#11
0
        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;
        }
示例#12
0
    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);
            }
示例#14
0
 /// <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;
 }
示例#15
0
 /// <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;
 }
示例#16
0
 private bool FilterHandles(RhinoObject rObj, RC.GeometryBase geometry, RC.ComponentIndex index)
 {
     return(Host.Instance.Handles.Links.ContainsSecond(rObj.Id));
 }
示例#17
0
 internal static extern IntPtr CRhinoObject_Geometry(uint rhino_object_serial_number, ComponentIndex componentIndex);
示例#18
0
 /// <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);
 }
示例#19
0
 internal static extern void CRhinoObjRef_GeometryComponentIndex(IntPtr pConstRhinoObjRef, ref ComponentIndex pComponentIndex);
示例#20
0
 internal static extern void ON_ComponentIndexArray_CopyValues(IntPtr pArray, ref ComponentIndex ci);
示例#21
0
 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);
示例#22
0
 internal static extern int CRhinoObject_SelectSubObject(IntPtr pConstRhinoObject, ComponentIndex componentIndex, [MarshalAs(UnmanagedType.U1)]bool select, [MarshalAs(UnmanagedType.U1)]bool syncHighlight);
示例#23
0
 internal static extern bool CRhinoObject_IsSubObjectHighlighted(IntPtr pRhinoObject, ComponentIndex componentIndex);
示例#24
0
 /// <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);
 }
示例#25
0
 /// <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);
 }
示例#26
0
 internal static extern IntPtr ON_Extrusion_WallSurface(IntPtr pConstExtrusion, ComponentIndex componentIndex);
示例#27
0
    // [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;
    }
示例#28
0
 /// <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;
 }
示例#29
0
 internal static extern bool CRhinoObject_IsSubObjectSelectable(IntPtr pConstRhinoObject, ComponentIndex componentIndex, [MarshalAs(UnmanagedType.U1)]bool ignoreSelectionState);
示例#30
0
 /// <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);
 }
示例#31
0
 internal static extern IntPtr ON_Extrusion_Profile3d2(IntPtr pConstExtrusion, ComponentIndex componentIndex);
示例#32
0
 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;
 }
示例#33
0
 internal static extern void ON_Geometry_ComponentIndex(IntPtr ptr, ref ComponentIndex ci);
示例#34
0
 internal static extern bool CRhinoObject_IsSubObjectSelected(IntPtr pConstRhinoObject, ComponentIndex componentIndex);
示例#35
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);
 }
示例#36
0
 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;
 }
示例#38
0
 internal static extern bool CRhinoGetObject_PassesGeometryAttributeFilter(IntPtr ptr, IntPtr pRhinoObject, IntPtr pGeometry, ComponentIndex ci);
示例#39
0
 /// <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;
 }
示例#40
0
 internal static extern void CRhinoObjRef_SetSelectionComponent(IntPtr pRhinoObjRef, ComponentIndex componentIndex);