コード例 #1
0
ファイル: rhinosdksweep.cs プロジェクト: gnalxom/rhino3dm
        /// <since>5.0</since>
        public Brep[] PerformSweep(Curve rail, IEnumerable <Curve> crossSections, IEnumerable <double> crossSectionParameters)
        {
            List <Curve>  sections   = new List <Curve>(crossSections);
            List <double> parameters = new List <double>(crossSectionParameters);

            if (sections.Count > 1 && sections.Count == parameters.Count)
            {
                Curve[]  crvs = sections.ToArray();
                double[] par  = parameters.ToArray();
                Array.Sort(par, crvs);
                crossSections          = crvs;
                crossSectionParameters = par;
            }

            ArgsSweep1 sweep = ArgsSweep1.Construct(rail, crossSections, crossSectionParameters, m_roadlike_up, m_bClosed, m_sweep_tol, m_angle_tol, m_miter_type);

            Runtime.InteropWrappers.SimpleArrayBrepPointer breps = new Rhino.Runtime.InteropWrappers.SimpleArrayBrepPointer();
            IntPtr pArgsSweep1 = sweep.NonConstPointer();
            IntPtr pBreps      = breps.NonConstPointer();

            UnsafeNativeMethods.RHC_Sweep1(pArgsSweep1, pBreps, m_shape_blending);
            Brep[] rc = breps.ToNonConstArray();
            sweep.Dispose();
            breps.Dispose();
            return(rc);
        }
コード例 #2
0
ファイル: rhinosdksweep.cs プロジェクト: gnalxom/rhino3dm
        /// <since>5.0</since>
        public Brep[] PerformSweepRebuild(Curve rail, IEnumerable <Curve> crossSections, IEnumerable <double> crossSectionParameters, int rebuildCount)
        {
            ArgsSweep1 sweep = ArgsSweep1.Construct(rail, crossSections, crossSectionParameters, m_roadlike_up, m_bClosed, m_sweep_tol, m_angle_tol, m_miter_type);

            Runtime.InteropWrappers.SimpleArrayBrepPointer breps = new Rhino.Runtime.InteropWrappers.SimpleArrayBrepPointer();
            IntPtr pArgsSweep1 = sweep.NonConstPointer();
            IntPtr pBreps      = breps.NonConstPointer();

            UnsafeNativeMethods.RHC_Sweep1Rebuild(pArgsSweep1, pBreps, rebuildCount, m_shape_blending);
            Brep[] rc = breps.ToNonConstArray();
            sweep.Dispose();
            breps.Dispose();
            return(rc);
        }
コード例 #3
0
        public Brep[] PerformSweepRebuild(Curve rail1, Curve rail2, IEnumerable <Curve> crossSections, IEnumerable <double> crossSectionParametersRail1, IEnumerable <double> crossSectionParametersRail2, int rebuildCount)
        {
            ArgsSweep2 sweep = ArgsSweep2.Construct(rail1, rail2, crossSections, crossSectionParametersRail1, crossSectionParametersRail2, m_bClosed, m_sweep_tol, m_angle_tol, MaintainHeight);

            using (var breps = new Rhino.Runtime.InteropWrappers.SimpleArrayBrepPointer())
            {
                IntPtr pArgsSweep2 = sweep.NonConstPointer();
                IntPtr pBreps      = breps.NonConstPointer();
                UnsafeNativeMethods.RHC_Sweep2Rebuild(pArgsSweep2, pBreps, rebuildCount);
                Brep[] rc = breps.ToNonConstArray();
                sweep.Dispose();
                return(rc);
            }
        }
コード例 #4
0
    /// <summary>
    /// Projects points onto breps.
    /// </summary>
    /// <param name="breps">The breps projection targets.</param>
    /// <param name="points">The points to project.</param>
    /// <param name="direction">The direction to project.</param>
    /// <param name="tolerance">The tolerance used for intersections.</param>
    /// <returns>
    /// Array of projected points, or null in case of any error or invalid input.
    /// </returns>
    /// <example>
    /// <code source='examples\vbnet\ex_projectpointstobreps.vb' lang='vbnet'/>
    /// <code source='examples\cs\ex_projectpointstobreps.cs' lang='cs'/>
    /// <code source='examples\py\ex_projectpointstobreps.py' lang='py'/>
    /// </example>
    public static Point3d[] ProjectPointsToBreps(IEnumerable<Brep> breps, IEnumerable<Point3d> points, Vector3d direction, double tolerance)
    {
      Point3d[] rc = null;
      if (breps != null && points != null)
      {
        Rhino.Runtime.InteropWrappers.SimpleArrayBrepPointer brep_array = new Rhino.Runtime.InteropWrappers.SimpleArrayBrepPointer();
        foreach (Brep brep in breps)
          brep_array.Add(brep, true);

        Rhino.Collections.Point3dList inputpoints = new Rhino.Collections.Point3dList(points);
        if (inputpoints.Count > 0)
        {
          IntPtr pConstBrepArray = brep_array.ConstPointer();

          using (Runtime.InteropWrappers.SimpleArrayPoint3d output = new Rhino.Runtime.InteropWrappers.SimpleArrayPoint3d())
          {
            IntPtr pOutput = output.NonConstPointer();
            if (UnsafeNativeMethods.RHC_RhinoProjectPointsToBreps(pConstBrepArray, direction, tolerance, inputpoints.Count, inputpoints.m_items, pOutput))
              rc = output.ToArray();
          }
        }
      }
      return rc;
    }
コード例 #5
0
 public Brep[] PerformSweepRebuild(Curve rail1, Curve rail2, IEnumerable<Curve> crossSections, IEnumerable<double> crossSectionParametersRail1, IEnumerable<double> crossSectionParametersRail2, int rebuildCount)
 {
   ArgsSweep2 sweep = ArgsSweep2.Construct(rail1, rail2, crossSections, crossSectionParametersRail1, crossSectionParametersRail2, m_bClosed, m_sweep_tol, m_angle_tol, MaintainHeight);
   using (var breps = new Rhino.Runtime.InteropWrappers.SimpleArrayBrepPointer())
   {
     IntPtr pArgsSweep2 = sweep.NonConstPointer();
     IntPtr pBreps = breps.NonConstPointer();
     UnsafeNativeMethods.RHC_Sweep2Rebuild(pArgsSweep2, pBreps, rebuildCount);
     Brep[] rc = breps.ToNonConstArray();
     sweep.Dispose();
     return rc;
   }
 }
コード例 #6
0
 public Brep[] PerformSweepRebuild(Curve rail, IEnumerable<Curve> crossSections, IEnumerable<double> crossSectionParameters, int rebuildCount)
 {
   ArgsSweep1 sweep = ArgsSweep1.Construct(rail, crossSections, crossSectionParameters, m_roadlike_up, m_bClosed, m_sweep_tol, m_angle_tol, m_miter_type);
   Runtime.InteropWrappers.SimpleArrayBrepPointer breps = new Rhino.Runtime.InteropWrappers.SimpleArrayBrepPointer();
   IntPtr pArgsSweep1 = sweep.NonConstPointer();
   IntPtr pBreps = breps.NonConstPointer();
   UnsafeNativeMethods.RHC_Sweep1Rebuild(pArgsSweep1, pBreps, rebuildCount);
   Brep[] rc = breps.ToNonConstArray();
   sweep.Dispose();
   breps.Dispose();
   return rc;
 }
コード例 #7
0
    public Brep[] PerformSweep(Curve rail, IEnumerable<Curve> crossSections, IEnumerable<double> crossSectionParameters)
    {
      List<Curve> sections = new List<Curve>(crossSections);
      List<double> parameters = new List<double>(crossSectionParameters);
      if (sections.Count > 1 && sections.Count == parameters.Count)
      {
        Curve[] crvs = sections.ToArray();
        double[] par = parameters.ToArray();
        Array.Sort(par, crvs);
        crossSections = crvs;
        crossSectionParameters = par;
      }

      ArgsSweep1 sweep = ArgsSweep1.Construct(rail, crossSections, crossSectionParameters, m_roadlike_up, m_bClosed, m_sweep_tol, m_angle_tol, m_miter_type);
      Runtime.InteropWrappers.SimpleArrayBrepPointer breps = new Rhino.Runtime.InteropWrappers.SimpleArrayBrepPointer();
      IntPtr pArgsSweep1 = sweep.NonConstPointer();
      IntPtr pBreps = breps.NonConstPointer();
      UnsafeNativeMethods.RHC_Sweep1(pArgsSweep1, pBreps);
      Brep[] rc = breps.ToNonConstArray();
      sweep.Dispose();
      breps.Dispose();
      return rc;
    }