Site Tools


Differences

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

Link to this comparison view

developer:rhinocommonsamples:isocurvedensity [2015/09/14] (current)
Line 1: Line 1:
 +===== Sample: Adjusting Surface Isocurve Density =====
 +
 +===== C# =====
 +<code c#>
 +public static Rhino.Commands.Result IsocurveDensity(Rhino.RhinoDoc doc)
 +{
 +  Rhino.DocObjects.ObjRef objref;
 +  var rc = Rhino.Input.RhinoGet.GetOneObject("​Select surface",​ false, Rhino.DocObjects.ObjectType.Surface,​ out objref);
 +  if( rc!= Rhino.Commands.Result.Success )
 +    return rc;
 +
 +  var brep_obj = objref.Object() as Rhino.DocObjects.BrepObject;​
 +  if( brep_obj!=null )
 +  {
 +    brep_obj.Attributes.WireDensity = 3;
 +    brep_obj.CommitChanges();​
 +    doc.Views.Redraw();​
 +  }
 +  return Rhino.Commands.Result.Success;​
 +}
 +</​code>​
 +===== VB.NET =====
 +<code vb>
 +Public Shared Function IsocurveDensity(doc As Rhino.RhinoDoc) As Rhino.Commands.Result
 +  Dim objref As Rhino.DocObjects.ObjRef = Nothing
 +  Dim rc = Rhino.Input.RhinoGet.GetOneObject("​Select surface",​ False, Rhino.DocObjects.ObjectType.Surface,​ objref)
 +  If rc <> Rhino.Commands.Result.Success Then
 +    Return rc
 +  End If
 +
 +  Dim brep_obj = TryCast(objref.Object(),​ Rhino.DocObjects.BrepObject)
 +  If brep_obj IsNot Nothing Then
 +    brep_obj.Attributes.WireDensity = 3
 +    brep_obj.CommitChanges()
 +    doc.Views.Redraw()
 +  End If
 +  Return Rhino.Commands.Result.Success
 +End Function
 +</​code>​
 +===== Python =====
 +<code python>
 +import Rhino
 +import scriptcontext
 +
 +def IsocurveDensity():​
 +    rc, objref = Rhino.Input.RhinoGet.GetOneObject("​Select surface",​ False, Rhino.DocObjects.ObjectType.Surface)
 +    if rc!= Rhino.Commands.Result.Success:​ return
 +
 +    brep_obj = objref.Object()
 +    if brep_obj:
 +        brep_obj.Attributes.WireDensity = 3
 +        brep_obj.CommitChanges()
 +        scriptcontext.doc.Views.Redraw()
 +
 +if __name__=="​__main__":​
 +    IsocurveDensity()
 +</​code>​
 +
 +{{tag>​Developer rhinocommon}}
  
developer/rhinocommonsamples/isocurvedensity.txt ยท Last modified: 2015/09/14 (external edit)