public Brep[] CreatePolySurfaces(DimensionStyle dimstyle, double height, double smallCapsScale = 1.0, double spacing = 0.0) { IntPtr const_ptr_parent = IntPtr.Zero; IntPtr const_ptr_this = IntPtr.Zero; TextObject parent = _GetConstObjectParent() as TextObject; if (null != parent) { const_ptr_parent = parent.ConstPointer(); } else { const_ptr_this = ConstPointer(); } Runtime.InteropWrappers.SimpleArrayBrepPointer breps = new Runtime.InteropWrappers.SimpleArrayBrepPointer(); IntPtr ptr_breps = breps.NonConstPointer(); var const_ptr_dimstyle = dimstyle.ConstPointer(); UnsafeNativeMethods.RHC_RhinoGet3dBrepsFromText(const_ptr_parent, const_ptr_this, const_ptr_dimstyle, smallCapsScale, height, spacing, ptr_breps); return(breps.ToNonConstArray()); }
/// <summary> /// Projects a collection of Curves onto a collection of Breps along a given direction. /// </summary> /// <param name="curves">Curves to project.</param> /// <param name="breps">Breps to project onto.</param> /// <param name="direction">Direction of projection.</param> /// <param name="tolerance">Tolerance to use for projection.</param> /// <param name="curveIndices">Index of which curve in the input list was the source for a curve in the return array.</param> /// <param name="brepIndices">Index of which brep was used to generate a curve in the return array.</param> /// <returns>An array of projected curves. Array is empty if the projection set is empty.</returns> public static Curve[] ProjectToBrep(IEnumerable<Curve> curves, IEnumerable<Brep> breps, Vector3d direction, double tolerance, out int[] curveIndices, out int[] brepIndices) { curveIndices = null; brepIndices = null; foreach (Curve crv in curves) { if (crv == null) { throw new ArgumentNullException("curves"); } } foreach (Brep brp in breps) { if (brp == null) { throw new ArgumentNullException("breps"); } } SimpleArrayCurvePointer crv_array = new SimpleArrayCurvePointer(curves); Runtime.InteropWrappers.SimpleArrayBrepPointer brp_array = new Runtime.InteropWrappers.SimpleArrayBrepPointer(); foreach (Brep brp in breps) { brp_array.Add(brp, true); } IntPtr ptr_crv_array = crv_array.ConstPointer(); IntPtr ptr_brp_array = brp_array.ConstPointer(); SimpleArrayInt brp_top = new SimpleArrayInt(); SimpleArrayInt crv_top = new SimpleArrayInt(); SimpleArrayCurvePointer rc = new SimpleArrayCurvePointer(); IntPtr ptr_rc = rc.NonConstPointer(); if (UnsafeNativeMethods.RHC_RhinoProjectCurveToBrepEx(ptr_brp_array, ptr_crv_array, direction, tolerance, ptr_rc, brp_top.m_ptr, crv_top.m_ptr)) { brepIndices = brp_top.ToArray(); curveIndices = crv_top.ToArray(); return rc.ToNonConstArray(); } return new Curve[0]; }