This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scriptcontext | |
import time | |
import System | |
import Rhino | |
rc, view = Rhino.Input.RhinoGet.GetView("select view") | |
print "position mouse where you want" | |
for i in [5,4,3,2,1]: | |
time.sleep(0.5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Rhino | |
# read geometry out of 3dm files and filter by layernames | |
if DoImport and FilePaths and LayerNames: | |
geometry = [] | |
for filepath in FilePaths: | |
model = Rhino.FileIO.File3dm.Read(filepath) | |
if not model: continue | |
for layer in LayerNames: | |
objs = model.Objects.FindByLayer(layer) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Sample script that accesses the shapeways API | |
http://www.shapeways.com/api | |
""" | |
import wsdlprovider | |
wsdl_url = "http://api.shapeways.com/v1/wsdl.php" | |
username = "username" | |
password = "password" | |
application_id = "rhinotest" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import rhinoscriptsyntax as rs | |
import Rhino | |
import clr | |
clr.AddReference("grasshopper") | |
import Grasshopper as gh | |
DomainU = rs.SurfaceDomain(srf, 0) | |
DomainV = rs.SurfaceDomain(srf, 1) | |
flatlist = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static bool CellulateGrid3D(List<Rhino.Geometry.Point3d[]> points1, | |
List<Rhino.Geometry.Point3d[]> points2, | |
out Rhino.Geometry.Line[] wires, | |
out List<Rhino.Geometry.Point3d[]> cells, | |
out Rhino.Geometry.Brep[] boxes) | |
{ | |
bool rc = false; | |
if (points1.Count > 0 && points2.Count > 0) | |
{ | |
using (var divide_points1 = new ClassArrayPointArray(points1)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Your "get" class will have code that looks like. | |
var go = new Rhino.Input.Custom.GetOption(); | |
var optDbl = new Rhino.Input.Custom.OptionDouble(12, 0,100); | |
go.SetCommandPrompt("Give me an option"); | |
go.SetCommandPromptDefault(""); | |
go.AcceptCustomMessage(true); // NEW!! | |
while (true) | |
{ | |
// need to clear and reset the command options every iteration because | |
// Rhino doesn't know that it needs to update the option string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
distance = [] | |
vector = [] | |
#### Check each attractor against all surface points | |
for pt in srfPT: | |
v = None | |
for att in attPT: | |
line_vector = att - pt | |
if not v or line_vector.Length < v.Length: | |
v = line_vector |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""recursively subdivide surface based on curvature | |
author: robert stuart-smith | 2008 | www.kokkugia.com | |
translated to python by S. Baer (2012)""" | |
import rhinoscriptsyntax as rs | |
import scriptcontext | |
def PanelizeSurface(surface, subdivisions, generation): | |
#conditional statement to stop subdividing infinitely | |
#(as we will Call the Function recursively) | |
if generation<=0: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Protected Overrides Function RunCommand(ByVal doc As RhinoDoc, ByVal mode As Rhino.Commands.RunMode) As Rhino.Commands.Result | |
Dim command_rc As Rhino.Commands.Result | |
' Sweep the cross section | |
Dim rhobj As Rhino.DocObjects.ObjRef = Nothing | |
command_rc = Rhino.Input.RhinoGet.GetOneObject("Profile shape", False, DocObjects.ObjectType.Curve, rhobj) | |
If command_rc <> Commands.Result.Success Then Return command_rc | |
Dim shape As Rhino.Geometry.Curve = rhobj.Curve() | |
If shape Is Nothing Then Return Commands.Result.Failure | |
doc.Objects.UnselectAll() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import rhinoscriptsyntax as rs | |
import scriptcontext | |
def luistest(): | |
id = rs.GetObject("select point cloud", rs.filter.pointcloud) | |
pc = scriptcontext.doc.Objects.Find(id) | |
pc = pc.PointCloudGeometry | |
print "ContainsColors =",pc.ContainsColors | |
c = pc.GetColors() |
OlderNewer