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
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
#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
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
# 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
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
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
"""Use Google translate web service""" | |
import rhinoscriptsyntax as rs | |
import json, urllib | |
import scriptcontext | |
# Api key that I (Steve Baer) got from Google | |
# http://code.google.com/apis/console-help/#UsingKeys | |
# You might want to generate your own key, but I don't care | |
# if you continue to use this one. | |
KEY = "AIzaSyAZGoS-GjZGaSHZMZdoczfdUtWTjm_D-p4" |
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.Threading.Tasks as tasks | |
import Rhino | |
import rhinoscriptsyntax as rs | |
import time, math | |
import scriptcontext | |
def radial_contour(brep, parallel, slice_count=360): | |
"""Generate series of curve slices through a brep by rotating a plane | |
multiple times and intersecting that plane with the brep. This function |
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" |