• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Rhino类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Rhino的典型用法代码示例。如果您正苦于以下问题:C# Rhino类的具体用法?C# Rhino怎么用?C# Rhino使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Rhino类属于命名空间,在下文中一共展示了Rhino类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: RunCommand

    /// <summary>
    /// Rhino calls this function to run the command.
    /// </summary>
    protected override Rhino.Commands.Result RunCommand(Rhino.RhinoDoc doc, Rhino.Commands.RunMode mode)
    {
      const Rhino.DocObjects.ObjectType filter = Rhino.DocObjects.ObjectType.Curve;
      Rhino.DocObjects.ObjRef objref;
      Rhino.Commands.Result rc = Rhino.Input.RhinoGet.GetOneObject("Select curve to divide", false, filter, out objref);
      if (rc != Rhino.Commands.Result.Success || objref == null)
        return rc;

      Rhino.Geometry.Curve curve = objref.Curve();
      if (null == curve || curve.IsShort(Rhino.RhinoMath.ZeroTolerance))
        return Rhino.Commands.Result.Failure;

      int segmentCount = 2;
      rc = Rhino.Input.RhinoGet.GetInteger("Number of segments", false, ref segmentCount, 2, 100);
      if (rc != Rhino.Commands.Result.Success)
        return rc;

      Rhino.Geometry.Point3d[] points;
      curve.DivideByCount(segmentCount, true, out points);
      if (null == points)
        return Rhino.Commands.Result.Failure;

      // Create a history record
      Rhino.DocObjects.HistoryRecord history = new Rhino.DocObjects.HistoryRecord(this, _historyVersion);
      WriteHistory(history, objref, segmentCount, points.Length);

      for (int i = 0; i < points.Length; i++)
        doc.Objects.AddPoint(points[i], null, history, false);

      doc.Views.Redraw();

      return Rhino.Commands.Result.Success;
    }
开发者ID:jackieyin2015,项目名称:rhinocommon,代码行数:36,代码来源:ex_historyCommand.cs


示例2: AddMesh

    public static Rhino.Commands.Result AddMesh(Rhino.RhinoDoc doc)
    {
        Rhino.Geometry.Mesh mesh = new Rhino.Geometry.Mesh();
        mesh.Vertices.Add(0.0, 0.0, 1.0); //0
        mesh.Vertices.Add(1.0, 0.0, 1.0); //1
        mesh.Vertices.Add(2.0, 0.0, 1.0); //2
        mesh.Vertices.Add(3.0, 0.0, 0.0); //3
        mesh.Vertices.Add(0.0, 1.0, 1.0); //4
        mesh.Vertices.Add(1.0, 1.0, 2.0); //5
        mesh.Vertices.Add(2.0, 1.0, 1.0); //6
        mesh.Vertices.Add(3.0, 1.0, 0.0); //7
        mesh.Vertices.Add(0.0, 2.0, 1.0); //8
        mesh.Vertices.Add(1.0, 2.0, 1.0); //9
        mesh.Vertices.Add(2.0, 2.0, 1.0); //10
        mesh.Vertices.Add(3.0, 2.0, 1.0); //11

        mesh.Faces.AddFace(0, 1, 5, 4);
        mesh.Faces.AddFace(1, 2, 6, 5);
        mesh.Faces.AddFace(2, 3, 7, 6);
        mesh.Faces.AddFace(4, 5, 9, 8);
        mesh.Faces.AddFace(5, 6, 10, 9);
        mesh.Faces.AddFace(6, 7, 11, 10);
        mesh.Normals.ComputeNormals();
        mesh.Compact();
        if (doc.Objects.AddMesh(mesh) != Guid.Empty)
        {
          doc.Views.Redraw();
          return Rhino.Commands.Result.Success;
        }
        return Rhino.Commands.Result.Failure;
    }
开发者ID:acormier,项目名称:RhinoCommonExamples,代码行数:31,代码来源:ex_addmesh.cs


示例3: InsertKnot

  public static Rhino.Commands.Result InsertKnot(Rhino.RhinoDoc doc)
  {
    const ObjectType filter = Rhino.DocObjects.ObjectType.Curve;
    Rhino.DocObjects.ObjRef objref;
    Result rc = Rhino.Input.RhinoGet.GetOneObject("Select curve for knot insertion", false, filter, out objref);
    if (rc != Rhino.Commands.Result.Success)
      return rc;
    Rhino.Geometry.Curve curve = objref.Curve();
    if (null == curve)
      return Rhino.Commands.Result.Failure;
    Rhino.Geometry.NurbsCurve nurb = curve.ToNurbsCurve();
    if (null == nurb)
      return Rhino.Commands.Result.Failure;

    Rhino.Input.Custom.GetPoint gp = new Rhino.Input.Custom.GetPoint();
    gp.SetCommandPrompt("Point on curve to add knot");
    gp.Constrain(nurb, false);
    gp.Get();
    if (gp.CommandResult() == Rhino.Commands.Result.Success)
    {
      double t;
      Rhino.Geometry.Curve crv = gp.PointOnCurve(out t);
      if( crv!=null && nurb.Knots.InsertKnot(t) )
      {
        doc.Objects.Replace(objref, nurb);
        doc.Views.Redraw();
      }
    }
    return Rhino.Commands.Result.Success;  
  }
开发者ID:jackieyin2015,项目名称:rhinocommon,代码行数:30,代码来源:ex_insertknot.cs


示例4: CRhinoVisualAnalysisMode_SetCallbacks

 internal static extern void CRhinoVisualAnalysisMode_SetCallbacks(Rhino.Display.VisualAnalysisMode.ANALYSISMODEENABLEUIPROC enableui_proc,
   Rhino.Display.VisualAnalysisMode.ANALYSISMODEOBJECTSUPPORTSPROC objectSupportProc,
   Rhino.Display.VisualAnalysisMode.ANALYSISMODESHOWISOCURVESPROC showIsoCurvesProc,
   Rhino.Display.VisualAnalysisMode.ANALYSISMODESETDISPLAYATTRIBUTESPROC displayAttributesProc,
   Rhino.Display.VisualAnalysisMode.ANALYSISMODEUPDATEVERTEXCOLORSPROC updateVertexColorsProc,
   Rhino.Display.VisualAnalysisMode.ANALYSISMODEDRAWRHINOOBJECTPROC drawRhinoObjectProc,
   Rhino.Display.VisualAnalysisMode.ANALYSISMODEDRAWGEOMETRYPROC drawGeometryProc);
开发者ID:musamorena,项目名称:rhinocommon,代码行数:7,代码来源:Import.cs


示例5: MoveCPlane

  public static Rhino.Commands.Result MoveCPlane(Rhino.RhinoDoc doc)
  {
    Rhino.Display.RhinoView view = doc.Views.ActiveView;
    if (view == null)
      return Rhino.Commands.Result.Failure;

    Rhino.DocObjects.ConstructionPlane cplane = view.ActiveViewport.GetConstructionPlane();
    Point3d origin = cplane.Plane.Origin;

    MoveCPlanePoint gp = new MoveCPlanePoint(cplane);
    gp.SetCommandPrompt("CPlane origin");
    gp.SetBasePoint(origin, true);
    gp.DrawLineFromPoint(origin, true);
    gp.Get();

    if (gp.CommandResult() != Rhino.Commands.Result.Success)
      return gp.CommandResult();

    Point3d point = gp.Point();
    Vector3d v = origin - point;
    if (v.IsTiny())
      return Rhino.Commands.Result.Nothing;

    Plane pl = cplane.Plane;
    pl.Origin = point;
    cplane.Plane = pl;
    view.ActiveViewport.SetConstructionPlane(cplane);
    view.Redraw();
    return Rhino.Commands.Result.Success;
  }
开发者ID:jackieyin2015,项目名称:rhinocommon,代码行数:30,代码来源:ex_movecplane.cs


示例6: DivideByLengthPoints

  public static Rhino.Commands.Result DivideByLengthPoints(Rhino.RhinoDoc doc)
  {
    Rhino.DocObjects.ObjectType filter = Rhino.DocObjects.ObjectType.Curve; 
    Rhino.DocObjects.ObjRef objref = null;
    Rhino.Commands.Result rc = Rhino.Input.RhinoGet.GetOneObject("Select curve to divide", false, filter, out objref);
    if (rc != Rhino.Commands.Result.Success || objref == null)
      return rc;

    Rhino.Geometry.Curve crv = objref.Curve();
    if (crv == null || crv.IsShort(Rhino.RhinoMath.ZeroTolerance))
      return Rhino.Commands.Result.Failure;

    double crv_length = crv.GetLength();
    string s = string.Format("Curve length is {0:f3}. Segment length", crv_length);

    double seg_length = crv_length / 2.0;
    rc = Rhino.Input.RhinoGet.GetNumber(s, false, ref seg_length, 0, crv_length);
    if (rc != Rhino.Commands.Result.Success)
      return rc;

    Rhino.Geometry.Point3d[] points = null;
    crv.DivideByLength(seg_length, true, out points);
    if (points == null)
      return Rhino.Commands.Result.Failure;

    foreach (Rhino.Geometry.Point3d point in points)
      doc.Objects.AddPoint(point);

    doc.Views.Redraw();
    return Rhino.Commands.Result.Success;
  }
开发者ID:austinlaw,项目名称:rhinocommon,代码行数:31,代码来源:ex_dividebylength.cs


示例7: RunCommand

  protected override Rhino.Commands.Result RunCommand(RhinoDoc doc, Rhino.Commands.RunMode mode)
  {
    // make sure our custom visual analysis mode is registered
    var zmode = Rhino.Display.VisualAnalysisMode.Register(typeof(ZAnalysisMode));

    const ObjectType filter = Rhino.DocObjects.ObjectType.Surface | Rhino.DocObjects.ObjectType.PolysrfFilter | Rhino.DocObjects.ObjectType.Mesh;
    Rhino.DocObjects.ObjRef[] objs;
    var rc = Rhino.Input.RhinoGet.GetMultipleObjects("Select objects for Z analysis", false, filter, out objs);
    if (rc != Rhino.Commands.Result.Success)
      return rc;

    int count = 0;
    for (int i = 0; i < objs.Length; i++)
    {
      var obj = objs[i].Object();

      // see if this object is alreay in Z analysis mode
      if (obj.InVisualAnalysisMode(zmode))
        continue;

      if (obj.EnableVisualAnalysisMode(zmode, true))
        count++;
    }
    doc.Views.Redraw();
    RhinoApp.WriteLine("{0} objects were put into Z-Analysis mode.", count);
    return Rhino.Commands.Result.Success;
  }
开发者ID:jackieyin2015,项目名称:rhinocommon,代码行数:27,代码来源:ex_analysismode.cs


示例8: ExportControlPoints

  public static Rhino.Commands.Result ExportControlPoints(Rhino.RhinoDoc doc)
  {
    Rhino.DocObjects.ObjRef objref;
    var get_rc = Rhino.Input.RhinoGet.GetOneObject("Select curve", false, Rhino.DocObjects.ObjectType.Curve, out objref);
    if (get_rc != Rhino.Commands.Result.Success)
      return get_rc;
    var curve = objref.Curve();
    if (curve == null)
      return Rhino.Commands.Result.Failure;
    var nc = curve.ToNurbsCurve();

    var fd = new System.Windows.Forms.SaveFileDialog();
    fd.Filter = "Text Files | *.txt";
    fd.DefaultExt = "txt";
    if( fd.ShowDialog(Rhino.RhinoApp.MainWindow())!= System.Windows.Forms.DialogResult.OK)
      return Rhino.Commands.Result.Cancel;
    string path = fd.FileName;
    using( System.IO.StreamWriter sw = new System.IO.StreamWriter(path) )
    {
      foreach( var pt in nc.Points )
      {
        var loc = pt.Location;
        sw.WriteLine("{0} {1} {2}", loc.X, loc.Y, loc.Z);
      }
      sw.Close();
    }
    return Rhino.Commands.Result.Success;
  }
开发者ID:jackieyin2015,项目名称:rhinocommon,代码行数:28,代码来源:ex_exportcontrolpoints.cs


示例9: AddClippingPlane

  public static Rhino.Commands.Result AddClippingPlane(Rhino.RhinoDoc doc)
  {
    // Define the corners of the clipping plane
    Rhino.Geometry.Point3d[] corners;
    Rhino.Commands.Result rc = Rhino.Input.RhinoGet.GetRectangle(out corners);
    if (rc != Rhino.Commands.Result.Success)
      return rc;

    // Get the active view
    Rhino.Display.RhinoView view = doc.Views.ActiveView;
    if (view == null)
      return Rhino.Commands.Result.Failure;

    Rhino.Geometry.Point3d p0 = corners[0];
    Rhino.Geometry.Point3d p1 = corners[1];
    Rhino.Geometry.Point3d p3 = corners[3];

    // Create a plane from the corner points
    Rhino.Geometry.Plane plane = new Rhino.Geometry.Plane(p0, p1, p3);

    // Add a clipping plane object to the document
    Guid id = doc.Objects.AddClippingPlane(plane, p0.DistanceTo(p1), p0.DistanceTo(p3), view.ActiveViewportID);
    if (id != Guid.Empty)
    {
      doc.Views.Redraw();
      return Rhino.Commands.Result.Success;
    }
    return Rhino.Commands.Result.Failure;
  }
开发者ID:jackieyin2015,项目名称:rhinocommon,代码行数:29,代码来源:ex_addclippingplane.cs


示例10: RunCommand

    protected override Rhino.Commands.Result RunCommand(Rhino.RhinoDoc doc, Rhino.Commands.RunMode mode)
    {
      string filename = string.Empty;
      if (mode == Rhino.Commands.RunMode.Interactive)
        filename = Rhino.Input.RhinoGet.GetFileName(Rhino.Input.Custom.GetFileNameMode.OpenRhinoOnly, null, "Import", Rhino.RhinoApp.MainWindow());
      else
        Rhino.Input.RhinoGet.GetString("Name of Rhino file to import", false, ref filename);

      filename = filename.Trim();
      if (string.IsNullOrEmpty(filename))
        return Rhino.Commands.Result.Cancel;

      if (!System.IO.File.Exists(filename))
      {
        Rhino.RhinoApp.WriteLine("File not found.");
        return Rhino.Commands.Result.Failure;
      }

      // Make sure to surround filename string with double-quote characters
      // in case the path contains spaces.
      string script = string.Format("_-Import \"{0}\" _Enter", filename);
      Rhino.RhinoApp.RunScript(script, false);
      
      return Rhino.Commands.Result.Success;
    }
开发者ID:jackieyin2015,项目名称:rhinocommon,代码行数:25,代码来源:ex_import3dm.cs


示例11: DupBorder

  public static Rhino.Commands.Result DupBorder(Rhino.RhinoDoc doc)
  {
    const ObjectType filter = Rhino.DocObjects.ObjectType.Surface | Rhino.DocObjects.ObjectType.PolysrfFilter;
    Rhino.DocObjects.ObjRef objref;
    Rhino.Commands.Result rc = Rhino.Input.RhinoGet.GetOneObject("Select surface or polysurface", false, filter, out objref);
    if (rc != Rhino.Commands.Result.Success || objref == null)
      return rc;

    Rhino.DocObjects.RhinoObject rhobj = objref.Object();
    Rhino.Geometry.Brep brep = objref.Brep();
    if (rhobj == null || brep == null)
      return Rhino.Commands.Result.Failure;

    rhobj.Select(false);
    Rhino.Geometry.Curve[] curves = brep.DuplicateEdgeCurves(true);
    double tol = doc.ModelAbsoluteTolerance * 2.1;
    curves = Rhino.Geometry.Curve.JoinCurves(curves, tol);
    for (int i = 0; i < curves.Length; i++)
    {
      Guid id = doc.Objects.AddCurve(curves[i]);
      doc.Objects.Select(id);
    }
    doc.Views.Redraw();
    return Rhino.Commands.Result.Success;
  }
开发者ID:jackieyin2015,项目名称:rhinocommon,代码行数:25,代码来源:ex_dupborder.cs


示例12: ObjectColor

  public static Rhino.Commands.Result ObjectColor(Rhino.RhinoDoc doc)
  {
    Rhino.DocObjects.ObjRef[] objRefs;
    Rhino.Commands.Result cmdResult = Rhino.Input.RhinoGet.GetMultipleObjects("Select objects to change color", false, Rhino.DocObjects.ObjectType.AnyObject, out objRefs);
    if (cmdResult != Rhino.Commands.Result.Success)
      return cmdResult;

    System.Drawing.Color color = System.Drawing.Color.Black;
    bool rc = Rhino.UI.Dialogs.ShowColorDialog(ref color);
    if (!rc)
      return Rhino.Commands.Result.Cancel;

    for (int i = 0; i < objRefs.Length; i++)
    {
      Rhino.DocObjects.RhinoObject obj = objRefs[i].Object();
      if (null == obj || obj.IsReference)
        continue;

      if (color != obj.Attributes.ObjectColor)
      {
        obj.Attributes.ObjectColor = color;
        obj.Attributes.ColorSource = Rhino.DocObjects.ObjectColorSource.ColorFromObject;
        obj.CommitChanges();
      }
    }

    doc.Views.Redraw();

    return Rhino.Commands.Result.Success;
  }
开发者ID:jackieyin2015,项目名称:rhinocommon,代码行数:30,代码来源:ex_objectcolor.cs


示例13: RunCommand

 protected override Rhino.Commands.Result  RunCommand(RhinoDoc doc, Rhino.Commands.RunMode mode)
 {
     //List<Rhino.DocObjects.RhinoObject> ObjectList = new List<Rhino.DocObjects.RhinoObject>();
     Rhino.DocObjects.ObjectEnumeratorSettings settings = new Rhino.DocObjects.ObjectEnumeratorSettings();
     settings.DeletedObjects = false;
     settings.HiddenObjects = false;
     settings.LockedObjects = true;
     settings.NormalObjects = true;
     settings.VisibleFilter = true;
     settings.ObjectTypeFilter = Rhino.DocObjects.ObjectType.Brep & Rhino.DocObjects.ObjectType.Surface & Rhino.DocObjects.ObjectType.Extrusion;
     List<Rhino.DocObjects.RhinoObject> RC_List = new List<Rhino.DocObjects.RhinoObject>();
     foreach (Rhino.DocObjects.RhinoObject RHobj in Rhino.RhinoDoc.ActiveDoc.Objects.GetObjectList(settings))
     {
         if (RHobj.ObjectType == Rhino.DocObjects.ObjectType.Brep || RHobj.ObjectType == Rhino.DocObjects.ObjectType.Surface || RHobj.ObjectType == Rhino.DocObjects.ObjectType.Extrusion)
         {
             RC_List.Add(RHobj);
         }
     }
     if (RC_List.Count != 0)
     {
         Ret_NURBS_Scene = new RhCommon_Scene(RC_List, Air_Temp, Rel_Humidity, Atm_pressure, Atten_Choice, Edge_Freq, false);
         if (!Ret_NURBS_Scene.Valid) return Rhino.Commands.Result.Failure;
         Ret_Mesh_Scene = new Polygon_Scene(RC_List, Air_Temp, Rel_Humidity, Atm_pressure, Atten_Choice, Edge_Freq, false);
         if (!Ret_Mesh_Scene.Valid) return Rhino.Commands.Result.Failure;
     }
     C_Result = Rhino.Commands.Result.Success;
     return Rhino.Commands.Result.Success;
 }
开发者ID:MengdiGuo,项目名称:PachydermAcoustic_Rhinoceros,代码行数:28,代码来源:GetModel.cs


示例14: ReplayHistory

    /// <summary>
    /// Rhino calls this function to remake objects when inputs have changed.  
    /// </summary>
    protected override bool ReplayHistory(Rhino.DocObjects.ReplayHistoryData replay)
    {
      Rhino.DocObjects.ObjRef objref = null;
      int segmentCount = 0;
      int pointCount = 0;

      if (!ReadHistory(replay, ref objref, ref segmentCount, ref pointCount))
        return false;

      Rhino.Geometry.Curve curve = objref.Curve();
      if (null == curve)
        return false;

      if (pointCount != replay.Results.Length)
        return false;

      Rhino.Geometry.Point3d[] points;
      curve.DivideByCount(segmentCount, true, out points);
      if (null == points)
        return false;

      for (int i = 0; i < points.Length; i++)
        replay.Results[i].UpdateToPoint(points[i], null);

      return true;
    }
开发者ID:jackieyin2015,项目名称:rhinocommon,代码行数:29,代码来源:ex_historyCommand.cs


示例15: Bend

    public static Rhino.Commands.Result Bend(Rhino.RhinoDoc doc)
    {
        ObjectType filter = SpaceMorphObjectFilter();
        Rhino.DocObjects.ObjRef objref;
        Rhino.Commands.Result rc = Rhino.Input.RhinoGet.GetOneObject("Select object to bend", false, filter, out objref);
        if (rc != Rhino.Commands.Result.Success || objref == null)
          return rc;

        Rhino.Geometry.Line axis;
        rc = Rhino.Input.RhinoGet.GetLine(out axis);
        if (rc != Rhino.Commands.Result.Success || axis == null)
          return rc;

        Rhino.Geometry.Point3d point;
        rc = Rhino.Input.RhinoGet.GetPoint("Point to bend through", false, out point);
        if (rc != Rhino.Commands.Result.Success || !point.IsValid)
          return rc;

        Rhino.Geometry.Morphs.BendSpaceMorph morph = new Rhino.Geometry.Morphs.BendSpaceMorph(axis.From, axis.To, point, true, false);

        Rhino.Geometry.GeometryBase geom = objref.Geometry().Duplicate();
        if (morph.Morph(geom))
        {
          doc.Objects.Add(geom);
          doc.Views.Redraw();
        }

        return Rhino.Commands.Result.Success;
    }
开发者ID:acormier,项目名称:RhinoCommonExamples,代码行数:29,代码来源:ex_splop.cs


示例16: AddLine

    public static Rhino.Commands.Result AddLine(Rhino.RhinoDoc doc)
    {
        Rhino.Input.Custom.GetPoint gp = new Rhino.Input.Custom.GetPoint();
        gp.SetCommandPrompt("Start of line");
        gp.Get();
        if (gp.CommandResult() != Rhino.Commands.Result.Success)
          return gp.CommandResult();

        Rhino.Geometry.Point3d pt_start = gp.Point();

        gp.SetCommandPrompt("End of line");
        gp.SetBasePoint(pt_start, false);
        gp.DrawLineFromPoint(pt_start, true);
        gp.Get();
        if (gp.CommandResult() != Rhino.Commands.Result.Success)
          return gp.CommandResult();

        Rhino.Geometry.Point3d pt_end = gp.Point();
        Rhino.Geometry.Vector3d v = pt_end - pt_start;
        if (v.IsTiny(Rhino.RhinoMath.ZeroTolerance))
          return Rhino.Commands.Result.Nothing;

        if (doc.Objects.AddLine(pt_start, pt_end) != Guid.Empty)
        {
          doc.Views.Redraw();
          return Rhino.Commands.Result.Success;
        }
        return Rhino.Commands.Result.Failure;
    }
开发者ID:acormier,项目名称:RhinoCommonExamples,代码行数:29,代码来源:ex_addline.cs


示例17: CircleCenter

  public static Rhino.Commands.Result CircleCenter(Rhino.RhinoDoc doc)
  {
    Rhino.Input.Custom.GetObject go = new Rhino.Input.Custom.GetObject();
    go.SetCommandPrompt("Select objects");
    go.GeometryFilter = Rhino.DocObjects.ObjectType.Curve;
    go.GeometryAttributeFilter = Rhino.Input.Custom.GeometryAttributeFilter.ClosedCurve;
    go.GetMultiple(1, 0);
    if( go.CommandResult() != Rhino.Commands.Result.Success )
      return go.CommandResult();

    Rhino.DocObjects.ObjRef[] objrefs = go.Objects();
    if( objrefs==null )
      return Rhino.Commands.Result.Nothing;

    double tolerance = doc.ModelAbsoluteTolerance;
    for( int i=0; i<objrefs.Length; i++ )
    {
      // get the curve geometry
      Rhino.Geometry.Curve curve = objrefs[i].Curve();
      if( curve==null )
        continue;
      Rhino.Geometry.Circle circle;
      if( curve.TryGetCircle(out circle, tolerance) )
      {
        Rhino.RhinoApp.WriteLine("Circle{0}: center = {1}", i+1, circle.Center);
      }
    }
    return Rhino.Commands.Result.Success;
  }
开发者ID:jackieyin2015,项目名称:rhinocommon,代码行数:29,代码来源:ex_circlecenter.cs


示例18: ActiveViewport

    public static Rhino.Commands.Result ActiveViewport(Rhino.RhinoDoc doc)
    {
        Rhino.Display.RhinoView view = doc.Views.ActiveView;
        if (view == null)
          return Rhino.Commands.Result.Failure;

        Rhino.Display.RhinoPageView pageview = view as Rhino.Display.RhinoPageView;
        if (pageview != null)
        {
          string layout_name = pageview.PageName;
          if (pageview.PageIsActive)
          {
        Rhino.RhinoApp.WriteLine("The layout {0} is active", layout_name);
          }
          else
          {
        string detail_name = pageview.ActiveViewport.Name;
        Rhino.RhinoApp.WriteLine("The detail {0} on layout {1} is active", detail_name, layout_name);
          }
        }
        else
        {
          string viewport_name = view.MainViewport.Name;
          Rhino.RhinoApp.WriteLine("The viewport {0} is active", viewport_name);
        }
        return Rhino.Commands.Result.Success;
    }
开发者ID:acormier,项目名称:RhinoCommonExamples,代码行数:27,代码来源:ex_activeviewport.cs


示例19: Create

        public ActionResult Create(Rhino.Security.Mgmt.Dtos.PermissionDto item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            using (_conversation.SetAsCurrent())
            {
                Permission permissionToReturn = null;
                var itemMapped = _mapper.Map<Rhino.Security.Mgmt.Dtos.PermissionDto, Rhino.Security.Model.Permission>(item);
                Rhino.Security.Mgmt.Infrastructure.Mvc.ValidationHelpers.AddErrorsToModelState(ModelState, _validator.Validate(itemMapped), "item");
                if (ModelState.IsValid)
                {
                    permissionToReturn = _repository.Create(itemMapped);
                    _conversation.Flush();
                }

                return Json(new
                {
                    item = GetPermissionViewModel(permissionToReturn),
                    success = ModelState.IsValid,
                    errors = Rhino.Security.Mgmt.Infrastructure.Mvc.ValidationHelpers.BuildErrorDictionary(ModelState),
                });
            }
        }
开发者ID:smartinz,项目名称:Rhino-Security-Administration,代码行数:26,代码来源:PermissionController.cs


示例20: Get

 /// <summary>
 /// Perform the 'get' operation.
 /// </summary>
 /// <param name="line"></param>
 /// <returns></returns>
 public Commands.Result Get(out Rhino.Geometry.Line line)
 {
   IntPtr pThis = NonConstPointer();
   line = Rhino.Geometry.Line.Unset;
   int rc = UnsafeNativeMethods.RHC_RhinoGetLine2(pThis, ref line, IntPtr.Zero);
   return (Commands.Result)rc;
 }
开发者ID:gwinsky,项目名称:rhinocommon,代码行数:12,代码来源:rhinosdkgetline.cs



注:本文中的Rhino类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# RhinoAutoMocker类代码示例发布时间:2022-05-24
下一篇:
C# RhetosTestContainer类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap