Example #1
0
 /// <summary>
 /// Returns the underlying const ON_Geometry* for a RhinoCommon class. You should only
 /// be interested in using this function if you are writing C++ code.
 /// </summary>
 /// <param name="geometry">A geometry object. This can be null and in such a case <see cref="IntPtr.Zero"/> is returned.</param>
 /// <returns>A pointer to the const geometry.</returns>
 public static IntPtr NativeGeometryConstPointer(Geometry.GeometryBase geometry)
 {
   IntPtr rc = IntPtr.Zero;
   if (geometry != null)
     rc = geometry.ConstPointer();
   return rc;
 }
Example #2
0
 public bool UpdateToLeader(Geometry.Leader leader, DocObjects.ObjectAttributes attributes)
 {
   IntPtr pConstAttributes = (attributes == null) ? IntPtr.Zero : attributes.ConstPointer();
   IntPtr pConstLeader = leader.ConstPointer();
   return UnsafeNativeMethods.CRhinoObjectPairArray_UpdateToLeader(m_parent.m_pObjectPairArray, m_index, pConstLeader, pConstAttributes);
 }
Example #3
0
 public bool UpdateToBrep(Geometry.Brep brep, DocObjects.ObjectAttributes attributes)
 {
   IntPtr pConstAttributes = (attributes == null) ? IntPtr.Zero : attributes.ConstPointer();
   IntPtr pConstBrep = brep.ConstPointer();
   return UnsafeNativeMethods.CRhinoObjectPairArray_UpdateToBrep(m_parent.m_pObjectPairArray, m_index, pConstBrep, pConstAttributes);
 }
Example #4
0
 public bool UpdateToExtrusion(Geometry.Extrusion extrusion, DocObjects.ObjectAttributes attributes)
 {
   IntPtr pConstAttributes = (attributes == null) ? IntPtr.Zero : attributes.ConstPointer();
   IntPtr pConstExtrusion = extrusion.ConstPointer();
   return UnsafeNativeMethods.CRhinoObjectPairArray_UpdateToExtrusion(m_parent.m_pObjectPairArray, m_index, pConstExtrusion, pConstAttributes);
 }
Example #5
0
 public bool UpdateToSurface(Geometry.Surface surface, DocObjects.ObjectAttributes attributes)
 {
   IntPtr pConstAttributes = (attributes == null) ? IntPtr.Zero : attributes.ConstPointer();
   IntPtr pConstSurface = surface.ConstPointer();
   return UnsafeNativeMethods.CRhinoObjectPairArray_UpdateToSurface(m_parent.m_pObjectPairArray, m_index, pConstSurface, pConstAttributes);
 }
Example #6
0
 public bool UpdateToText(Geometry.TextEntity text, DocObjects.ObjectAttributes attributes)
 {
   IntPtr pConstAttributes = (attributes == null) ? IntPtr.Zero : attributes.ConstPointer();
   IntPtr pConstText = text.ConstPointer();
   return UnsafeNativeMethods.CRhinoObjectPairArray_UpdateToText2(m_parent.m_pObjectPairArray, m_index, pConstText, pConstAttributes);
 }
Example #7
0
 /// <summary>Constrains the picked point to lie on a surface.</summary>
 /// <param name="surface">A surface to use as constraint.</param>
 /// <param name="allowPickingPointOffObject">
 /// defines whether the point pick is allowed to happen off object. When false,
 /// a "no no" cursor is shown when the cursor is not on the object. When true,
 /// a normal point picking cursor is used and the marker is visible also when
 /// the cursor is not on the object.
 /// </param>
 /// <returns>true if constraint could be applied.</returns>
 /// <example>
 /// <code source='examples\vbnet\ex_orientonsrf.vb' lang='vbnet'/>
 /// <code source='examples\cs\ex_orientonsrf.cs' lang='cs'/>
 /// <code source='examples\py\ex_orientonsrf.py' lang='py'/>
 /// </example>
 public bool Constrain(Geometry.Surface surface, bool allowPickingPointOffObject)
 {
   IntPtr ptr = NonConstPointer();
   IntPtr pSurface = surface.ConstPointer();
   return UnsafeNativeMethods.CRhinoGetPoint_Constrain8(ptr, pSurface, allowPickingPointOffObject);
 }
Example #8
0
 /// <summary>
 /// Adds a mesh to the list.
 /// </summary>
 /// <param name="mesh">A mesh to add.</param>
 /// <param name="asConst">Whether this mesh should be treated as non-modifiable.</param>
 public void Add(Geometry.Mesh mesh, bool asConst)
 {
   if (null != mesh)
   {
     IntPtr pMesh = mesh.ConstPointer();
     if (!asConst)
       pMesh = mesh.NonConstPointer();
     IntPtr ptr = NonConstPointer();
     UnsafeNativeMethods.ON_MeshArray_Append(ptr, pMesh);
   }
 }
Example #9
0
 public bool SetBrep(int id, Geometry.Brep value)
 {
   IntPtr pThis = NonConstPointer();
   IntPtr pConstBrep = value.ConstPointer();
   return UnsafeNativeMethods.CRhinoHistory_SetBrep(pThis, id, pConstBrep);
 }
Example #10
0
 public bool SetSurface(int id, Geometry.Surface value)
 {
   IntPtr pThis = NonConstPointer();
   IntPtr pConstSurface = value.ConstPointer();
   return UnsafeNativeMethods.CRhinoHistory_SetSurface(pThis, id, pConstSurface);
 }
 /// <summary>
 /// Draw a typical Rhino Curvature Graph.
 /// </summary>
 /// <param name="curve">Base curve for curvature graph.</param>
 /// <param name="color">Color of curvature graph.</param>
 /// <param name="hairScale">100 = true length, &gt; 100 magnified, &lt; 100 shortened.</param>
 /// <param name="hairDensity">&gt;= 0 larger numbers = more hairs (good default is 1).</param>
 /// <param name="sampleDensity">Between 1 and 10. Higher numbers draw smoother outer curves. (good default is 2).</param>
 public void DrawCurvatureGraph(Geometry.Curve curve, System.Drawing.Color color, int hairScale, int hairDensity, int sampleDensity)
 {
   int argb = color.ToArgb();
   IntPtr pCurve = curve.ConstPointer();
   UnsafeNativeMethods.CRhinoDisplayPipeline_DrawCurvatureGraph(m_ptr, pCurve, argb, hairScale, hairDensity, sampleDensity);
 }
 /// <summary>
 /// Draw a typical Rhino Curvature Graph.
 /// </summary>
 /// <param name="curve">Base curve for curvature graph.</param>
 /// <param name="color">Color of curvature graph.</param>
 public void DrawCurvatureGraph(Geometry.Curve curve, System.Drawing.Color color)
 {
   int argb = color.ToArgb();
   IntPtr pCurve = curve.ConstPointer();
   UnsafeNativeMethods.CRhinoDisplayPipeline_DrawCurvatureGraph(m_ptr, pCurve, argb, 100, 1, 2);
 }
Example #13
0
 /// <summary>Constrains the picked point to lie on a mesh.</summary>
 /// <param name="mesh">A mesh to use as constraint.</param>
 /// <param name="allowPickingPointOffObject">
 /// defines whether the point pick is allowed to happen off object. When false,
 /// a "no no" cursor is shown when the cursor is not on the object. When true,
 /// a normal point picking cursor is used and the marker is visible also when
 /// the cursor is not on the object.
 /// </param>
 /// <returns>true if constraint could be applied.</returns>
 public bool Constrain(Geometry.Mesh mesh, bool allowPickingPointOffObject)
 {
   IntPtr ptr = NonConstPointer();
   IntPtr pMesh = mesh.ConstPointer();
   return UnsafeNativeMethods.CRhinoGetPoint_ConstrainToMesh(ptr, pMesh, allowPickingPointOffObject);
 }
Example #14
0
 /// <summary>Constrains the picked point to lie on a brep.</summary>
 /// <param name="brep">A brep to use as constraint.</param>
 /// <param name="wireDensity">
 /// When wire_density&lt;0, isocurve intersection snapping is turned off, when wire_density>=0, the value
 /// defines the isocurve density used for isocurve intersection snapping.
 /// </param>
 /// <param name="faceIndex">
 /// When face_index &lt;0, constrain to whole brep. When face_index >=0, constrain to individual face.
 /// </param>
 /// <param name="allowPickingPointOffObject">
 /// defines whether the point pick is allowed to happen off object. When false,
 /// a "no no" cursor is shown when the cursor is not on the object. When true,
 /// a normal point picking cursor is used and the marker is visible also when
 /// the cursor is not on the object.
 /// </param>
 /// <returns>true if constraint could be applied.</returns>
 public bool Constrain(Geometry.Brep brep, int wireDensity, int faceIndex, bool allowPickingPointOffObject)
 {
   IntPtr ptr = NonConstPointer();
   IntPtr pBrep = brep.ConstPointer();
   return UnsafeNativeMethods.CRhinoGetPoint_Constrain9(ptr, pBrep, wireDensity, faceIndex, allowPickingPointOffObject);
 }
Example #15
0
 public bool UpdateToHatch(Geometry.Hatch hatch, DocObjects.ObjectAttributes attributes)
 {
   IntPtr pConstAttributes = (attributes == null) ? IntPtr.Zero : attributes.ConstPointer();
   IntPtr pConstHatch = hatch.ConstPointer();
   return UnsafeNativeMethods.CRhinoObjectPairArray_UpdateToHatch(m_parent.m_pObjectPairArray, m_index, pConstHatch, pConstAttributes);
 }
Example #16
0
 public bool SetMesh(int id, Geometry.Mesh value)
 {
   IntPtr pThis = NonConstPointer();
   IntPtr pConstMesh = value.ConstPointer();
   return UnsafeNativeMethods.CRhinoHistory_SetMesh(pThis, id, pConstMesh);
 }
Example #17
0
 public bool UpdateToAngularDimension(Geometry.AngularDimension dimension, ObjectAttributes attributes)
 {
   IntPtr pConstDimension = dimension.ConstPointer();
   IntPtr pConstAttributes = (attributes == null) ? IntPtr.Zero : attributes.ConstPointer();
   return UnsafeNativeMethods.CRhinoObjectPairArray_UpdateResult7(m_parent.m_pObjectPairArray, m_index, pConstDimension, pConstAttributes);
 }
Example #18
0
 /// <summary>
 /// Adds a brep to the list.
 /// </summary>
 /// <param name="brep">A brep to add.</param>
 /// <param name="asConst">Whether this brep should be treated as non-modifiable.</param>
 public void Add(Geometry.Brep brep, bool asConst)
 {
   if (null != brep)
   {
     IntPtr pBrep = brep.ConstPointer();
     if (!asConst)
       pBrep = brep.NonConstPointer();
     IntPtr ptr = NonConstPointer();
     UnsafeNativeMethods.ON_BrepArray_Append(ptr, pBrep);
   }
 }
Example #19
0
 /// <summary>Constrains the picked point to lie on a curve.</summary>
 /// <param name="curve">A curve to use as constraint.</param>
 /// <param name="allowPickingPointOffObject">
 /// defines whether the point pick is allowed to happen off object. When false,
 /// a "no no" cursor is shown when the cursor is not on the object. When true,
 /// a normal point picking cursor is used and the marker is visible also when
 /// the cursor is not on the object.
 /// </param>
 /// <returns>true if constraint could be applied.</returns>
 /// <example>
 /// <code source='examples\vbnet\ex_insertknot.vb' lang='vbnet'/>
 /// <code source='examples\cs\ex_insertknot.cs' lang='cs'/>
 /// <code source='examples\py\ex_insertknot.py' lang='py'/>
 /// </example>
 public bool Constrain(Geometry.Curve curve, bool allowPickingPointOffObject)
 {
   IntPtr ptr = NonConstPointer();
   IntPtr pCurve = curve.ConstPointer();
   return UnsafeNativeMethods.CRhinoGetPoint_Constrain7(ptr, pCurve, allowPickingPointOffObject);
 }