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 System.Drawing | |
import System.Windows.Forms | |
from System.Drawing import * | |
from System.Windows.Forms import * | |
class SliderForm(Form): | |
def __init__(self): | |
self.__value_changed_callback = None | |
self.InitializeComponent() |
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 class TestDynamicCommandPlugIn : Rhino.PlugIns.PlugIn | |
{ | |
// Override CreateCommands to generate your own commands on the fly | |
protected override void CreateCommands() | |
{ | |
base.CreateCommands(); | |
// uncomment the following to get your "private" command to work | |
//var cmd = new TestSecretCommand(); | |
//Rhino.Runtime.HostUtils.RegisterDynamicCommand(this, cmd); | |
} |
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
# The following script is meant to be run inside of IronPython | |
# It demonstrates how to automate Rhino from a script | |
import System | |
# start an instance of Rhino | |
t = System.Type.GetTypeFromProgID("Rhino5.Application") | |
rhino = System.Activator.CreateInstance(t) | |
# show Rhino (optional) | |
rhino.Visible = True |
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
from itertools import * | |
def tonumberlist(s): | |
rc = [] | |
def shouldtake(x): | |
return str.isdigit(x) or x=='.' | |
i = iter(s.replace(' ','')) | |
while True: | |
try: | |
rc.append(float(''.join(takewhile(shouldtake, i)))) |
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
#include "StdAfx.h" | |
// for Marlin UI Test | |
class CMarlinUiClass | |
{ | |
}; | |
typedef int (CALLBACK* GETBOOLVALUEPROC)(CMarlinUiClass* pClass, const RHMONO_STRING* name); | |
typedef void (CALLBACK* SETBOOLVALUEPROC)(CMarlinUiClass* pClass, const RHMONO_STRING* name, int value); |
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
using System.Runtime.InteropServices; | |
public class MyCommand : Rhino.Commands.Command | |
{ | |
//...other command stuff... | |
[DllImport("user32.dll")] | |
static extern IntPtr GetParent(IntPtr hWnd); | |
[DllImport("user32.dll")] |
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
// C++ portion | |
// Declare a struct that directly maps to an ON_3dPoint | |
struct ON_3DPOINT_STRUCT{ double val[3]; }; | |
extern "C" __declspec(dllexport) | |
void ComputeMeshPoints(int resX, int resY, int resZ, | |
double* data_array, int data_count, double iso, | |
ON_3DPOINT_STRUCT min_corner, ON_3DPOINT_STRUCT max_corner, | |
ON_SimpleArray<ON_3dPoint>* output_points) | |
{ |
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() |
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
"""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: |