Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

developer:rhinocommonsamples:srfpt [2015/09/14]
developer:rhinocommonsamples:srfpt [2020/08/14] (current)
Line 1: Line 1:
 +===== Sample: Surface from Corner Points =====
 +
 +===== C# =====
 +<code c#>
 +public class SurfaceFromCornersCommand : Rhino.Commands.Command
 +{
 +  public override string EnglishName
 +  {
 +    get { return "csSurfaceFromCorners"; }
 +  }
 +
 +  protected override Result RunCommand(RhinoDoc doc, RunMode mode)
 +  {
 +    var surface = NurbsSurface.CreateFromCorners(
 +      new Point3d(5, 0, 0),
 +      new Point3d(5, 5, 5),
 +      new Point3d(0, 5, 0),
 +      new Point3d(0, 0, 0));
 +
 +    doc.Objects.AddSurface(surface);
 +    doc.Views.Redraw();
 +
 +    return Rhino.Commands.Result.Success;
 +  }
 +}
 +</code>
 +===== VB.NET =====
 +<code vb>
 +Public Class SurfaceFromCornersCommand
 +  Inherits Rhino.Commands.Command
 +  Public Overrides ReadOnly Property EnglishName() As String
 +    Get
 +      Return "vbSurfaceFromCorners"
 +    End Get
 +  End Property
 +
 +  Protected Overrides Function RunCommand(doc As RhinoDoc, mode As RunMode) As Result
 +    Dim surface = NurbsSurface.CreateFromCorners(
 +      New Point3d(5, 0, 0),
 +      New Point3d(5, 5, 5),
 +      New Point3d(0, 5, 0),
 +      New Point3d(0, 0, 0))
 +
 +    doc.Objects.AddSurface(surface)
 +    doc.Views.Redraw()
 +
 +    Return Rhino.Commands.Result.Success
 +  End Function
 +End Class
 +d Namespace
 +</code>
 +===== Python =====
 +<code python>
 +from Rhino.Geometry import NurbsSurface, Point3d
 +from scriptcontext import doc
 +
 +surface = NurbsSurface.CreateFromCorners(
 +  Point3d(5, 0, 0),
 +  Point3d(5, 5, 5),
 +  Point3d(0, 5, 0),
 +  Point3d(0, 0, 0));
 +
 +doc.Objects.AddSurface(surface);
 +doc.Views.Redraw();
 +</code>
 +
 +{{tag>Developer rhinocommon}}