コード例 #1
0
ファイル: rhinosdksweep.cs プロジェクト: gnalxom/rhino3dm
            IntPtr m_ptr; //CArgsRhinoSweep2*
            public static ArgsSweep2 Construct(Curve rail1, Curve rail2, IEnumerable <Curve> crossSections,
                                               IEnumerable <double> crossSectionParameters1, IEnumerable <double> crossSectionParameters2,
                                               bool closed, double sweep_tol, double angle_tol, bool maintain_height)
            {
                ArgsSweep2    rc      = new ArgsSweep2();
                List <Curve>  xsec    = new List <Curve>(crossSections);
                List <double> xsec_t1 = new List <double>(crossSectionParameters1);
                List <double> xsec_t2 = new List <double>(crossSectionParameters2);

                if (xsec.Count < 1)
                {
                    throw new ArgumentException("must have at least one cross section");
                }
                if (xsec.Count != xsec_t1.Count || xsec.Count != xsec_t2.Count)
                {
                    throw new ArgumentException("must have same number of elements in crossSections and crossSectionParameters");
                }

                IntPtr pConstRail1 = rail1.ConstPointer();
                IntPtr pConstRail2 = rail2.ConstPointer();

                using (var sections = new Rhino.Runtime.InteropWrappers.SimpleArrayCurvePointer(crossSections))
                {
                    IntPtr   pSections = sections.ConstPointer();
                    double[] tvals1    = xsec_t1.ToArray();
                    double[] tvals2    = xsec_t2.ToArray();
                    rc.m_ptr = UnsafeNativeMethods.CArgsRhinoSweep2_New(pConstRail1, pConstRail2, pSections, tvals1, tvals2, closed, sweep_tol, angle_tol, maintain_height);
                }
                return(rc);
            }
コード例 #2
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);
            }
        }
コード例 #3
0
      IntPtr m_ptr; //CArgsRhinoSweep2*
      public static ArgsSweep2 Construct(Curve rail1, Curve rail2, IEnumerable<Curve> crossSections,
        IEnumerable<double> crossSectionParameters1, IEnumerable<double> crossSectionParameters2,
        bool closed, double sweep_tol, double angle_tol, bool maintain_height)
      {
        ArgsSweep2 rc = new ArgsSweep2();
        List<Curve> xsec = new List<Curve>(crossSections);
        List<double> xsec_t1 = new List<double>(crossSectionParameters1);
        List<double> xsec_t2 = new List<double>(crossSectionParameters2);
        if (xsec.Count < 1)
          throw new ArgumentException("must have at least one cross section");
        if (xsec.Count != xsec_t1.Count || xsec.Count != xsec_t2.Count)
          throw new ArgumentException("must have same number of elements in crossSections and crossSectionParameters");

        IntPtr pConstRail1 = rail1.ConstPointer();
        IntPtr pConstRail2 = rail2.ConstPointer();
        using (var sections = new Rhino.Runtime.InteropWrappers.SimpleArrayCurvePointer(crossSections))
        {
          IntPtr pSections = sections.ConstPointer();
          double[] tvals1 = xsec_t1.ToArray();
          double[] tvals2 = xsec_t2.ToArray();
          rc.m_ptr = UnsafeNativeMethods.CArgsRhinoSweep2_New(pConstRail1, pConstRail2, pSections, tvals1, tvals2, closed, sweep_tol, angle_tol, maintain_height);
        }
        return rc;
      }