コード例 #1
0
 public GHPipeConverter()
 {
     AddConverter(new PipeConverter <GH_Number, PipeNumber>(
                      (ghNum) => { return(new PipeNumber(ghNum.Value)); },
                      (pData) => { return(new GH_Number(pData.Value)); }
                      ));
     AddConverter(new PipeConverter <GH_String, PipeString>(
                      (ghStr) => { return(new PipeString(ghStr.Value)); },
                      (pData) => { return(new GH_String(pData.Value)); }
                      ));
     AddConverter(new PipeConverter <GH_Point, ppg.Vec>(
                      (ghpt) => { return(_pt3dConv.ToPipe <rh.Point3d, ppg.Vec>(ghpt.Value)); },
                      (ppt) => { return(new GH_Point(_pt3dConv.FromPipe <rh.Point3d, ppg.Vec>(ppt))); }
                      ));
     AddConverter(new PipeConverter <GH_Curve, ppc.Curve>(
                      (ghc) => { return(_curveConv.ToPipe <rh.Curve, ppc.Curve>(ghc.Value)); },
                      (ppc) => { return(new GH_Curve(_curveConv.FromPipe <rh.Curve, ppc.Curve>(ppc))); }
                      ));
     AddConverter(new PipeConverter <GH_Line, ppc.Line>(
                      (ghl) => { return(_lineConv.ToPipe <rh.Line, ppc.Line>(ghl.Value)); },
                      (ppl) => { return(new GH_Line(_lineConv.FromPipe <rh.Line, ppc.Line>(ppl))); }
                      ));
     AddConverter(new PipeConverter <GH_Mesh, ppg.Mesh>(
                      (ghm) => { return(_meshConv.ToPipe <rh.Mesh, ppg.Mesh>(ghm.Value)); },
                      (ppm) => { return(new GH_Mesh(_meshConv.FromPipe <rh.Mesh, ppg.Mesh>(ppm))); }
                      ));
     AddConverter(new PipeConverter <GH_Surface, pps.Surface>(
                      (ghs) => { return(_surfConv.ToPipe <rh.Surface, pps.Surface>(ghs.Value.Surfaces.FirstOrDefault())); },
                      (pps) => { return(new GH_Surface(_surfConv.FromPipe <rh.Surface, pps.Surface>(pps))); }
                      ));
     AddConverter(new PipeConverter <GH_Brep, pps.PolySurface>(
                      (ghs) => { return(_brepConv.ToPipe <rh.Brep, pps.PolySurface>(ghs.Value)); },
                      (pps) => { return(new GH_Brep(_brepConv.FromPipe <rh.Brep, pps.PolySurface>(pps))); }
                      ));
 }